Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: ash/common/system/tray/tray_item_more.h

Issue 2699443004: Modify TrayItemMore to use enabled status (Closed)
Patch Set: Removed non-MD Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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> 8 #include <memory>
9 9
10 #include "ash/common/system/tray/actionable_view.h" 10 #include "ash/common/system/tray/actionable_view.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "ui/views/view.h" 12 #include "ui/views/view.h"
13 13
14 namespace views { 14 namespace views {
15 class ImageView; 15 class ImageView;
16 class Label; 16 class Label;
17 class View; 17 class View;
18 } 18 }
19 19
20 namespace ash { 20 namespace ash {
21 class SystemTrayItem; 21 class SystemTrayItem;
22 class TrayPopupItemStyle; 22 class TrayPopupItemStyle;
23 class TriView;
23 24
24 // A view with a more arrow on the right edge. Clicking on the view brings up 25 // A view with a more arrow on the right edge. Clicking on the view brings up
25 // the detailed view of the tray-item that owns it. 26 // the detailed view of the tray-item that owns it. If the view is disabled, it
27 // will not show the more arrow.
26 class TrayItemMore : public ActionableView { 28 class TrayItemMore : public ActionableView {
27 public: 29 public:
28 TrayItemMore(SystemTrayItem* owner, bool show_more); 30 explicit TrayItemMore(SystemTrayItem* owner);
29 ~TrayItemMore() override; 31 ~TrayItemMore() override;
30 32
31 void SetLabel(const base::string16& label); 33 void SetLabel(const base::string16& label);
32 void SetImage(const gfx::ImageSkia& image_skia); 34 void SetImage(const gfx::ImageSkia& image_skia);
33 void SetAccessibleName(const base::string16& name); 35 void SetAccessibleName(const base::string16& name);
34 36
35 protected: 37 protected:
36 // Returns a style that will be applied to elements in the UpdateStyle() 38 // Returns a style that will be applied to elements in the UpdateStyle()
37 // method. e.g. changing the label's font and color. Descendants can override 39 // method; e.g. the label's font and color. Calls HandleCreateStyle() which
38 // to apply specialized configurations of the style. e.g. changing the style's 40 // descendants can override to apply specialized configurations of the style.
41 // However, if the view is disabled will force disabled ColorStyle.
tdanderson 2017/02/17 22:29:47 Consider shortening to "Returns a style that will
mohsen 2017/02/21 21:04:56 Done.
42 std::unique_ptr<TrayPopupItemStyle> CreateStyle() const;
43
44 // Descendants can override to customize the style; e.g. to change the style's
39 // ColorStyle based on whether Bluetooth is enabled/disabled. 45 // ColorStyle based on whether Bluetooth is enabled/disabled.
40 virtual std::unique_ptr<TrayPopupItemStyle> CreateStyle() const; 46 virtual std::unique_ptr<TrayPopupItemStyle> HandleCreateStyle() const;
41 47
42 // Applies the style created from CreateStyle(). Should be called whenever any 48 // Applies the style created from CreateStyle(). Should be called whenever any
43 // input state changes that changes the style configuration created by 49 // input state changes that changes the style configuration created by
44 // CreateStyle(). e.g. if Bluetooth is changed between enabled/disabled then 50 // CreateStyle(). E.g. if Bluetooth is changed between enabled/disabled then
45 // a differently configured style will be returned from CreateStyle() and thus 51 // a differently configured style will be returned from CreateStyle() and thus
46 // it will need to be applied. 52 // it will need to be applied.
47 //
48 // By default this will be called when OnNativeThemeChanged() is called which
49 // will ensure the most up to date theme is actually applied.
50 virtual void UpdateStyle(); 53 virtual void UpdateStyle();
51 54
52 private: 55 private:
53 // Overridden from ActionableView. 56 // Overridden from ActionableView.
54 bool PerformAction(const ui::Event& event) override; 57 bool PerformAction(const ui::Event& event) override;
55 58
56 // Overridden from views::View. 59 // Overridden from views::View.
57 void GetAccessibleNodeData(ui::AXNodeData* node_data) override; 60 void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
61 void OnEnabledChanged() override;
58 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 62 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
59 63
60 // True if |more_| should be shown. 64 TriView* tri_view_;
61 bool show_more_;
62 views::ImageView* icon_; 65 views::ImageView* icon_;
63 views::Label* label_; 66 views::Label* label_;
64 views::ImageView* more_; 67 views::ImageView* more_;
65 base::string16 accessible_name_; 68 base::string16 accessible_name_;
66 69
67 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); 70 DISALLOW_COPY_AND_ASSIGN(TrayItemMore);
68 }; 71 };
69 72
70 } // namespace ash 73 } // namespace ash
71 74
72 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 75 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698