| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 128   virtual std::string GetThemeID() const; | 128   virtual std::string GetThemeID() const; | 
| 129 | 129 | 
| 130   // This class needs to keep track of the number of theme infobars so that we | 130   // This class needs to keep track of the number of theme infobars so that we | 
| 131   // clean up unused themes. | 131   // clean up unused themes. | 
| 132   void OnInfobarDisplayed(); | 132   void OnInfobarDisplayed(); | 
| 133 | 133 | 
| 134   // Decrements the number of theme infobars. If the last infobar has been | 134   // Decrements the number of theme infobars. If the last infobar has been | 
| 135   // destroyed, uninstalls all themes that aren't the currently selected. | 135   // destroyed, uninstalls all themes that aren't the currently selected. | 
| 136   void OnInfobarDestroyed(); | 136   void OnInfobarDestroyed(); | 
| 137 | 137 | 
| 138   // Remove preference values for themes that are no longer in use. | 138   // Uninstall theme extensions which are no longer in use. |ignore_infobars| is | 
| 139   void RemoveUnusedThemes(); | 139   // whether unused themes should be removed despite a theme infobar being | 
|  | 140   // visible. | 
|  | 141   void RemoveUnusedThemes(bool ignore_infobars); | 
| 140 | 142 | 
| 141   // Returns the syncable service for syncing theme. The returned service is | 143   // Returns the syncable service for syncing theme. The returned service is | 
| 142   // owned by |this| object. | 144   // owned by |this| object. | 
| 143   virtual ThemeSyncableService* GetThemeSyncableService() const; | 145   virtual ThemeSyncableService* GetThemeSyncableService() const; | 
| 144 | 146 | 
| 145   // Save the images to be written to disk, mapping file path to id. | 147   // Save the images to be written to disk, mapping file path to id. | 
| 146   typedef std::map<base::FilePath, int> ImagesDiskCache; | 148   typedef std::map<base::FilePath, int> ImagesDiskCache; | 
| 147 | 149 | 
| 148  protected: | 150  protected: | 
| 149   // Set a custom default theme instead of the normal default theme. | 151   // Set a custom default theme instead of the normal default theme. | 
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 183   } | 185   } | 
| 184 | 186 | 
| 185   // True if the theme service is ready to be used. | 187   // True if the theme service is ready to be used. | 
| 186   // TODO(pkotwicz): Add DCHECKS to the theme service's getters once | 188   // TODO(pkotwicz): Add DCHECKS to the theme service's getters once | 
| 187   // ThemeSource no longer uses the ThemeService when it is not ready. | 189   // ThemeSource no longer uses the ThemeService when it is not ready. | 
| 188   bool ready_; | 190   bool ready_; | 
| 189 | 191 | 
| 190  private: | 192  private: | 
| 191   friend class theme_service_internal::ThemeServiceTest; | 193   friend class theme_service_internal::ThemeServiceTest; | 
| 192 | 194 | 
|  | 195   // Called when the extension service is ready. | 
|  | 196   void OnExtensionServiceReady(); | 
|  | 197 | 
|  | 198   // Migrate the theme to the new theme pack schema by recreating the data pack | 
|  | 199   // from the extension. | 
|  | 200   void MigrateTheme(); | 
|  | 201 | 
| 193   // Replaces the current theme supplier with a new one and calls | 202   // Replaces the current theme supplier with a new one and calls | 
| 194   // StopUsingTheme() or StartUsingTheme() as appropriate. | 203   // StopUsingTheme() or StartUsingTheme() as appropriate. | 
| 195   void SwapThemeSupplier(scoped_refptr<CustomThemeSupplier> theme_supplier); | 204   void SwapThemeSupplier(scoped_refptr<CustomThemeSupplier> theme_supplier); | 
| 196 | 205 | 
| 197   // Migrate the theme to the new theme pack schema by recreating the data pack |  | 
| 198   // from the extension. |  | 
| 199   void MigrateTheme(); |  | 
| 200 |  | 
| 201   // Saves the filename of the cached theme pack. | 206   // Saves the filename of the cached theme pack. | 
| 202   void SavePackName(const base::FilePath& pack_path); | 207   void SavePackName(const base::FilePath& pack_path); | 
| 203 | 208 | 
| 204   // Save the id of the last theme installed. | 209   // Save the id of the last theme installed. | 
| 205   void SaveThemeID(const std::string& id); | 210   void SaveThemeID(const std::string& id); | 
| 206 | 211 | 
| 207   // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in | 212   // Implementation of SetTheme() (and the fallback from LoadThemePrefs() in | 
| 208   // case we don't have a theme pack). | 213   // case we don't have a theme pack). | 
| 209   void BuildFromExtension(const extensions::Extension* extension); | 214   void BuildFromExtension(const extensions::Extension* extension); | 
| 210 | 215 | 
| (...skipping 26 matching lines...) Expand all  Loading... | 
| 237 | 242 | 
| 238   typedef std::map<int, NSGradient*> NSGradientMap; | 243   typedef std::map<int, NSGradient*> NSGradientMap; | 
| 239   mutable NSGradientMap nsgradient_cache_; | 244   mutable NSGradientMap nsgradient_cache_; | 
| 240 #endif | 245 #endif | 
| 241 | 246 | 
| 242   ui::ResourceBundle& rb_; | 247   ui::ResourceBundle& rb_; | 
| 243   Profile* profile_; | 248   Profile* profile_; | 
| 244 | 249 | 
| 245   scoped_refptr<CustomThemeSupplier> theme_supplier_; | 250   scoped_refptr<CustomThemeSupplier> theme_supplier_; | 
| 246 | 251 | 
|  | 252   // The id of the theme extension which has just been installed but has not | 
|  | 253   // been loaded yet. The theme extension with |installed_pending_load_id_| may | 
|  | 254   // never be loaded if the install is due to updating a disabled theme. | 
|  | 255   // |pending_install_id_| should be set to |kDefaultThemeID| if there are no | 
|  | 256   // recently installed theme extensions | 
|  | 257   std::string installed_pending_load_id_; | 
|  | 258 | 
| 247   // The number of infobars currently displayed. | 259   // The number of infobars currently displayed. | 
| 248   int number_of_infobars_; | 260   int number_of_infobars_; | 
| 249 | 261 | 
| 250   content::NotificationRegistrar registrar_; | 262   content::NotificationRegistrar registrar_; | 
| 251 | 263 | 
| 252   scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 264   scoped_ptr<ThemeSyncableService> theme_syncable_service_; | 
| 253 | 265 | 
| 254   base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 266   base::WeakPtrFactory<ThemeService> weak_ptr_factory_; | 
| 255 | 267 | 
| 256   DISALLOW_COPY_AND_ASSIGN(ThemeService); | 268   DISALLOW_COPY_AND_ASSIGN(ThemeService); | 
| 257 }; | 269 }; | 
| 258 | 270 | 
| 259 #endif  // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 271 #endif  // CHROME_BROWSER_THEMES_THEME_SERVICE_H_ | 
| OLD | NEW | 
|---|