| 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_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ |
| 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
| 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" | 9 #include "components/browser_context_keyed_service/browser_context_keyed_service
_factory.h" |
| 10 | 10 |
| 11 class Profile; | 11 class Profile; |
| 12 | 12 |
| 13 namespace user_prefs { | 13 namespace user_prefs { |
| 14 class PrefRegistrySyncable; | 14 class PrefRegistrySyncable; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace policy { | 17 namespace policy { |
| 18 | 18 |
| 19 class UserPolicySigninService; | 19 class UserPolicySigninService; |
| 20 | 20 |
| 21 // Singleton that owns all UserPolicySigninServices and creates/deletes them as | 21 // Singleton that owns all UserPolicySigninServices and creates/deletes them as |
| 22 // new Profiles are created/shutdown. | 22 // new Profiles are created/shutdown. |
| 23 class UserPolicySigninServiceFactory : public ProfileKeyedServiceFactory { | 23 class UserPolicySigninServiceFactory : public BrowserContextKeyedServiceFactory
{ |
| 24 public: | 24 public: |
| 25 // Returns an instance of the UserPolicySigninServiceFactory singleton. | 25 // Returns an instance of the UserPolicySigninServiceFactory singleton. |
| 26 static UserPolicySigninServiceFactory* GetInstance(); | 26 static UserPolicySigninServiceFactory* GetInstance(); |
| 27 | 27 |
| 28 // Returns the instance of UserPolicySigninService for the passed |profile|. | 28 // Returns the instance of UserPolicySigninService for the passed |profile|. |
| 29 // Used primarily for testing. | 29 // Used primarily for testing. |
| 30 static UserPolicySigninService* GetForProfile(Profile* profile); | 30 static UserPolicySigninService* GetForProfile(Profile* profile); |
| 31 | 31 |
| 32 protected: | 32 protected: |
| 33 // ProfileKeyedServiceFactory implementation. | 33 // BrowserContextKeyedServiceFactory implementation. |
| 34 virtual ProfileKeyedService* BuildServiceInstanceFor( | 34 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| 35 content::BrowserContext* profile) const OVERRIDE; | 35 content::BrowserContext* profile) const OVERRIDE; |
| 36 | 36 |
| 37 // Overridden to cause this object to be created when the profile is created. | 37 // Overridden to cause this object to be created when the profile is created. |
| 38 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; | 38 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; |
| 39 | 39 |
| 40 // Register the preferences related to cloud-based user policy. | 40 // Register the preferences related to cloud-based user policy. |
| 41 virtual void RegisterUserPrefs( | 41 virtual void RegisterUserPrefs( |
| 42 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; | 42 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>; | 45 friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>; |
| 46 | 46 |
| 47 UserPolicySigninServiceFactory(); | 47 UserPolicySigninServiceFactory(); |
| 48 virtual ~UserPolicySigninServiceFactory(); | 48 virtual ~UserPolicySigninServiceFactory(); |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceFactory); | 50 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceFactory); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace policy | 53 } // namespace policy |
| 54 | 54 |
| 55 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ | 55 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ |
| OLD | NEW |