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_ITEM_MORE_H_ | 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ |
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ | 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ |
7 | 7 |
8 #include <memory> | |
9 | |
8 #include "ash/common/system/tray/actionable_view.h" | 10 #include "ash/common/system/tray/actionable_view.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "ui/views/view.h" | 12 #include "ui/views/view.h" |
11 | 13 |
12 namespace views { | 14 namespace views { |
13 class ImageView; | 15 class ImageView; |
14 class Label; | 16 class Label; |
15 class View; | 17 class View; |
16 } | 18 } |
17 | 19 |
18 namespace ash { | 20 namespace ash { |
19 class SystemTrayItem; | 21 class SystemTrayItem; |
22 class TrayPopupItemStyle; | |
20 | 23 |
21 // A view with a chevron ('>') on the right edge. Clicking on the view brings up | 24 // A view with a chevron ('>') on the right edge. Clicking on the view brings up |
22 // the detailed view of the tray-item that owns it. | 25 // the detailed view of the tray-item that owns it. |
23 class TrayItemMore : public ActionableView { | 26 class TrayItemMore : public ActionableView { |
24 public: | 27 public: |
25 TrayItemMore(SystemTrayItem* owner, bool show_more); | 28 TrayItemMore(SystemTrayItem* owner, bool show_more); |
26 ~TrayItemMore() override; | 29 ~TrayItemMore() override; |
27 | 30 |
28 SystemTrayItem* owner() const { return owner_; } | 31 SystemTrayItem* owner() const { return owner_; } |
29 | 32 |
30 void SetLabel(const base::string16& label); | 33 void SetLabel(const base::string16& label); |
31 void SetImage(const gfx::ImageSkia& image_skia); | 34 void SetImage(const gfx::ImageSkia& image_skia); |
32 void SetAccessibleName(const base::string16& name); | 35 void SetAccessibleName(const base::string16& name); |
33 | 36 |
37 protected: | |
38 virtual std::unique_ptr<TrayPopupItemStyle> CreateStyle() const; | |
39 | |
40 // TODO(bruthig) Document me. | |
tdanderson
2016/09/22 20:44:16
Can you add some documentation (here and perhaps s
bruthig
2016/09/22 21:47:22
Done. WDYT?
| |
41 virtual void UpdateStyle(); | |
42 | |
34 private: | 43 private: |
35 // TODO(bruthig): Re-design to inform subclasses when the style changes while | |
36 // avoiding virtual function calls from the constructor. | |
37 void UpdateStyle(); | |
38 | |
39 // Overridden from ActionableView. | 44 // Overridden from ActionableView. |
40 bool PerformAction(const ui::Event& event) override; | 45 bool PerformAction(const ui::Event& event) override; |
41 | 46 |
42 // Overridden from views::View. | 47 // Overridden from views::View. |
43 void Layout() override; | 48 void Layout() override; |
44 void GetAccessibleState(ui::AXViewState* state) override; | 49 void GetAccessibleState(ui::AXViewState* state) override; |
45 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; | 50 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; |
46 | 51 |
47 SystemTrayItem* owner_; | 52 SystemTrayItem* owner_; |
48 // True if |more_| should be shown. | 53 // True if |more_| should be shown. |
49 bool show_more_; | 54 bool show_more_; |
50 views::ImageView* icon_; | 55 views::ImageView* icon_; |
51 views::Label* label_; | 56 views::Label* label_; |
52 views::ImageView* more_; | 57 views::ImageView* more_; |
53 base::string16 accessible_name_; | 58 base::string16 accessible_name_; |
54 | 59 |
55 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); | 60 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); |
56 }; | 61 }; |
57 | 62 |
58 } // namespace ash | 63 } // namespace ash |
59 | 64 |
60 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ | 65 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ |
OLD | NEW |