| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/threading/non_thread_safe.h" | 16 #include "base/threading/non_thread_safe.h" |
| 17 #include "chrome/browser/profiles/profile_keyed_service.h" | 17 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 18 #include "ui/base/theme_provider.h" | 18 #include "ui/base/theme_provider.h" |
| 19 | 19 |
| 20 class BrowserThemePack; | 20 class BrowserThemePack; |
| 21 class ThemeServiceTest; | 21 class ThemeServiceTest; |
| 22 class ThemeSyncableService; | 22 class ThemeSyncableService; |
| 23 class Profile; |
| 24 |
| 25 namespace base { |
| 23 class FilePath; | 26 class FilePath; |
| 24 class Profile; | 27 } |
| 25 | 28 |
| 26 namespace color_utils { | 29 namespace color_utils { |
| 27 struct HSL; | 30 struct HSL; |
| 28 } | 31 } |
| 29 | 32 |
| 30 namespace extensions { | 33 namespace extensions { |
| 31 class Extension; | 34 class Extension; |
| 32 } | 35 } |
| 33 | 36 |
| 34 namespace gfx { | 37 namespace gfx { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 static const std::set<int>& GetTintableToolbarButtons(); | 243 static const std::set<int>& GetTintableToolbarButtons(); |
| 241 | 244 |
| 242 // Remove preference values for themes that are no longer in use. | 245 // Remove preference values for themes that are no longer in use. |
| 243 void RemoveUnusedThemes(); | 246 void RemoveUnusedThemes(); |
| 244 | 247 |
| 245 // Returns the syncable service for syncing theme. The returned service is | 248 // Returns the syncable service for syncing theme. The returned service is |
| 246 // owned by |this| object. | 249 // owned by |this| object. |
| 247 virtual ThemeSyncableService* GetThemeSyncableService() const; | 250 virtual ThemeSyncableService* GetThemeSyncableService() const; |
| 248 | 251 |
| 249 // Save the images to be written to disk, mapping file path to id. | 252 // Save the images to be written to disk, mapping file path to id. |
| 250 typedef std::map<FilePath, int> ImagesDiskCache; | 253 typedef std::map<base::FilePath, int> ImagesDiskCache; |
| 251 | 254 |
| 252 protected: | 255 protected: |
| 253 // Get the specified tint - |id| is one of the TINT_* enum values. | 256 // Get the specified tint - |id| is one of the TINT_* enum values. |
| 254 color_utils::HSL GetTint(int id) const; | 257 color_utils::HSL GetTint(int id) const; |
| 255 | 258 |
| 256 // Clears all the override fields and saves the dictionary. | 259 // Clears all the override fields and saves the dictionary. |
| 257 virtual void ClearAllThemeData(); | 260 virtual void ClearAllThemeData(); |
| 258 | 261 |
| 259 // Load theme data from preferences. | 262 // Load theme data from preferences. |
| 260 virtual void LoadThemePrefs(); | 263 virtual void LoadThemePrefs(); |
| 261 | 264 |
| 262 // Let all the browser views know that themes have changed. | 265 // Let all the browser views know that themes have changed. |
| 263 virtual void NotifyThemeChanged(); | 266 virtual void NotifyThemeChanged(); |
| 264 | 267 |
| 265 #if defined(OS_MACOSX) | 268 #if defined(OS_MACOSX) |
| 266 // Let all the browser views know that themes have changed in a platform way. | 269 // Let all the browser views know that themes have changed in a platform way. |
| 267 virtual void NotifyPlatformThemeChanged(); | 270 virtual void NotifyPlatformThemeChanged(); |
| 268 #endif // OS_MACOSX | 271 #endif // OS_MACOSX |
| 269 | 272 |
| 270 // Clears the platform-specific caches. Do not call directly; it's called | 273 // Clears the platform-specific caches. Do not call directly; it's called |
| 271 // from ClearCaches(). | 274 // from ClearCaches(). |
| 272 virtual void FreePlatformCaches(); | 275 virtual void FreePlatformCaches(); |
| 273 | 276 |
| 274 Profile* profile() { return profile_; } | 277 Profile* profile() { return profile_; } |
| 275 | 278 |
| 276 private: | 279 private: |
| 277 friend class ThemeServiceTest; | 280 friend class ThemeServiceTest; |
| 278 | 281 |
| 279 // Saves the filename of the cached theme pack. | 282 // Saves the filename of the cached theme pack. |
| 280 void SavePackName(const FilePath& pack_path); | 283 void SavePackName(const base::FilePath& pack_path); |
| 281 | 284 |
| 282 // Save the id of the last theme installed. | 285 // Save the id of the last theme installed. |
| 283 void SaveThemeID(const std::string& id); | 286 void SaveThemeID(const std::string& id); |
| 284 | 287 |
| 285 // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in | 288 // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in |
| 286 // case we don't have a theme pack). | 289 // case we don't have a theme pack). |
| 287 void BuildFromExtension(const extensions::Extension* extension); | 290 void BuildFromExtension(const extensions::Extension* extension); |
| 288 | 291 |
| 289 #if defined(TOOLKIT_GTK) | 292 #if defined(TOOLKIT_GTK) |
| 290 // Loads an image and flips it horizontally if |rtl_enabled| is true. | 293 // Loads an image and flips it horizontally if |rtl_enabled| is true. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 313 | 316 |
| 314 // The number of infobars currently displayed. | 317 // The number of infobars currently displayed. |
| 315 int number_of_infobars_; | 318 int number_of_infobars_; |
| 316 | 319 |
| 317 scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 320 scoped_ptr<ThemeSyncableService> theme_syncable_service_; |
| 318 | 321 |
| 319 DISALLOW_COPY_AND_ASSIGN(ThemeService); | 322 DISALLOW_COPY_AND_ASSIGN(ThemeService); |
| 320 }; | 323 }; |
| 321 | 324 |
| 322 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 325 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ |
| OLD | NEW |