| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ | 5 #ifndef CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ |
| 6 #define CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ | 6 #define CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "ui/base/glib/glib_signal.h" |
| 11 #include "ui/base/glib/scoped_gobject.h" |
| 10 #include "ui/native_theme/native_theme_base.h" | 12 #include "ui/native_theme/native_theme_base.h" |
| 11 | 13 |
| 14 typedef struct _GtkCssProvider GtkCssProvider; |
| 15 typedef struct _GtkParamSpec GtkParamSpec; |
| 16 typedef struct _GtkSettings GtkSettings; |
| 17 |
| 12 namespace libgtkui { | 18 namespace libgtkui { |
| 13 | 19 |
| 20 using ScopedCssProvider = ScopedGObject<GtkCssProvider>; |
| 21 |
| 14 // A version of NativeTheme that uses GTK3-rendered widgets. | 22 // A version of NativeTheme that uses GTK3-rendered widgets. |
| 15 class NativeThemeGtk3 : public ui::NativeThemeBase { | 23 class NativeThemeGtk3 : public ui::NativeThemeBase { |
| 16 public: | 24 public: |
| 17 static NativeThemeGtk3* instance(); | 25 static NativeThemeGtk3* instance(); |
| 18 | 26 |
| 19 // Called when gtk theme changes. | |
| 20 void ResetColorCache(); | |
| 21 | |
| 22 // Overridden from ui::NativeThemeBase: | 27 // Overridden from ui::NativeThemeBase: |
| 23 SkColor GetSystemColor(ColorId color_id) const override; | 28 SkColor GetSystemColor(ColorId color_id) const override; |
| 24 void PaintArrowButton(cc::PaintCanvas* canvas, | 29 void PaintArrowButton(cc::PaintCanvas* canvas, |
| 25 const gfx::Rect& rect, | 30 const gfx::Rect& rect, |
| 26 Part direction, | 31 Part direction, |
| 27 State state) const override; | 32 State state) const override; |
| 28 void PaintScrollbarTrack(cc::PaintCanvas* canvas, | 33 void PaintScrollbarTrack(cc::PaintCanvas* canvas, |
| 29 Part part, | 34 Part part, |
| 30 State state, | 35 State state, |
| 31 const ScrollbarTrackExtraParams& extra_params, | 36 const ScrollbarTrackExtraParams& extra_params, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 56 void PaintFrameTopArea( | 61 void PaintFrameTopArea( |
| 57 cc::PaintCanvas* canvas, | 62 cc::PaintCanvas* canvas, |
| 58 State state, | 63 State state, |
| 59 const gfx::Rect& rect, | 64 const gfx::Rect& rect, |
| 60 const FrameTopAreaExtraParams& frame_top_area) const override; | 65 const FrameTopAreaExtraParams& frame_top_area) const override; |
| 61 | 66 |
| 62 private: | 67 private: |
| 63 NativeThemeGtk3(); | 68 NativeThemeGtk3(); |
| 64 ~NativeThemeGtk3() override; | 69 ~NativeThemeGtk3() override; |
| 65 | 70 |
| 71 void SetThemeCssOverride(ScopedCssProvider provider); |
| 72 |
| 73 CHROMEG_CALLBACK_1(NativeThemeGtk3, |
| 74 void, |
| 75 OnThemeChanged, |
| 76 GtkSettings*, |
| 77 GtkParamSpec*); |
| 78 |
| 66 mutable base::Optional<SkColor> color_cache_[kColorId_NumColors]; | 79 mutable base::Optional<SkColor> color_cache_[kColorId_NumColors]; |
| 67 | 80 |
| 81 ScopedCssProvider theme_css_override_; |
| 82 |
| 68 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); | 83 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); |
| 69 }; | 84 }; |
| 70 | 85 |
| 71 } // namespace libgtkui | 86 } // namespace libgtkui |
| 72 | 87 |
| 73 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ | 88 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ |
| OLD | NEW |