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_THEME_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
6 #define CHROME_BROWSER_THEME_PROVIDER_H_ | 6 #define CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
| 7 |
| 8 #include <map> |
| 9 #include <string> |
| 10 #include <vector> |
7 | 11 |
8 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
9 #include "app/theme_provider.h" | 13 #include "app/theme_provider.h" |
10 #include "base/non_thread_safe.h" | 14 #include "base/non_thread_safe.h" |
11 #include "base/ref_counted.h" | 15 #include "base/ref_counted.h" |
12 #include "skia/ext/skia_utils.h" | 16 #include "skia/ext/skia_utils.h" |
13 | 17 |
14 class Extension; | 18 class Extension; |
15 class Profile; | 19 class Profile; |
16 class DictionaryValue; | 20 class DictionaryValue; |
17 | 21 |
18 class BrowserThemeProvider : | 22 class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, |
19 public base::RefCounted<BrowserThemeProvider>, | 23 public NonThreadSafe, |
20 public NonThreadSafe, | 24 public ThemeProvider { |
21 public ThemeProvider { | |
22 public: | 25 public: |
23 BrowserThemeProvider(); | 26 BrowserThemeProvider(); |
24 virtual ~BrowserThemeProvider(); | 27 virtual ~BrowserThemeProvider(); |
25 | 28 |
26 enum { | 29 enum { |
27 COLOR_FRAME, | 30 COLOR_FRAME, |
28 COLOR_FRAME_INACTIVE, | 31 COLOR_FRAME_INACTIVE, |
29 COLOR_FRAME_INCOGNITO, | 32 COLOR_FRAME_INCOGNITO, |
30 COLOR_FRAME_INCOGNITO_INACTIVE, | 33 COLOR_FRAME_INCOGNITO_INACTIVE, |
31 COLOR_TOOLBAR, | 34 COLOR_TOOLBAR, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 void SaveImageData(DictionaryValue* images); | 105 void SaveImageData(DictionaryValue* images); |
103 void SaveColorData(); | 106 void SaveColorData(); |
104 void SaveTintData(); | 107 void SaveTintData(); |
105 | 108 |
106 // Let all the browser views know that themes have changed. | 109 // Let all the browser views know that themes have changed. |
107 void NotifyThemeChanged(); | 110 void NotifyThemeChanged(); |
108 | 111 |
109 // Load theme data from preferences. | 112 // Load theme data from preferences. |
110 void LoadThemePrefs(); | 113 void LoadThemePrefs(); |
111 | 114 |
| 115 // Frees generated images and clears the image cache. |
| 116 void FreeImages(); |
| 117 |
112 // Cached images. We cache all retrieved and generated bitmaps and keep | 118 // Cached images. We cache all retrieved and generated bitmaps and keep |
113 // track of the pointers. | 119 // track of the pointers. |
114 typedef std::map<int, SkBitmap*> ImageCache; | 120 typedef std::map<int, SkBitmap*> ImageCache; |
115 ImageCache image_cache_; | 121 ImageCache image_cache_; |
116 | 122 |
| 123 // List of generate images that aren't stored in ResourceBundles image cache |
| 124 // and need to be freed. |
| 125 std::vector<SkBitmap*> generated_images_; |
| 126 |
117 ResourceBundle& rb_; | 127 ResourceBundle& rb_; |
118 Profile* profile_; | 128 Profile* profile_; |
119 | 129 |
120 ImageMap images_; | 130 ImageMap images_; |
121 ColorMap colors_; | 131 ColorMap colors_; |
122 TintMap tints_; | 132 TintMap tints_; |
123 | 133 |
124 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 134 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
125 }; | 135 }; |
126 | 136 |
127 #endif // CHROME_BROWSER_THEME_PROVIDER_H_ | 137 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
OLD | NEW |