Index: ui/native_theme/native_theme.h |
diff --git a/ui/native_theme/native_theme.h b/ui/native_theme/native_theme.h |
index 67af252d7bd849273056b306ab233ceddf78bcbb..2554586b692a7ead4edae6f1627ad912396639da 100644 |
--- a/ui/native_theme/native_theme.h |
+++ b/ui/native_theme/native_theme.h |
@@ -5,6 +5,7 @@ |
#ifndef UI_NATIVE_THEME_NATIVE_THEME_H_ |
#define UI_NATIVE_THEME_NATIVE_THEME_H_ |
+#include "base/observer_list.h" |
#include "third_party/skia/include/core/SkColor.h" |
#include "ui/gfx/native_widget_types.h" |
#include "ui/native_theme/native_theme_export.h" |
@@ -18,6 +19,15 @@ class Size; |
namespace ui { |
+// Observers which are notified when the native theme changes. |
+class NATIVE_THEME_EXPORT NativeThemeObserver { |
+ public: |
+ virtual ~NativeThemeObserver(); |
+ |
+ // Called whenever the underlying platform's native theme changes. |
+ virtual void OnNativeThemeUpdate() = 0; |
+}; |
+ |
// This class supports drawing UI controls (like buttons, text fields, lists, |
// comboboxes, etc) that look like the native UI controls of the underlying |
// platform, such as Windows or Linux. It also supplies default colors for |
@@ -310,7 +320,14 @@ class NATIVE_THEME_EXPORT NativeTheme { |
// function, returning the port's subclass. |
static NativeTheme* instance(); |
+ // Add or remove observers to be notified when the native theme changes. |
+ void AddObserver(NativeThemeObserver* observer); |
+ void RemoveObserver(NativeThemeObserver* observer); |
+ |
protected: |
+ // Notify observers of native theme state changes. |
+ void NotifyObservers(); |
+ |
NativeTheme(); |
virtual ~NativeTheme(); |
@@ -318,6 +335,10 @@ class NATIVE_THEME_EXPORT NativeTheme { |
unsigned int thumb_active_color_; |
unsigned int track_color_; |
+ private: |
+ // Observers to notify when the theme state changes. |
+ ObserverList<NativeThemeObserver> native_theme_observers_; |
+ |
DISALLOW_COPY_AND_ASSIGN(NativeTheme); |
}; |