| 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 "ui/native_theme/native_theme_base.h" | 10 #include "ui/native_theme/native_theme_base.h" |
| 10 | 11 |
| 11 typedef struct _GtkWidget GtkWidget; | |
| 12 | |
| 13 namespace libgtkui { | 12 namespace libgtkui { |
| 14 | 13 |
| 15 // A version of NativeTheme that uses GTK3-rendered widgets. | 14 // A version of NativeTheme that uses GTK3-rendered widgets. |
| 16 class NativeThemeGtk3 : public ui::NativeThemeBase { | 15 class NativeThemeGtk3 : public ui::NativeThemeBase { |
| 17 public: | 16 public: |
| 18 static NativeThemeGtk3* instance(); | 17 static NativeThemeGtk3* instance(); |
| 19 | 18 |
| 19 // Called when gtk theme changes. |
| 20 void ResetColorCache(); |
| 21 |
| 20 // Overridden from ui::NativeThemeBase: | 22 // Overridden from ui::NativeThemeBase: |
| 21 SkColor GetSystemColor(ColorId color_id) const override; | 23 SkColor GetSystemColor(ColorId color_id) const override; |
| 22 void PaintMenuPopupBackground( | 24 void PaintMenuPopupBackground( |
| 23 SkCanvas* canvas, | 25 SkCanvas* canvas, |
| 24 const gfx::Size& size, | 26 const gfx::Size& size, |
| 25 const MenuBackgroundExtraParams& menu_background) const override; | 27 const MenuBackgroundExtraParams& menu_background) const override; |
| 26 void PaintMenuItemBackground( | 28 void PaintMenuItemBackground( |
| 27 SkCanvas* canvas, | 29 SkCanvas* canvas, |
| 28 State state, | 30 State state, |
| 29 const gfx::Rect& rect, | 31 const gfx::Rect& rect, |
| 30 const MenuItemExtraParams& menu_item) const override; | 32 const MenuItemExtraParams& menu_item) const override; |
| 31 | 33 |
| 32 private: | 34 private: |
| 33 NativeThemeGtk3(); | 35 NativeThemeGtk3(); |
| 34 ~NativeThemeGtk3() override; | 36 ~NativeThemeGtk3() override; |
| 35 | 37 |
| 36 SkColor LookupGtkThemeColor(ColorId color_id) const; | 38 mutable base::Optional<SkColor> color_cache_[kColorId_NumColors]; |
| 37 | |
| 38 // Returns various widgets for theming use. | |
| 39 // TODO(thomasanderson): Remove all of these. | |
| 40 GtkWidget* GetWindow() const; | |
| 41 GtkWidget* GetEntry() const; | |
| 42 GtkWidget* GetLabel() const; | |
| 43 GtkWidget* GetButton() const; | |
| 44 GtkWidget* GetBlueButton() const; | |
| 45 GtkWidget* GetTree() const; | |
| 46 GtkWidget* GetTooltip() const; | |
| 47 GtkWidget* GetMenu() const; | |
| 48 GtkWidget* GetMenuItem() const; | |
| 49 | 39 |
| 50 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); | 40 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); |
| 51 }; | 41 }; |
| 52 | 42 |
| 53 } // namespace libgtkui | 43 } // namespace libgtkui |
| 54 | 44 |
| 55 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ | 45 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ |
| OLD | NEW |