| 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_PLUGIN_PREFS_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_PLUGIN_PREFS_FACTORY_H_ |
| 6 #define CHROME_BROWSER_PLUGIN_PREFS_FACTORY_H_ | 6 #define CHROME_BROWSER_PLUGIN_PREFS_FACTORY_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| 11 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" | 11 #include "chrome/browser/profiles/refcounted_profile_keyed_service_factory.h" |
| 12 | 12 |
| 13 class PluginPrefs; | 13 class PluginPrefs; |
| 14 class PrefService; | 14 class PrefService; |
| 15 class Profile; | 15 class Profile; |
| 16 class ProfileKeyedService; | 16 class ProfileKeyedService; |
| 17 | 17 |
| 18 class PluginPrefsFactory : public RefcountedProfileKeyedServiceFactory { | 18 class PluginPrefsFactory : public RefcountedProfileKeyedServiceFactory { |
| 19 public: | 19 public: |
| 20 static scoped_refptr<PluginPrefs> GetPrefsForProfile(Profile* profile); |
| 21 |
| 20 static PluginPrefsFactory* GetInstance(); | 22 static PluginPrefsFactory* GetInstance(); |
| 21 | 23 |
| 22 PluginPrefs* GetPrefsForProfile(Profile* profile); | 24 private: |
| 25 friend class PluginPrefs; |
| 26 friend struct DefaultSingletonTraits<PluginPrefsFactory>; |
| 23 | 27 |
| 24 static ProfileKeyedBase* CreatePrefsForProfile(Profile* profile); | 28 // Helper method for PluginPrefs::GetForTestingProfile. |
| 25 | 29 static scoped_refptr<RefcountedProfileKeyedService> CreateForTestingProfile( |
| 26 private: | 30 Profile* profile); |
| 27 friend struct DefaultSingletonTraits<PluginPrefsFactory>; | |
| 28 | 31 |
| 29 PluginPrefsFactory(); | 32 PluginPrefsFactory(); |
| 30 virtual ~PluginPrefsFactory(); | 33 virtual ~PluginPrefsFactory(); |
| 31 | 34 |
| 32 // RefcountedProfileKeyedServiceFactory methods: | 35 // RefcountedProfileKeyedServiceFactory methods: |
| 33 virtual RefcountedProfileKeyedService* BuildServiceInstanceFor( | 36 virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor( |
| 34 Profile* profile) const OVERRIDE; | 37 Profile* profile) const OVERRIDE; |
| 35 | 38 |
| 36 // ProfileKeyedServiceFactory methods: | 39 // ProfileKeyedServiceFactory methods: |
| 37 virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; | 40 virtual void RegisterUserPrefs(PrefService* prefs) OVERRIDE; |
| 38 virtual bool ServiceRedirectedInIncognito() OVERRIDE; | 41 virtual bool ServiceRedirectedInIncognito() OVERRIDE; |
| 39 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; | 42 virtual bool ServiceIsNULLWhileTesting() OVERRIDE; |
| 40 virtual bool ServiceIsCreatedWithProfile() OVERRIDE; | 43 virtual bool ServiceIsCreatedWithProfile() OVERRIDE; |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 #endif // CHROME_BROWSER_PLUGIN_PREFS_FACTORY_H_ | 46 #endif // CHROME_BROWSER_PLUGIN_PREFS_FACTORY_H_ |
| OLD | NEW |