| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_THEMES_THEME_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 virtual bool HasCustomImage(int id) const OVERRIDE; | 84 virtual bool HasCustomImage(int id) const OVERRIDE; |
| 85 virtual base::RefCountedMemory* GetRawData( | 85 virtual base::RefCountedMemory* GetRawData( |
| 86 int id, | 86 int id, |
| 87 ui::ScaleFactor scale_factor) const OVERRIDE; | 87 ui::ScaleFactor scale_factor) const OVERRIDE; |
| 88 #if defined(OS_MACOSX) | 88 #if defined(OS_MACOSX) |
| 89 virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; | 89 virtual NSImage* GetNSImageNamed(int id) const OVERRIDE; |
| 90 virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; | 90 virtual NSColor* GetNSImageColorNamed(int id) const OVERRIDE; |
| 91 virtual NSColor* GetNSColor(int id) const OVERRIDE; | 91 virtual NSColor* GetNSColor(int id) const OVERRIDE; |
| 92 virtual NSColor* GetNSColorTint(int id) const OVERRIDE; | 92 virtual NSColor* GetNSColorTint(int id) const OVERRIDE; |
| 93 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; | 93 virtual NSGradient* GetNSGradient(int id) const OVERRIDE; |
| 94 #elif defined(OS_POSIX) && !defined(TOOLKIT_VIEWS) && !defined(OS_ANDROID) | |
| 95 // This mismatch between what this class defines and whether or not it | |
| 96 // overrides ui::ThemeProvider is http://crbug.com/105040 . | |
| 97 // GdkPixbufs returned by GetPixbufNamed and GetRTLEnabledPixbufNamed are | |
| 98 // shared instances owned by the theme provider and should not be freed. | |
| 99 virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const OVERRIDE; | |
| 100 #endif | 94 #endif |
| 101 | 95 |
| 102 // Overridden from content::NotificationObserver: | 96 // Overridden from content::NotificationObserver: |
| 103 virtual void Observe(int type, | 97 virtual void Observe(int type, |
| 104 const content::NotificationSource& source, | 98 const content::NotificationSource& source, |
| 105 const content::NotificationDetails& details) OVERRIDE; | 99 const content::NotificationDetails& details) OVERRIDE; |
| 106 | 100 |
| 107 // Set the current theme to the theme defined in |extension|. | 101 // Set the current theme to the theme defined in |extension|. |
| 108 // |extension| must already be added to this profile's | 102 // |extension| must already be added to this profile's |
| 109 // ExtensionService. | 103 // ExtensionService. |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 // Returns true if the profile belongs to a managed user. | 207 // Returns true if the profile belongs to a managed user. |
| 214 bool IsManagedUser() const; | 208 bool IsManagedUser() const; |
| 215 | 209 |
| 216 // Sets the current theme to the managed user theme. Should only be used for | 210 // Sets the current theme to the managed user theme. Should only be used for |
| 217 // managed user profiles. | 211 // managed user profiles. |
| 218 void SetManagedUserTheme(); | 212 void SetManagedUserTheme(); |
| 219 | 213 |
| 220 // Sets the managed user theme if the user has no custom theme yet. | 214 // Sets the managed user theme if the user has no custom theme yet. |
| 221 void OnManagedUserInitialized(); | 215 void OnManagedUserInitialized(); |
| 222 | 216 |
| 223 #if defined(TOOLKIT_GTK) | 217 #if defined(OS_MACOSX) |
| 224 // Loads an image and flips it horizontally if |rtl_enabled| is true. | |
| 225 GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const; | |
| 226 #endif | |
| 227 | |
| 228 #if defined(TOOLKIT_GTK) | |
| 229 typedef std::map<int, GdkPixbuf*> GdkPixbufMap; | |
| 230 mutable GdkPixbufMap gdk_pixbufs_; | |
| 231 #elif defined(OS_MACOSX) | |
| 232 // |nsimage_cache_| retains the images it has cached. | 218 // |nsimage_cache_| retains the images it has cached. |
| 233 typedef std::map<int, NSImage*> NSImageMap; | 219 typedef std::map<int, NSImage*> NSImageMap; |
| 234 mutable NSImageMap nsimage_cache_; | 220 mutable NSImageMap nsimage_cache_; |
| 235 | 221 |
| 236 // |nscolor_cache_| retains the colors it has cached. | 222 // |nscolor_cache_| retains the colors it has cached. |
| 237 typedef std::map<int, NSColor*> NSColorMap; | 223 typedef std::map<int, NSColor*> NSColorMap; |
| 238 mutable NSColorMap nscolor_cache_; | 224 mutable NSColorMap nscolor_cache_; |
| 239 | 225 |
| 240 typedef std::map<int, NSGradient*> NSGradientMap; | 226 typedef std::map<int, NSGradient*> NSGradientMap; |
| 241 mutable NSGradientMap nsgradient_cache_; | 227 mutable NSGradientMap nsgradient_cache_; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 259 content::NotificationRegistrar registrar_; | 245 content::NotificationRegistrar registrar_; |
| 260 | 246 |
| 261 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 247 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
| 262 | 248 |
| 263 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 249 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 264 | 250 |
| 265 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 251 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 266 }; | 252 }; |
| 267 | 253 |
| 268 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 254 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |