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

Unified Diff: ui/native_theme/native_theme.h

Issue 239093007: Update Windows UI on system color changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments. Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
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..8b74f1b24283bd57288453557d69cfde48351ea4 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,18 @@ class Size;
namespace ui {
+class NativeTheme;
+
+// Observers which are notified when the native theme changes.
+class NATIVE_THEME_EXPORT NativeThemeObserver {
sky 2014/04/24 22:52:01 nit: move to own file.
msw 2014/04/25 00:14:51 Done.
+ public:
+ virtual ~NativeThemeObserver();
sky 2014/04/24 22:52:01 make protected (since not owned).
msw 2014/04/25 00:14:51 Done.
+
+ // Called when the native theme changes. The observed theme is passed so that
+ // observers may handle changes to their associated native theme instances.
+ virtual void OnNativeThemeUpdate(ui::NativeTheme* observed_theme) = 0;
sky 2014/04/24 22:52:01 OnNativeThemeUpdated?
msw 2014/04/25 00:14:51 Done.
+};
+
// 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 +323,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 changes.
+ void NotifyObservers();
+
NativeTheme();
virtual ~NativeTheme();
@@ -318,6 +338,10 @@ class NATIVE_THEME_EXPORT NativeTheme {
unsigned int thumb_active_color_;
unsigned int track_color_;
+ private:
+ // Observers to notify when the native theme changes.
+ ObserverList<NativeThemeObserver> native_theme_observers_;
+
DISALLOW_COPY_AND_ASSIGN(NativeTheme);
};

Powered by Google App Engine
This is Rietveld 408576698