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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // Let all the browser views know that themes have changed. | 235 // Let all the browser views know that themes have changed. |
236 virtual void NotifyThemeChanged(); | 236 virtual void NotifyThemeChanged(); |
237 | 237 |
238 // Loads a bitmap from the theme, which may be tinted or | 238 // Loads a bitmap from the theme, which may be tinted or |
239 // otherwise modified, or an application default. | 239 // otherwise modified, or an application default. |
240 virtual SkBitmap* LoadThemeBitmap(int id); | 240 virtual SkBitmap* LoadThemeBitmap(int id); |
241 | 241 |
242 // Save the modified bitmap at image_cache_[id]. | 242 // Save the modified bitmap at image_cache_[id]. |
243 virtual void SaveThemeBitmap(const std::string resource_name, int id); | 243 virtual void SaveThemeBitmap(const std::string resource_name, int id); |
244 | 244 |
245 // Clears the platform-specific caches. Do not call directly; it's called | |
246 // from ClearCaches(). | |
247 virtual void FreePlatformCaches(); | |
248 | |
249 Profile* profile() { return profile_; } | 245 Profile* profile() { return profile_; } |
250 | 246 |
251 // Subclasses may need us to not use the on-disk image cache. The GTK | 247 // Subclasses may need us to not use the on-disk image cache. The GTK |
252 // interface needs to generate some images itself. | 248 // interface needs to generate some images itself. |
253 void force_process_images() { process_images_ = true; } | 249 void force_process_images() { process_images_ = true; } |
254 | 250 |
255 private: | 251 private: |
256 typedef std::map<const int, std::string> ImageMap; | 252 typedef std::map<const int, std::string> ImageMap; |
257 typedef std::map<const std::string, SkColor> ColorMap; | 253 typedef std::map<const std::string, SkColor> ColorMap; |
258 typedef std::map<const std::string, skia::HSL> TintMap; | 254 typedef std::map<const std::string, skia::HSL> TintMap; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 305 |
310 // Save the paths of data we have written to disk in prefs. | 306 // Save the paths of data we have written to disk in prefs. |
311 void SaveCachedImageData(); | 307 void SaveCachedImageData(); |
312 | 308 |
313 // Save the id of the last theme installed. | 309 // Save the id of the last theme installed. |
314 void SaveThemeID(const std::string& id); | 310 void SaveThemeID(const std::string& id); |
315 | 311 |
316 // Frees generated images and clears the image cache. | 312 // Frees generated images and clears the image cache. |
317 void ClearCaches(); | 313 void ClearCaches(); |
318 | 314 |
| 315 // Clears the platform-specific caches. Do not call directly; it's called |
| 316 // from ClearCaches(). |
| 317 void FreePlatformCaches(); |
| 318 |
319 // Encode image at image_cache_[id] as PNG and write to disk. | 319 // Encode image at image_cache_[id] as PNG and write to disk. |
320 bool WriteImagesToDisk(); | 320 bool WriteImagesToDisk(); |
321 | 321 |
322 // Do we have a custom frame image or custom tints? | 322 // Do we have a custom frame image or custom tints? |
323 bool ShouldTintFrames(); | 323 bool ShouldTintFrames(); |
324 | 324 |
325 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 325 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) |
326 // Loads an image and flips it horizontally if |rtl_enabled| is true. | 326 // Loads an image and flips it horizontally if |rtl_enabled| is true. |
327 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); | 327 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); |
328 #endif | 328 #endif |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // If true, process all images; if false, just load from disk. | 361 // If true, process all images; if false, just load from disk. |
362 bool process_images_; | 362 bool process_images_; |
363 | 363 |
364 // Where we will store our generated images. | 364 // Where we will store our generated images. |
365 FilePath image_dir_; | 365 FilePath image_dir_; |
366 | 366 |
367 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 367 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
368 }; | 368 }; |
369 | 369 |
370 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 370 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
OLD | NEW |