| 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/native_theme/native_theme_base.h" | 10 #include "ui/native_theme/native_theme_base.h" |
| 11 | 11 |
| 12 namespace libgtkui { | 12 namespace libgtkui { |
| 13 | 13 |
| 14 // A version of NativeTheme that uses GTK3-rendered widgets. | 14 // A version of NativeTheme that uses GTK3-rendered widgets. |
| 15 class NativeThemeGtk3 : public ui::NativeThemeBase { | 15 class NativeThemeGtk3 : public ui::NativeThemeBase { |
| 16 public: | 16 public: |
| 17 static NativeThemeGtk3* instance(); | 17 static NativeThemeGtk3* instance(); |
| 18 | 18 |
| 19 // Called when gtk theme changes. | 19 // Called when gtk theme changes. |
| 20 void ResetColorCache(); | 20 void ResetColorCache(); |
| 21 | 21 |
| 22 // Overridden from ui::NativeThemeBase: | 22 // Overridden from ui::NativeThemeBase: |
| 23 SkColor GetSystemColor(ColorId color_id) const override; | 23 SkColor GetSystemColor(ColorId color_id) const override; |
| 24 void PaintArrowButton(SkCanvas* canvas, | 24 void PaintArrowButton(cc::PaintCanvas* canvas, |
| 25 const gfx::Rect& rect, | 25 const gfx::Rect& rect, |
| 26 Part direction, | 26 Part direction, |
| 27 State state) const override; | 27 State state) const override; |
| 28 void PaintScrollbarTrack(SkCanvas* canvas, | 28 void PaintScrollbarTrack(cc::PaintCanvas* canvas, |
| 29 Part part, | 29 Part part, |
| 30 State state, | 30 State state, |
| 31 const ScrollbarTrackExtraParams& extra_params, | 31 const ScrollbarTrackExtraParams& extra_params, |
| 32 const gfx::Rect& rect) const override; | 32 const gfx::Rect& rect) const override; |
| 33 void PaintScrollbarThumb( | 33 void PaintScrollbarThumb( |
| 34 SkCanvas* canvas, | 34 cc::PaintCanvas* canvas, |
| 35 Part part, | 35 Part part, |
| 36 State state, | 36 State state, |
| 37 const gfx::Rect& rect, | 37 const gfx::Rect& rect, |
| 38 NativeTheme::ScrollbarOverlayColorTheme theme) const override; | 38 NativeTheme::ScrollbarOverlayColorTheme theme) const override; |
| 39 void PaintScrollbarCorner(SkCanvas* canvas, | 39 void PaintScrollbarCorner(cc::PaintCanvas* canvas, |
| 40 State state, | 40 State state, |
| 41 const gfx::Rect& rect) const override; | 41 const gfx::Rect& rect) const override; |
| 42 void PaintMenuPopupBackground( | 42 void PaintMenuPopupBackground( |
| 43 cc::PaintCanvas* canvas, | 43 cc::PaintCanvas* canvas, |
| 44 const gfx::Size& size, | 44 const gfx::Size& size, |
| 45 const MenuBackgroundExtraParams& menu_background) const override; | 45 const MenuBackgroundExtraParams& menu_background) const override; |
| 46 void PaintMenuSeparator( | 46 void PaintMenuSeparator( |
| 47 SkCanvas* canvas, | 47 cc::PaintCanvas* canvas, |
| 48 State state, | 48 State state, |
| 49 const gfx::Rect& rect, | 49 const gfx::Rect& rect, |
| 50 const MenuSeparatorExtraParams& menu_separator) const override; | 50 const MenuSeparatorExtraParams& menu_separator) const override; |
| 51 void PaintMenuItemBackground( | 51 void PaintMenuItemBackground( |
| 52 cc::PaintCanvas* canvas, | 52 cc::PaintCanvas* canvas, |
| 53 State state, | 53 State state, |
| 54 const gfx::Rect& rect, | 54 const gfx::Rect& rect, |
| 55 const MenuItemExtraParams& menu_item) const override; | 55 const MenuItemExtraParams& menu_item) const override; |
| 56 void PaintFrameTopArea( | 56 void PaintFrameTopArea( |
| 57 SkCanvas* canvas, | 57 cc::PaintCanvas* canvas, |
| 58 State state, | 58 State state, |
| 59 const gfx::Rect& rect, | 59 const gfx::Rect& rect, |
| 60 const FrameTopAreaExtraParams& frame_top_area) const override; | 60 const FrameTopAreaExtraParams& frame_top_area) const override; |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 NativeThemeGtk3(); | 63 NativeThemeGtk3(); |
| 64 ~NativeThemeGtk3() override; | 64 ~NativeThemeGtk3() override; |
| 65 | 65 |
| 66 mutable base::Optional<SkColor> color_cache_[kColorId_NumColors]; | 66 mutable base::Optional<SkColor> color_cache_[kColorId_NumColors]; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); | 68 DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk3); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace libgtkui | 71 } // namespace libgtkui |
| 72 | 72 |
| 73 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ | 73 #endif // CHROME_BROWSER_UI_LIBGTKUI_NATIVE_THEME_GTK3_H_ |
| OLD | NEW |