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