Chromium Code Reviews| 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..f5fd796c11285e2d6805d62fe2182cdbf2f06c7f 100644 |
| --- a/ui/native_theme/native_theme.h |
| +++ b/ui/native_theme/native_theme.h |
| @@ -5,8 +5,10 @@ |
| #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/gfx/sys_color_change_listener.h" |
| #include "ui/native_theme/native_theme_export.h" |
| class SkCanvas; |
| @@ -18,6 +20,15 @@ class Size; |
| namespace ui { |
| +// Observers which are notified when the native theme changes. |
| +class NATIVE_THEME_EXPORT NativeThemeObserver { |
|
Evan Stade
2014/04/22 00:32:32
yea, this does conflict with my patch in the sense
msw - DO NOT USE
2014/04/22 01:16:45
I'm not so sure about that naming... Shouldn't obs
Evan Stade
2014/04/22 17:43:44
Now that I see this isn't just replacing the Linux
msw
2014/04/22 19:48:58
I renamed this to OnNativeThemeUpdate, but I'd lik
Evan Stade
2014/04/22 21:09:18
Currently yes, but making this change provides a m
msw
2014/04/23 00:34:04
Agreed, but I don't want to unnecessarily expand t
|
| + public: |
| + virtual ~NativeThemeObserver(); |
| + |
| + // Called whenever the underlying platform's native theme changes. |
| + virtual void OnNativeThemeChange() = 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 |
| @@ -35,7 +46,7 @@ namespace ui { |
| // |
| // NativeTheme also supports getting the default size of a given part with |
| // the GetPartSize() method. |
| -class NATIVE_THEME_EXPORT NativeTheme { |
| +class NATIVE_THEME_EXPORT NativeTheme : public gfx::SysColorChangeListener { |
| public: |
| // The part to be painted / sized. |
| enum Part { |
| @@ -310,14 +321,32 @@ 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); |
| + |
| + // Notify observers of native theme changes. |
| + void OnNativeThemeChange(); |
|
Evan Stade
2014/04/22 17:43:44
I think this should be protected
msw
2014/04/22 19:48:58
I agree, but Gtk2UI::OnStyleSet calls this. Perhap
Evan Stade
2014/04/22 21:09:18
You can expose it on NativeThemeGtk2 but not here.
msw
2014/04/23 00:34:04
Done (added NativeThemeGtk2::NotifyNativeThemeObse
|
| + |
| protected: |
| NativeTheme(); |
| virtual ~NativeTheme(); |
| + // gfx::SysColorChangeListener implementation: |
| + virtual void OnSysColorChange() OVERRIDE; |
| + |
| unsigned int thumb_inactive_color_; |
| unsigned int thumb_active_color_; |
| unsigned int track_color_; |
| + private: |
| + // Observers to notify when the theme state changes. |
| + ObserverList<NativeThemeObserver> native_theme_observers_; |
| + |
| + // The system color change listener. |
| + gfx::ScopedSysColorChangeListener color_change_listener_; |
| + |
| + |
| DISALLOW_COPY_AND_ASSIGN(NativeTheme); |
| }; |