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