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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 } Tiling; | 154 } Tiling; |
155 | 155 |
156 // ThemeProvider implementation. | 156 // ThemeProvider implementation. |
157 virtual void Init(Profile* profile); | 157 virtual void Init(Profile* profile); |
158 virtual SkBitmap* GetBitmapNamed(int id); | 158 virtual SkBitmap* GetBitmapNamed(int id); |
159 virtual SkColor GetColor(int id); | 159 virtual SkColor GetColor(int id); |
160 virtual bool GetDisplayProperty(int id, int* result); | 160 virtual bool GetDisplayProperty(int id, int* result); |
161 virtual bool ShouldUseNativeFrame(); | 161 virtual bool ShouldUseNativeFrame(); |
162 virtual bool HasCustomImage(int id); | 162 virtual bool HasCustomImage(int id); |
163 virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data); | 163 virtual bool GetRawData(int id, std::vector<unsigned char>* raw_data); |
164 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 164 #if defined(OS_LINUX) |
165 virtual GdkPixbuf* GetPixbufNamed(int id); | 165 virtual GdkPixbuf* GetPixbufNamed(int id); |
166 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); | 166 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id); |
167 #elif defined(OS_MACOSX) | 167 #elif defined(OS_MACOSX) |
168 virtual NSImage* GetNSImageNamed(int id); | 168 virtual NSImage* GetNSImageNamed(int id); |
169 virtual NSColor* GetNSColor(int id); | 169 virtual NSColor* GetNSColor(int id); |
170 virtual NSColor* GetNSColorTint(int id); | 170 virtual NSColor* GetNSColorTint(int id); |
171 #endif | 171 #endif |
172 | 172 |
173 // Set the current theme to the theme defined in |extension|. | 173 // Set the current theme to the theme defined in |extension|. |
174 virtual void SetTheme(Extension* extension); | 174 virtual void SetTheme(Extension* extension); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 314 |
315 // Frees generated images and clears the image cache. | 315 // Frees generated images and clears the image cache. |
316 void ClearCaches(); | 316 void ClearCaches(); |
317 | 317 |
318 // Encode image at image_cache_[id] as PNG and write to disk. | 318 // Encode image at image_cache_[id] as PNG and write to disk. |
319 bool WriteImagesToDisk(); | 319 bool WriteImagesToDisk(); |
320 | 320 |
321 // Do we have a custom frame image or custom tints? | 321 // Do we have a custom frame image or custom tints? |
322 bool ShouldTintFrames(); | 322 bool ShouldTintFrames(); |
323 | 323 |
324 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 324 #if defined(OS_LINUX) |
325 // Loads an image and flips it horizontally if |rtl_enabled| is true. | 325 // Loads an image and flips it horizontally if |rtl_enabled| is true. |
326 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); | 326 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled); |
327 #endif | 327 #endif |
328 | 328 |
329 // Cached images. We cache all retrieved and generated bitmaps and keep | 329 // Cached images. We cache all retrieved and generated bitmaps and keep |
330 // track of the pointers. We own these and will delete them when we're done | 330 // track of the pointers. We own these and will delete them when we're done |
331 // using them. | 331 // using them. |
332 typedef std::map<int, SkBitmap*> ImageCache; | 332 typedef std::map<int, SkBitmap*> ImageCache; |
333 ImageCache image_cache_; | 333 ImageCache image_cache_; |
334 #if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) | 334 #if defined(OS_LINUX) |
335 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; | 335 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; |
336 GdkPixbufMap gdk_pixbufs_; | 336 GdkPixbufMap gdk_pixbufs_; |
337 #elif defined(OS_MACOSX) | 337 #elif defined(OS_MACOSX) |
338 typedef std::map<int, NSImage*> NSImageMap; | 338 typedef std::map<int, NSImage*> NSImageMap; |
339 NSImageMap nsimage_cache_; | 339 NSImageMap nsimage_cache_; |
340 typedef std::map<int, NSColor*> NSColorMap; | 340 typedef std::map<int, NSColor*> NSColorMap; |
341 NSColorMap nscolor_cache_; | 341 NSColorMap nscolor_cache_; |
342 #endif | 342 #endif |
343 | 343 |
344 // Save the images to be written to disk, mapping file path to id. | 344 // Save the images to be written to disk, mapping file path to id. |
(...skipping 15 matching lines...) Expand all Loading... |
360 // If true, process all images; if false, just load from disk. | 360 // If true, process all images; if false, just load from disk. |
361 bool process_images_; | 361 bool process_images_; |
362 | 362 |
363 // Where we will store our generated images. | 363 // Where we will store our generated images. |
364 FilePath image_dir_; | 364 FilePath image_dir_; |
365 | 365 |
366 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 366 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
367 }; | 367 }; |
368 | 368 |
369 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ | 369 #endif // CHROME_BROWSER_BROWSER_THEME_PROVIDER_H_ |
OLD | NEW |