1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef ASH_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ 6 #define ASH_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ 7 8 #include "ash/system/tray/system_tray_item.h" 9 10 namespace views { 11 class ImageView; 12 } 13 14 namespace ash { 15 class TrayItemView; 16 17 class TrayImageItem : public SystemTrayItem { 18 public: 19 TrayImageItem(SystemTray* system_tray, int resource_id); 20 virtual ~TrayImageItem(); 21 22 views::View* tray_view(); 23 24 // Changes the icon of the tray-view to the specified resource. 25 void SetImageFromResourceId(int resource_id); 26 27 protected: 28 virtual bool GetInitialVisibility() = 0; 29 30 // Overridden from SystemTrayItem. 31 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; 32 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; 33 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; 34 virtual void DestroyTrayView() OVERRIDE; 35 virtual void DestroyDefaultView() OVERRIDE; 36 virtual void DestroyDetailedView() OVERRIDE; 37 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; 38 virtual void UpdateAfterShelfAlignmentChange( 39 ShelfAlignment alignment) OVERRIDE; 40 41 private: 42 // Set the alignment of the image depending on the shelf alignment. 43 void SetItemAlignment(ShelfAlignment alignment); 44 45 int resource_id_; 46 TrayItemView* tray_view_; 47 48 DISALLOW_COPY_AND_ASSIGN(TrayImageItem); 49 }; 50 51 } // namespace ash 52 53 #endif // ASH_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ 54