OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ | 5 #ifndef UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ |
6 #define UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ | 6 #define UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "ui/native_theme/native_theme_base.h" | 9 #include "ui/native_theme/native_theme_base.h" |
10 #include "ui/native_theme/native_theme_export.h" | 10 #include "ui/native_theme/native_theme_export.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 // Mac implementation of native theme support. | 14 // Mac implementation of native theme support. |
15 class NATIVE_THEME_EXPORT NativeThemeMac : public NativeThemeBase { | 15 class NATIVE_THEME_EXPORT NativeThemeMac : public NativeThemeBase { |
16 public: | 16 public: |
17 static const int kButtonCornerRadius = 3; | 17 static const int kButtonCornerRadius = 3; |
18 | 18 |
19 // Type of gradient to use on a button background. Use HIGHLIGHTED for the | 19 // Type of gradient to use on a button background. Use HIGHLIGHTED for the |
20 // default button of a window and all combobox controls, but only when the | 20 // default button of a window and all combobox controls, but only when the |
21 // window is active. | 21 // window is active. |
22 enum class ButtonBackgroundType { | 22 enum class ButtonBackgroundType { |
23 DISABLED, | 23 DISABLED, |
24 HIGHLIGHTED, | 24 HIGHLIGHTED, |
25 NORMAL, | 25 NORMAL, |
26 PRESSED, | 26 PRESSED, |
27 COUNT | 27 COUNT |
28 }; | 28 }; |
29 | 29 |
30 static NativeThemeMac* instance(); | |
31 | |
32 // Adjusts an SkColor based on the current system control tint. For example, | 30 // Adjusts an SkColor based on the current system control tint. For example, |
33 // if the current tint is "graphite", this function maps the provided value to | 31 // if the current tint is "graphite", this function maps the provided value to |
34 // an appropriate gray. | 32 // an appropriate gray. |
35 static SkColor ApplySystemControlTint(SkColor color); | 33 static SkColor ApplySystemControlTint(SkColor color); |
36 | 34 |
37 // Overridden from NativeTheme: | 35 // Overridden from NativeTheme: |
38 SkColor GetSystemColor(ColorId color_id) const override; | 36 SkColor GetSystemColor(ColorId color_id) const override; |
39 | 37 |
40 // Overridden from NativeThemeBase: | 38 // Overridden from NativeThemeBase: |
41 void PaintMenuPopupBackground( | 39 void PaintMenuPopupBackground( |
(...skipping 19 matching lines...) Expand all Loading... |
61 // style is used for dialog buttons, comboboxes, and tabbed pane tabs. | 59 // style is used for dialog buttons, comboboxes, and tabbed pane tabs. |
62 // Depending on the control part being drawn, the left or the right side can | 60 // Depending on the control part being drawn, the left or the right side can |
63 // be given rounded corners. | 61 // be given rounded corners. |
64 static void PaintStyledGradientButton(SkCanvas* canvas, | 62 static void PaintStyledGradientButton(SkCanvas* canvas, |
65 const gfx::Rect& bounds, | 63 const gfx::Rect& bounds, |
66 ButtonBackgroundType type, | 64 ButtonBackgroundType type, |
67 bool round_left, | 65 bool round_left, |
68 bool round_right, | 66 bool round_right, |
69 bool focus); | 67 bool focus); |
70 | 68 |
| 69 protected: |
| 70 friend class NativeTheme; |
| 71 static NativeThemeMac* instance(); |
| 72 |
71 private: | 73 private: |
72 NativeThemeMac(); | 74 NativeThemeMac(); |
73 ~NativeThemeMac() override; | 75 ~NativeThemeMac() override; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(NativeThemeMac); | 77 DISALLOW_COPY_AND_ASSIGN(NativeThemeMac); |
76 }; | 78 }; |
77 | 79 |
78 } // namespace ui | 80 } // namespace ui |
79 | 81 |
80 #endif // UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ | 82 #endif // UI_NATIVE_THEME_NATIVE_THEME_MAC_H_ |
OLD | NEW |