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

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

Issue 2365523002: Materialized the font/icon color for some default rows in the system menu. (Closed)
Patch Set: Addressed tdanderson@ comments from previous patch set. Created 4 years, 3 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
« no previous file with comments | « ash/common/system/ime/tray_ime_chromeos.cc ('k') | ash/common/system/tray/tray_item_more.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
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 more arrow 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 // Returns a style that will be applied to elements in the UpdateStyle()
39 // method. e.g. changing the label's font and color. Descendants can override
40 // to apply specialized configurations of the style. e.g. changing the style's
41 // ColorStyle based on whether Bluetooth is enabled/disabled.
42 virtual std::unique_ptr<TrayPopupItemStyle> CreateStyle() const;
43
44 // Applies the style created from CreateStyle(). Should be called whenever any
45 // input state changes that changes the style configuration created by
46 // CreateStyle(). e.g. if Bluetooth is changed between enabled/disabled then
47 // a differently configured style will be returned from CreateStyle() and thus
48 // it will need to be applied.
49 //
50 // By default this will be called when OnNativeThemeChanged() is called which
51 // will ensure the most up to date theme is actually applied.
52 virtual void UpdateStyle();
53
34 private: 54 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. 55 // Overridden from ActionableView.
40 bool PerformAction(const ui::Event& event) override; 56 bool PerformAction(const ui::Event& event) override;
41 57
42 // Overridden from views::View. 58 // Overridden from views::View.
43 void Layout() override; 59 void Layout() override;
44 void GetAccessibleState(ui::AXViewState* state) override; 60 void GetAccessibleState(ui::AXViewState* state) override;
45 void OnNativeThemeChanged(const ui::NativeTheme* theme) override; 61 void OnNativeThemeChanged(const ui::NativeTheme* theme) override;
46 62
47 SystemTrayItem* owner_; 63 SystemTrayItem* owner_;
48 // True if |more_| should be shown. 64 // True if |more_| should be shown.
49 bool show_more_; 65 bool show_more_;
50 views::ImageView* icon_; 66 views::ImageView* icon_;
51 views::Label* label_; 67 views::Label* label_;
52 views::ImageView* more_; 68 views::ImageView* more_;
53 base::string16 accessible_name_; 69 base::string16 accessible_name_;
54 70
55 DISALLOW_COPY_AND_ASSIGN(TrayItemMore); 71 DISALLOW_COPY_AND_ASSIGN(TrayItemMore);
56 }; 72 };
57 73
58 } // namespace ash 74 } // namespace ash
59 75
60 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ 76 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_
OLDNEW
« no previous file with comments | « ash/common/system/ime/tray_ime_chromeos.cc ('k') | ash/common/system/tray/tray_item_more.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698