Index: ash/common/system/tray/tray_item_more.h |
diff --git a/ash/common/system/tray/tray_item_more.h b/ash/common/system/tray/tray_item_more.h |
index acd9b30a6b729354140f07d94da14388b5ba2347..0c9bac5cedc07be1874dc87af6637465c9bcb441 100644 |
--- a/ash/common/system/tray/tray_item_more.h |
+++ b/ash/common/system/tray/tray_item_more.h |
@@ -5,6 +5,8 @@ |
#ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ |
#define ASH_COMMON_SYSTEM_TRAY_TRAY_ITEM_MORE_H_ |
+#include <memory> |
+ |
#include "ash/common/system/tray/actionable_view.h" |
#include "base/macros.h" |
#include "ui/views/view.h" |
@@ -17,8 +19,9 @@ class View; |
namespace ash { |
class SystemTrayItem; |
+class TrayPopupItemStyle; |
-// A view with a chevron ('>') on the right edge. Clicking on the view brings up |
+// A view with a more arrow on the right edge. Clicking on the view brings up |
// the detailed view of the tray-item that owns it. |
class TrayItemMore : public ActionableView { |
public: |
@@ -31,11 +34,24 @@ class TrayItemMore : public ActionableView { |
void SetImage(const gfx::ImageSkia& image_skia); |
void SetAccessibleName(const base::string16& name); |
- private: |
- // TODO(bruthig): Re-design to inform subclasses when the style changes while |
- // avoiding virtual function calls from the constructor. |
- void UpdateStyle(); |
+ protected: |
+ // Returns a style that will be applied to elements in the UpdateStyle() |
+ // method. e.g. changing the label's font and color. Descendants can override |
+ // to apply specialized configurations of the style. e.g. changing the style's |
+ // ColorStyle based on whether Bluetooth is enabled/disabled. |
+ virtual std::unique_ptr<TrayPopupItemStyle> CreateStyle() const; |
+ // Applies the style created from CreateStyle(). Should be called whenever any |
+ // input state changes that changes the style configuration created by |
+ // CreateStyle(). e.g. if Bluetooth is changed between enabled/disabled then |
+ // a differently configured style will be returned from CreateStyle() and thus |
+ // it will need to be applied. |
+ // |
+ // By default this will be called when OnNativeThemeChanged() is called which |
+ // will ensure the most up to date theme is actually applied. |
+ virtual void UpdateStyle(); |
+ |
+ private: |
// Overridden from ActionableView. |
bool PerformAction(const ui::Event& event) override; |