OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_THEME_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
6 #define CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 6 #define CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // COLOR_FRAME* colors. | 49 // COLOR_FRAME* colors. |
50 static const char* kTintButtons; | 50 static const char* kTintButtons; |
51 static const char* kTintFrame; | 51 static const char* kTintFrame; |
52 static const char* kTintFrameInactive; | 52 static const char* kTintFrameInactive; |
53 static const char* kTintFrameIncognito; | 53 static const char* kTintFrameIncognito; |
54 static const char* kTintFrameIncognitoInactive; | 54 static const char* kTintFrameIncognitoInactive; |
55 static const char* kTintBackgroundTab; | 55 static const char* kTintBackgroundTab; |
56 | 56 |
57 // Strings used by themes to identify miscellaneous numerical properties. | 57 // Strings used by themes to identify miscellaneous numerical properties. |
58 static const char* kDisplayPropertyNTPAlignment; | 58 static const char* kDisplayPropertyNTPAlignment; |
| 59 static const char* kDisplayPropertyNTPTiling; |
59 | 60 |
60 // Strings used in alignment properties. | 61 // Strings used in alignment properties. |
61 static const char* kAlignmentTop; | 62 static const char* kAlignmentTop; |
62 static const char* kAlignmentBottom; | 63 static const char* kAlignmentBottom; |
63 static const char* kAlignmentLeft; | 64 static const char* kAlignmentLeft; |
64 static const char* kAlignmentRight; | 65 static const char* kAlignmentRight; |
65 | 66 |
| 67 // Strings used in tiling properties. |
| 68 static const char* kTilingNoRepeat; |
| 69 static const char* kTilingRepeatX; |
| 70 static const char* kTilingRepeatY; |
| 71 static const char* kTilingRepeat; |
| 72 |
66 // Default colors. | 73 // Default colors. |
67 static const SkColor kDefaultColorFrame; | 74 static const SkColor kDefaultColorFrame; |
68 static const SkColor kDefaultColorFrameInactive; | 75 static const SkColor kDefaultColorFrameInactive; |
69 static const SkColor kDefaultColorFrameIncognito; | 76 static const SkColor kDefaultColorFrameIncognito; |
70 static const SkColor kDefaultColorFrameIncognitoInactive; | 77 static const SkColor kDefaultColorFrameIncognitoInactive; |
71 static const SkColor kDefaultColorToolbar; | 78 static const SkColor kDefaultColorToolbar; |
72 static const SkColor kDefaultColorTabText; | 79 static const SkColor kDefaultColorTabText; |
73 static const SkColor kDefaultColorBackgroundTabText; | 80 static const SkColor kDefaultColorBackgroundTabText; |
74 static const SkColor kDefaultColorBookmarkText; | 81 static const SkColor kDefaultColorBookmarkText; |
75 static const SkColor kDefaultColorNTPBackground; | 82 static const SkColor kDefaultColorNTPBackground; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 COLOR_NTP_SECTION_TEXT, | 115 COLOR_NTP_SECTION_TEXT, |
109 COLOR_NTP_SECTION_LINK, | 116 COLOR_NTP_SECTION_LINK, |
110 COLOR_CONTROL_BACKGROUND, | 117 COLOR_CONTROL_BACKGROUND, |
111 COLOR_BUTTON_BACKGROUND, | 118 COLOR_BUTTON_BACKGROUND, |
112 TINT_BUTTONS, | 119 TINT_BUTTONS, |
113 TINT_FRAME, | 120 TINT_FRAME, |
114 TINT_FRAME_INACTIVE, | 121 TINT_FRAME_INACTIVE, |
115 TINT_FRAME_INCOGNITO, | 122 TINT_FRAME_INCOGNITO, |
116 TINT_FRAME_INCOGNITO_INACTIVE, | 123 TINT_FRAME_INCOGNITO_INACTIVE, |
117 TINT_BACKGROUND_TAB, | 124 TINT_BACKGROUND_TAB, |
118 NTP_BACKGROUND_ALIGNMENT | 125 NTP_BACKGROUND_ALIGNMENT, |
| 126 NTP_BACKGROUND_TILING |
119 }; | 127 }; |
120 | 128 |
121 // A bitfield mask for alignments. | 129 // A bitfield mask for alignments. |
122 typedef enum { | 130 typedef enum { |
123 ALIGN_CENTER = 0x0, | 131 ALIGN_CENTER = 0x0, |
124 ALIGN_LEFT = 0x1, | 132 ALIGN_LEFT = 0x1, |
125 ALIGN_TOP = 0x2, | 133 ALIGN_TOP = 0x2, |
126 ALIGN_RIGHT = 0x4, | 134 ALIGN_RIGHT = 0x4, |
127 ALIGN_BOTTOM = 0x8, | 135 ALIGN_BOTTOM = 0x8, |
128 } AlignmentMasks; | 136 } AlignmentMasks; |
129 | 137 |
130 virtual void Init(Profile* profile); | 138 // Background tiling choices. |
| 139 enum { |
| 140 NO_REPEAT = 0, |
| 141 REPEAT_X = 1, |
| 142 REPEAT_Y = 2, |
| 143 REPEAT = 3 |
| 144 } Tiling; |
| 145 |
| 146 void Init(Profile* profile); |
131 | 147 |
132 // ThemeProvider implementation. | 148 // ThemeProvider implementation. |
133 virtual SkBitmap* GetBitmapNamed(int id); | 149 virtual SkBitmap* GetBitmapNamed(int id); |
134 virtual SkColor GetColor(int id); | 150 virtual SkColor GetColor(int id); |
135 virtual bool GetDisplayProperty(int id, int* result); | 151 virtual bool GetDisplayProperty(int id, int* result); |
136 virtual bool ShouldUseNativeFrame(); | 152 virtual bool ShouldUseNativeFrame(); |
137 virtual bool HasCustomImage(int id); | 153 virtual bool HasCustomImage(int id); |
138 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 154 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
139 virtual GdkPixbuf* GetPixbufNamed(int id); | 155 virtual GdkPixbuf* GetPixbufNamed(int id); |
140 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); | 156 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); |
(...skipping 13 matching lines...) Expand all Loading... |
154 virtual void SetNativeTheme() { UseDefaultTheme(); } | 170 virtual void SetNativeTheme() { UseDefaultTheme(); } |
155 | 171 |
156 // Convert a bitfield alignment into a string like "top left". Public so that | 172 // Convert a bitfield alignment into a string like "top left". Public so that |
157 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. | 173 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. |
158 static std::string AlignmentToString(int alignment); | 174 static std::string AlignmentToString(int alignment); |
159 | 175 |
160 // Parse alignments from something like "top left" into a bitfield of | 176 // Parse alignments from something like "top left" into a bitfield of |
161 // AlignmentMasks | 177 // AlignmentMasks |
162 static int StringToAlignment(const std::string &alignment); | 178 static int StringToAlignment(const std::string &alignment); |
163 | 179 |
| 180 // Convert a tiling value into a string like "no-repeat". Public |
| 181 // so that it can be used to generate CSS values. Takes a Tiling. |
| 182 static std::string TilingToString(int tiling); |
| 183 |
| 184 // Parse tiling values from something like "no-repeat" into a Tiling value. |
| 185 static int StringToTiling(const std::string &tiling); |
| 186 |
164 protected: | 187 protected: |
165 // Sets an individual color value. | 188 // Sets an individual color value. |
166 void SetColor(const char* id, const SkColor& color); | 189 void SetColor(const char* id, const SkColor& color); |
167 | 190 |
168 // Sets an individual tint value. | 191 // Sets an individual tint value. |
169 void SetTint(const char* id, const skia::HSL& tint); | 192 void SetTint(const char* id, const skia::HSL& tint); |
170 | 193 |
171 // Generate any frame colors that weren't specified. | 194 // Generate any frame colors that weren't specified. |
172 void GenerateFrameColors(); | 195 void GenerateFrameColors(); |
173 | 196 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 | 301 |
279 ImageMap images_; | 302 ImageMap images_; |
280 ColorMap colors_; | 303 ColorMap colors_; |
281 TintMap tints_; | 304 TintMap tints_; |
282 DisplayPropertyMap display_properties_; | 305 DisplayPropertyMap display_properties_; |
283 | 306 |
284 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 307 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
285 }; | 308 }; |
286 | 309 |
287 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 310 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
OLD | NEW |