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 #include "third_party/skia/include/core/SkColor.h" |
12 | 12 |
13 namespace views { | 13 namespace views { |
14 class ImageView; | 14 class ImageView; |
15 } | 15 } |
16 | 16 |
| 17 namespace gfx { |
| 18 struct VectorIcon; |
| 19 } |
| 20 |
17 namespace ash { | 21 namespace ash { |
18 class TrayItemView; | 22 class TrayItemView; |
19 | 23 |
20 // A system tray item that uses an image as its "tray view" in the status area. | 24 // A system tray item that uses an image as its "tray view" in the status area. |
21 class ASH_EXPORT TrayImageItem : public SystemTrayItem { | 25 class ASH_EXPORT TrayImageItem : public SystemTrayItem { |
22 public: | 26 public: |
23 TrayImageItem(SystemTray* system_tray, int resource_id, UmaType uma_type); | 27 TrayImageItem(SystemTray* system_tray, |
| 28 const gfx::VectorIcon& icon, |
| 29 UmaType uma_type); |
24 ~TrayImageItem() override; | 30 ~TrayImageItem() override; |
25 | 31 |
26 views::View* tray_view(); | 32 views::View* tray_view(); |
27 | 33 |
28 protected: | 34 protected: |
29 virtual bool GetInitialVisibility() = 0; | 35 virtual bool GetInitialVisibility() = 0; |
30 | 36 |
31 // Overridden from SystemTrayItem. | 37 // Overridden from SystemTrayItem. |
32 views::View* CreateTrayView(LoginStatus status) override; | 38 views::View* CreateTrayView(LoginStatus status) override; |
33 views::View* CreateDefaultView(LoginStatus status) override; | 39 views::View* CreateDefaultView(LoginStatus status) override; |
34 views::View* CreateDetailedView(LoginStatus status) override; | 40 views::View* CreateDetailedView(LoginStatus status) override; |
35 void DestroyTrayView() override; | 41 void DestroyTrayView() override; |
36 void DestroyDefaultView() override; | 42 void DestroyDefaultView() override; |
37 void DestroyDetailedView() override; | 43 void DestroyDetailedView() override; |
38 void UpdateAfterLoginStatusChange(LoginStatus status) override; | 44 void UpdateAfterLoginStatusChange(LoginStatus status) override; |
39 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; | 45 void UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) override; |
40 | 46 |
41 // Sets the color of the material design icon to |color|. | 47 // Sets the color of the icon to |color|. |
42 void SetIconColor(SkColor color); | 48 void SetIconColor(SkColor color); |
43 | 49 |
44 // Changes the icon of the tray-view to the specified resource. | |
45 // TODO(tdanderson): This is only used for non-material design, so remove it | |
46 // when material design is the default. See crbug.com/625692. | |
47 void SetImageFromResourceId(int resource_id); | |
48 | |
49 private: | 50 private: |
50 // Sets the current icon on |tray_view_|'s ImageView. | 51 // Sets the current icon on |tray_view_|'s ImageView. |
51 void UpdateImageOnImageView(); | 52 void UpdateImageOnImageView(); |
52 | 53 |
53 // The resource ID for the non-material design icon in the tray. | 54 // The icon and its current color. |
54 // TODO(tdanderson): This is only used for non-material design, so remove it | 55 const gfx::VectorIcon& icon_; |
55 // when material design is the default. See crbug.com/625692. | |
56 int resource_id_; | |
57 | |
58 // The color of the material design icon in the tray. | |
59 SkColor icon_color_; | 56 SkColor icon_color_; |
60 | 57 |
61 // The image view in the tray. | 58 // The image view in the tray. |
62 TrayItemView* tray_view_; | 59 TrayItemView* tray_view_; |
63 | 60 |
64 DISALLOW_COPY_AND_ASSIGN(TrayImageItem); | 61 DISALLOW_COPY_AND_ASSIGN(TrayImageItem); |
65 }; | 62 }; |
66 | 63 |
67 } // namespace ash | 64 } // namespace ash |
68 | 65 |
69 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ | 66 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_IMAGE_ITEM_H_ |
OLD | NEW |