Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_STYLE_H_ | |
| 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_STYLE_H_ | |
| 7 | |
| 8 #include "base/observer_list.h" | |
| 9 #include "third_party/skia/include/core/SkColor.h" | |
| 10 | |
| 11 namespace ui { | |
| 12 class NativeTheme; | |
| 13 } // namespace ui | |
| 14 | |
| 15 namespace views { | |
| 16 class Label; | |
| 17 } // namespace views | |
| 18 | |
| 19 namespace ash { | |
| 20 class TrayPopupItemStyleObserver; | |
| 21 | |
| 22 // Central style provider for the system tray popup items. Makes it easier to | |
|
tdanderson
2016/09/12 18:51:47
I'd prefer "rows", "system menu rows", or just "th
bruthig
2016/09/15 18:56:30
Done. Let's discuss alternatives offline.
tdanderson
2016/09/15 19:49:33
Acknowledged.
| |
| 23 // ensure all visuals are consistent and easily updated in one spot instead of | |
| 24 // being defined in multiple places throughout the code. | |
| 25 class TrayPopupItemStyle { | |
| 26 public: | |
| 27 // The different visual styles that a row can have. | |
| 28 enum class ColorStyle { | |
| 29 // Active and clickable | |
|
tdanderson
2016/09/12 18:51:47
nit: . at end of comments
bruthig
2016/09/15 18:56:30
Done.
| |
| 30 ACTIVE, | |
| 31 // Inactive but clickable | |
| 32 INACTIVE, | |
| 33 // Disabled and not clickable | |
| 34 DISABLED, | |
| 35 }; | |
| 36 | |
| 37 // The different font styles that a row can have. | |
| 38 enum class FontStyle { | |
|
tdanderson
2016/09/12 18:51:47
I'm having a hard time trying to figure out what a
bruthig
2016/09/15 18:56:30
FTR I took this from the "System menu typography"
tdanderson
2016/09/15 19:49:33
lg
| |
| 39 TITLE, | |
| 40 MAIN_PANEL_SECTION_ROW, | |
| 41 SUB_PANEL_SECTION_ROW, | |
| 42 SYSTEM_INFO, | |
| 43 CAPTION, | |
| 44 BUTTON, | |
| 45 }; | |
| 46 | |
| 47 TrayPopupItemStyle(const ui::NativeTheme* theme, FontStyle font_style); | |
| 48 virtual ~TrayPopupItemStyle(); | |
|
tdanderson
2016/09/12 18:51:47
should this actually be virtual?
bruthig
2016/09/15 18:56:30
Removed.
| |
| 49 | |
| 50 void AddObserver(TrayPopupItemStyleObserver* observer); | |
| 51 void RemoveObserver(TrayPopupItemStyleObserver* observer); | |
| 52 | |
| 53 const ui::NativeTheme* theme() const { return theme_; } | |
| 54 | |
| 55 // Sets the |theme_| and notifies observers. | |
| 56 void SetTheme(const ui::NativeTheme* theme); | |
| 57 | |
| 58 ColorStyle color_style() const { return color_style_; } | |
| 59 | |
| 60 // Sets the |color_style_| and notifies observers if |color_style_| changed. | |
| 61 void SetColorStyle(ColorStyle color_style); | |
| 62 | |
| 63 FontStyle font_style() const { return font_style_; } | |
| 64 | |
| 65 // Sets the |font_style_| notifies observers if |font_style_| changed. | |
| 66 void SetFontStyle(FontStyle font_style); | |
| 67 | |
| 68 SkColor GetForegroundColor() const; | |
| 69 | |
| 70 // Configures a Label as per the style (e.g. color, font). | |
| 71 void SetupLabel(views::Label* label) const; | |
| 72 | |
| 73 private: | |
| 74 void NotifyObserversStyleUpdated(); | |
| 75 | |
| 76 // The theme that the styles are dervied from. | |
| 77 const ui::NativeTheme* theme_; | |
| 78 | |
| 79 FontStyle font_style_; | |
| 80 | |
| 81 ColorStyle color_style_; | |
| 82 | |
| 83 base::ObserverList<TrayPopupItemStyleObserver> observers_; | |
| 84 }; | |
| 85 | |
| 86 } // namespace ash | |
| 87 | |
| 88 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_POPUP_ITEM_STYLE_H_ | |
| OLD | NEW |