| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 static const SkColor kDefaultColorControlBackground; | 89 static const SkColor kDefaultColorControlBackground; |
| 90 static const SkColor kDefaultColorButtonBackground; | 90 static const SkColor kDefaultColorButtonBackground; |
| 91 | 91 |
| 92 static const skia::HSL kDefaultTintButtons; | 92 static const skia::HSL kDefaultTintButtons; |
| 93 static const skia::HSL kDefaultTintFrame; | 93 static const skia::HSL kDefaultTintFrame; |
| 94 static const skia::HSL kDefaultTintFrameInactive; | 94 static const skia::HSL kDefaultTintFrameInactive; |
| 95 static const skia::HSL kDefaultTintFrameIncognito; | 95 static const skia::HSL kDefaultTintFrameIncognito; |
| 96 static const skia::HSL kDefaultTintFrameIncognitoInactive; | 96 static const skia::HSL kDefaultTintFrameIncognitoInactive; |
| 97 static const skia::HSL kDefaultTintBackgroundTab; | 97 static const skia::HSL kDefaultTintBackgroundTab; |
| 98 | 98 |
| 99 static const char* kDefaultThemeID; |
| 100 |
| 99 public: | 101 public: |
| 100 BrowserThemeProvider(); | 102 BrowserThemeProvider(); |
| 101 virtual ~BrowserThemeProvider(); | 103 virtual ~BrowserThemeProvider(); |
| 102 | 104 |
| 103 enum { | 105 enum { |
| 104 COLOR_FRAME, | 106 COLOR_FRAME, |
| 105 COLOR_FRAME_INACTIVE, | 107 COLOR_FRAME_INACTIVE, |
| 106 COLOR_FRAME_INCOGNITO, | 108 COLOR_FRAME_INCOGNITO, |
| 107 COLOR_FRAME_INCOGNITO_INACTIVE, | 109 COLOR_FRAME_INCOGNITO_INACTIVE, |
| 108 COLOR_TOOLBAR, | 110 COLOR_TOOLBAR, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // Set the current theme to the theme defined in |extension|. | 165 // Set the current theme to the theme defined in |extension|. |
| 164 virtual void SetTheme(Extension* extension); | 166 virtual void SetTheme(Extension* extension); |
| 165 | 167 |
| 166 // Reset the theme to default. | 168 // Reset the theme to default. |
| 167 virtual void UseDefaultTheme(); | 169 virtual void UseDefaultTheme(); |
| 168 | 170 |
| 169 // Set the current theme to the native theme. On some platforms, the native | 171 // Set the current theme to the native theme. On some platforms, the native |
| 170 // theme is the default theme. | 172 // theme is the default theme. |
| 171 virtual void SetNativeTheme() { UseDefaultTheme(); } | 173 virtual void SetNativeTheme() { UseDefaultTheme(); } |
| 172 | 174 |
| 175 // Gets the id of the last installed theme. (The theme may have been further |
| 176 // locally customized.) |
| 177 std::string GetThemeID(); |
| 178 |
| 173 // Convert a bitfield alignment into a string like "top left". Public so that | 179 // Convert a bitfield alignment into a string like "top left". Public so that |
| 174 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. | 180 // it can be used to generate CSS values. Takes a bitfield of AlignmentMasks. |
| 175 static std::string AlignmentToString(int alignment); | 181 static std::string AlignmentToString(int alignment); |
| 176 | 182 |
| 177 // Parse alignments from something like "top left" into a bitfield of | 183 // Parse alignments from something like "top left" into a bitfield of |
| 178 // AlignmentMasks | 184 // AlignmentMasks |
| 179 static int StringToAlignment(const std::string &alignment); | 185 static int StringToAlignment(const std::string &alignment); |
| 180 | 186 |
| 181 // Convert a tiling value into a string like "no-repeat". Public | 187 // Convert a tiling value into a string like "no-repeat". Public |
| 182 // so that it can be used to generate CSS values. Takes a Tiling. | 188 // so that it can be used to generate CSS values. Takes a Tiling. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 // Create any images that aren't pregenerated (e.g. background tab images). | 271 // Create any images that aren't pregenerated (e.g. background tab images). |
| 266 SkBitmap* GenerateBitmap(int id); | 272 SkBitmap* GenerateBitmap(int id); |
| 267 | 273 |
| 268 // Save our data - when saving images we need the original dictionary | 274 // Save our data - when saving images we need the original dictionary |
| 269 // from the extension because it contains the text ids that we want to save. | 275 // from the extension because it contains the text ids that we want to save. |
| 270 void SaveImageData(DictionaryValue* images); | 276 void SaveImageData(DictionaryValue* images); |
| 271 void SaveColorData(); | 277 void SaveColorData(); |
| 272 void SaveTintData(); | 278 void SaveTintData(); |
| 273 void SaveDisplayPropertyData(); | 279 void SaveDisplayPropertyData(); |
| 274 | 280 |
| 281 // Save the id of the last theme installed. |
| 282 void SaveThemeID(const std::string& id); |
| 283 |
| 275 SkColor FindColor(const char* id, SkColor default_color); | 284 SkColor FindColor(const char* id, SkColor default_color); |
| 276 | 285 |
| 277 // Frees generated images and clears the image cache. | 286 // Frees generated images and clears the image cache. |
| 278 void ClearCaches(); | 287 void ClearCaches(); |
| 279 | 288 |
| 280 // Clears the platform-specific caches. Do not call directly; it's called | 289 // Clears the platform-specific caches. Do not call directly; it's called |
| 281 // from ClearCaches(). | 290 // from ClearCaches(). |
| 282 void FreePlatformCaches(); | 291 void FreePlatformCaches(); |
| 283 | 292 |
| 284 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 293 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 306 | 315 |
| 307 ImageMap images_; | 316 ImageMap images_; |
| 308 ColorMap colors_; | 317 ColorMap colors_; |
| 309 TintMap tints_; | 318 TintMap tints_; |
| 310 DisplayPropertyMap display_properties_; | 319 DisplayPropertyMap display_properties_; |
| 311 | 320 |
| 312 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 321 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
| 313 }; | 322 }; |
| 314 | 323 |
| 315 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 324 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
| OLD | NEW |