OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/common/system/tray/system_tray_item.h" | 9 #include "ash/common/system/tray/system_tray_item.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "third_party/skia/include/core/SkColor.h" |
11 | 12 |
12 namespace views { | 13 namespace views { |
13 class ImageView; | 14 class ImageView; |
14 } | 15 } |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
17 class TrayItemView; | 18 class TrayItemView; |
18 | 19 |
19 class ASH_EXPORT TrayImageItem : public SystemTrayItem { | 20 class ASH_EXPORT TrayImageItem : public SystemTrayItem { |
20 public: | 21 public: |
21 TrayImageItem(SystemTray* system_tray, int resource_id, UmaType uma_type); | 22 TrayImageItem(SystemTray* system_tray, int resource_id, UmaType uma_type); |
22 ~TrayImageItem() override; | 23 ~TrayImageItem() override; |
23 | 24 |
24 views::View* tray_view(); | 25 views::View* tray_view(); |
25 | 26 |
26 protected: | 27 protected: |
27 virtual bool GetInitialVisibility() = 0; | 28 virtual bool GetInitialVisibility() = 0; |
28 | 29 |
29 // Overridden from SystemTrayItem. | 30 // Overridden from SystemTrayItem. |
30 views::View* CreateTrayView(LoginStatus status) override; | 31 views::View* CreateTrayView(LoginStatus status) override; |
31 views::View* CreateDefaultView(LoginStatus status) override; | 32 views::View* CreateDefaultView(LoginStatus status) override; |
32 views::View* CreateDetailedView(LoginStatus status) override; | 33 views::View* CreateDetailedView(LoginStatus status) override; |
33 void DestroyTrayView() override; | 34 void DestroyTrayView() override; |
34 void DestroyDefaultView() override; | 35 void DestroyDefaultView() override; |
35 void DestroyDetailedView() override; | 36 void DestroyDetailedView() override; |
36 void UpdateAfterLoginStatusChange(LoginStatus status) override; | 37 void UpdateAfterLoginStatusChange(LoginStatus status) override; |
37 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | 38 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; |
38 | 39 |
| 40 // Sets the color of the material design icon to |color|. |
| 41 void SetIconColor(SkColor color); |
| 42 |
39 // Changes the icon of the tray-view to the specified resource. | 43 // Changes the icon of the tray-view to the specified resource. |
| 44 // TODO(tdanderson): This is only used for non-material design, so remove it |
| 45 // when material design is the default. See crbug.com/625692. |
40 void SetImageFromResourceId(int resource_id); | 46 void SetImageFromResourceId(int resource_id); |
41 | 47 |
42 private: | 48 private: |
43 // Set the alignment of the image depending on the shelf alignment. | 49 // Set the alignment of the image depending on the shelf alignment. |
44 void SetItemAlignment(ShelfAlignment alignment); | 50 void SetItemAlignment(ShelfAlignment alignment); |
45 | 51 |
| 52 // Sets the current icon on |tray_view_|'s ImageView. |
| 53 void UpdateImageOnImageView(); |
| 54 |
| 55 // The resource ID for the non-material design icon in the tray. |
| 56 // TODO(tdanderson): This is only used for non-material design, so remove it |
| 57 // when material design is the default. See crbug.com/625692. |
46 int resource_id_; | 58 int resource_id_; |
| 59 |
| 60 // The color of the material design icon in the tray. |
| 61 SkColor icon_color_; |
| 62 |
47 TrayItemView* tray_view_; | 63 TrayItemView* tray_view_; |
48 | 64 |
49 DISALLOW_COPY_AND_ASSIGN(TrayImageItem); | 65 DISALLOW_COPY_AND_ASSIGN(TrayImageItem); |
50 }; | 66 }; |
51 | 67 |
52 } // namespace ash | 68 } // namespace ash |
53 | 69 |
54 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ | 70 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ |
OLD | NEW |