1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_NATIVE_THEME_TEST_NATIVE_THEME_H_ 6 #define UI_NATIVE_THEME_TEST_NATIVE_THEME_H_ 7 8 #include "base/macros.h" 9 #include "ui/native_theme/native_theme.h" 10 11 namespace ui { 12 13 class TestNativeTheme : public NativeTheme { 14 public: 15 TestNativeTheme(); 16 ~TestNativeTheme() override; 17 18 // NativeTheme: 19 SkColor GetSystemColor(ColorId color_id, 20 ColorScheme color_scheme) const override; 21 gfx::Size GetPartSize(Part part, 22 State state, 23 const ExtraParams& extra) const override; 24 void Paint(cc::PaintCanvas* canvas, 25 Part part, 26 State state, 27 const gfx::Rect& rect, 28 const ExtraParams& extra, 29 ColorScheme color_scheme) const override; 30 bool SupportsNinePatch(Part part) const override; 31 gfx::Size GetNinePatchCanvasSize(Part part) const override; 32 gfx::Rect GetNinePatchAperture(Part part) const override; 33 bool UsesHighContrastColors() const override; 34 bool ShouldUseDarkColors() const override; 35 PreferredColorScheme GetPreferredColorScheme() const override; 36 ColorScheme GetDefaultSystemColorScheme() const override; 37 SetDarkMode(bool dark_mode)38 void SetDarkMode(bool dark_mode) { dark_mode_ = dark_mode; } SetUsesHighContrastColors(bool high_contrast)39 void SetUsesHighContrastColors(bool high_contrast) { 40 high_contrast_ = high_contrast; 41 } SetIsPlatformHighContrast(bool is_platform_high_contrast)42 void SetIsPlatformHighContrast(bool is_platform_high_contrast) { 43 is_platform_high_contrast_ = is_platform_high_contrast; 44 } 45 void AddColorSchemeNativeThemeObserver(NativeTheme* theme_to_update); 46 47 private: 48 bool dark_mode_ = false; 49 bool high_contrast_ = false; 50 bool is_platform_high_contrast_ = false; 51 52 std::unique_ptr<NativeTheme::ColorSchemeNativeThemeObserver> 53 color_scheme_observer_; 54 55 DISALLOW_COPY_AND_ASSIGN(TestNativeTheme); 56 }; 57 58 } // namespace ui 59 60 #endif // UI_NATIVE_THEME_TEST_NATIVE_THEME_H_ 61