| 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_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
| 10 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 10 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
| 11 | 11 |
| 12 class Profile; |
| 12 class ThemeService; | 13 class ThemeService; |
| 14 |
| 15 namespace extensions { |
| 13 class Extension; | 16 class Extension; |
| 14 class Profile; | 17 } |
| 15 | 18 |
| 16 // Singleton that owns all ThemeServices and associates them with | 19 // Singleton that owns all ThemeServices and associates them with |
| 17 // Profiles. Listens for the Profile's destruction notification and cleans up | 20 // Profiles. Listens for the Profile's destruction notification and cleans up |
| 18 // the associated ThemeService. | 21 // the associated ThemeService. |
| 19 class ThemeServiceFactory : public ProfileKeyedServiceFactory { | 22 class ThemeServiceFactory : public ProfileKeyedServiceFactory { |
| 20 public: | 23 public: |
| 21 // Returns the ThemeService that provides theming resources for | 24 // Returns the ThemeService that provides theming resources for |
| 22 // |profile|. Note that even if a Profile doesn't have a theme installed, it | 25 // |profile|. Note that even if a Profile doesn't have a theme installed, it |
| 23 // still needs a ThemeService to hand back the default theme images. | 26 // still needs a ThemeService to hand back the default theme images. |
| 24 static ThemeService* GetForProfile(Profile* profile); | 27 static ThemeService* GetForProfile(Profile* profile); |
| 25 | 28 |
| 26 // Returns the Extension that implements the theme associated with | 29 // Returns the Extension that implements the theme associated with |
| 27 // |profile|. Returns NULL if the theme is no longer installed, if there is | 30 // |profile|. Returns NULL if the theme is no longer installed, if there is |
| 28 // no installed theme, or the theme was cleared. | 31 // no installed theme, or the theme was cleared. |
| 29 static const Extension* GetThemeForProfile(Profile* profile); | 32 static const extensions::Extension* GetThemeForProfile(Profile* profile); |
| 30 | 33 |
| 31 static ThemeServiceFactory* GetInstance(); | 34 static ThemeServiceFactory* GetInstance(); |
| 32 | 35 |
| 33 private: | 36 private: |
| 34 friend struct DefaultSingletonTraits<ThemeServiceFactory>; | 37 friend struct DefaultSingletonTraits<ThemeServiceFactory>; |
| 35 | 38 |
| 36 ThemeServiceFactory(); | 39 ThemeServiceFactory(); |
| 37 virtual ~ThemeServiceFactory(); | 40 virtual ~ThemeServiceFactory(); |
| 38 | 41 |
| 39 // ProfileKeyedServiceFactory: | 42 // ProfileKeyedServiceFactory: |
| 40 virtual ProfileKeyedService* BuildServiceInstanceFor( | 43 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 41 Profile* profile) const OVERRIDE; | 44 Profile* profile) const OVERRIDE; |
| 42 virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; | 45 virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; |
| 43 virtual bool ServiceRedirectedInIncognito() OVERRIDE; | 46 virtual bool ServiceRedirectedInIncognito() OVERRIDE; |
| 44 | 47 |
| 45 DISALLOW_COPY_AND_ASSIGN(ThemeServiceFactory); | 48 DISALLOW_COPY_AND_ASSIGN(ThemeServiceFactory); |
| 46 }; | 49 }; |
| 47 | 50 |
| 48 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ | 51 #endif // CHROME_BROWSER_THEMES_THEME_SERVICE_FACTORY_H_ |
| OLD | NEW |