| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 static const ui::ThemeProvider& GetThemeProviderForProfile(Profile* profile); | 129 static const ui::ThemeProvider& GetThemeProviderForProfile(Profile* profile); |
| 130 | 130 |
| 131 protected: | 131 protected: |
| 132 // Set a custom default theme instead of the normal default theme. | 132 // Set a custom default theme instead of the normal default theme. |
| 133 virtual void SetCustomDefaultTheme( | 133 virtual void SetCustomDefaultTheme( |
| 134 scoped_refptr<CustomThemeSupplier> theme_supplier); | 134 scoped_refptr<CustomThemeSupplier> theme_supplier); |
| 135 | 135 |
| 136 // Returns true if the ThemeService should use the system theme on startup. | 136 // Returns true if the ThemeService should use the system theme on startup. |
| 137 virtual bool ShouldInitWithSystemTheme() const; | 137 virtual bool ShouldInitWithSystemTheme() const; |
| 138 | 138 |
| 139 // Returns the color to use for |id| and |incognito| if the theme service does |
| 140 // not provide an override. |
| 141 virtual SkColor GetDefaultColor(int id, bool incognito) const; |
| 142 |
| 139 // Get the specified tint - |id| is one of the TINT_* enum values. | 143 // Get the specified tint - |id| is one of the TINT_* enum values. |
| 140 color_utils::HSL GetTint(int id, bool incognito) const; | 144 color_utils::HSL GetTint(int id, bool incognito) const; |
| 141 | 145 |
| 142 // Clears all the override fields and saves the dictionary. | 146 // Clears all the override fields and saves the dictionary. |
| 143 virtual void ClearAllThemeData(); | 147 virtual void ClearAllThemeData(); |
| 144 | 148 |
| 145 // Load theme data from preferences. | 149 // Load theme data from preferences. |
| 146 virtual void LoadThemePrefs(); | 150 virtual void LoadThemePrefs(); |
| 147 | 151 |
| 148 // Let all the browser views know that themes have changed. | 152 // Let all the browser views know that themes have changed. |
| 149 virtual void NotifyThemeChanged(); | 153 virtual void NotifyThemeChanged(); |
| 150 | 154 |
| 151 #if defined(OS_MACOSX) | 155 #if defined(OS_MACOSX) |
| 152 // Let all the browser views know that themes have changed in a platform way. | 156 // Let all the browser views know that themes have changed in a platform way. |
| 153 virtual void NotifyPlatformThemeChanged(); | 157 virtual void NotifyPlatformThemeChanged(); |
| 154 #endif // OS_MACOSX | 158 #endif // OS_MACOSX |
| 155 | 159 |
| 156 // Clears the platform-specific caches. Do not call directly; it's called | 160 // Clears the platform-specific caches. Do not call directly; it's called |
| 157 // from ClearAllThemeData(). | 161 // from ClearAllThemeData(). |
| 158 virtual void FreePlatformCaches(); | 162 virtual void FreePlatformCaches(); |
| 159 | 163 |
| 164 // Implementation for ui::ThemeProvider (see block of functions in private |
| 165 // section). |
| 166 virtual bool ShouldUseNativeFrame() const; |
| 167 bool HasCustomImage(int id) const; |
| 168 |
| 160 Profile* profile() const { return profile_; } | 169 Profile* profile() const { return profile_; } |
| 161 | 170 |
| 162 void set_ready() { ready_ = true; } | 171 void set_ready() { ready_ = true; } |
| 163 | 172 |
| 164 const CustomThemeSupplier* get_theme_supplier() const { | 173 const CustomThemeSupplier* get_theme_supplier() const { |
| 165 return theme_supplier_.get(); | 174 return theme_supplier_.get(); |
| 166 } | 175 } |
| 167 | 176 |
| 168 // True if the theme service is ready to be used. | 177 // True if the theme service is ready to be used. |
| 169 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once | 178 // TODO(pkotwicz): Add DCHECKS to the theme service's getters once |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); | 213 DISALLOW_COPY_AND_ASSIGN(BrowserThemeProvider); |
| 205 }; | 214 }; |
| 206 friend class BrowserThemeProvider; | 215 friend class BrowserThemeProvider; |
| 207 friend class theme_service_internal::ThemeServiceTest; | 216 friend class theme_service_internal::ThemeServiceTest; |
| 208 | 217 |
| 209 // These methods provide the implementation for ui::ThemeProvider (exposed | 218 // These methods provide the implementation for ui::ThemeProvider (exposed |
| 210 // via BrowserThemeProvider). | 219 // via BrowserThemeProvider). |
| 211 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; | 220 gfx::ImageSkia* GetImageSkiaNamed(int id, bool incognito) const; |
| 212 SkColor GetColor(int id, bool incognito) const; | 221 SkColor GetColor(int id, bool incognito) const; |
| 213 int GetDisplayProperty(int id) const; | 222 int GetDisplayProperty(int id) const; |
| 214 bool ShouldUseNativeFrame() const; | |
| 215 bool HasCustomImage(int id) const; | |
| 216 base::RefCountedMemory* GetRawData(int id, | 223 base::RefCountedMemory* GetRawData(int id, |
| 217 ui::ScaleFactor scale_factor) const; | 224 ui::ScaleFactor scale_factor) const; |
| 218 #if defined(OS_MACOSX) | 225 #if defined(OS_MACOSX) |
| 219 NSImage* GetNSImageNamed(int id, bool incognito) const; | 226 NSImage* GetNSImageNamed(int id, bool incognito) const; |
| 220 NSColor* GetNSImageColorNamed(int id, bool incognito) const; | 227 NSColor* GetNSImageColorNamed(int id, bool incognito) const; |
| 221 bool HasCustomColor(int id) const; | 228 bool HasCustomColor(int id) const; |
| 222 NSColor* GetNSColor(int id, bool incognito) const; | 229 NSColor* GetNSColor(int id, bool incognito) const; |
| 223 NSColor* GetNSColorTint(int id) const; | 230 NSColor* GetNSColorTint(int id) const; |
| 224 NSGradient* GetNSGradient(int id) const; | 231 NSGradient* GetNSGradient(int id) const; |
| 225 #endif | 232 #endif |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 306 |
| 300 BrowserThemeProvider original_theme_provider_; | 307 BrowserThemeProvider original_theme_provider_; |
| 301 BrowserThemeProvider incognito_theme_provider_; | 308 BrowserThemeProvider incognito_theme_provider_; |
| 302 | 309 |
| 303 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 310 base::WeakPtrFactory<ThemeService> weak_ptr_factory_; |
| 304 | 311 |
| 305 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 312 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 306 }; | 313 }; |
| 307 | 314 |
| 308 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 315 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |