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 |
| 24 : public BrowserContextKeyedServiceFactory { |
24 public: | 25 public: |
25 // Returns an instance of the UserPolicySigninServiceFactory singleton. | 26 // Returns an instance of the UserPolicySigninServiceFactory singleton. |
26 static UserPolicySigninServiceFactory* GetInstance(); | 27 static UserPolicySigninServiceFactory* GetInstance(); |
27 | 28 |
28 // Returns the instance of UserPolicySigninService for the passed |profile|. | 29 // Returns the instance of UserPolicySigninService for the passed |profile|. |
29 // Used primarily for testing. | 30 // Used primarily for testing. |
30 static UserPolicySigninService* GetForProfile(Profile* profile); | 31 static UserPolicySigninService* GetForProfile(Profile* profile); |
31 | 32 |
32 protected: | 33 protected: |
33 // ProfileKeyedServiceFactory implementation. | 34 // BrowserContextKeyedServiceFactory implementation. |
34 virtual ProfileKeyedService* BuildServiceInstanceFor( | 35 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
35 content::BrowserContext* profile) const OVERRIDE; | 36 content::BrowserContext* profile) const OVERRIDE; |
36 | 37 |
37 // Overridden to cause this object to be created when the profile is created. | 38 // Overridden to cause this object to be created when the profile is created. |
38 virtual bool ServiceIsCreatedWithProfile() const OVERRIDE; | 39 virtual bool ServiceIsCreatedWithBrowserContext() const OVERRIDE; |
39 | 40 |
40 // Register the preferences related to cloud-based user policy. | 41 // Register the preferences related to cloud-based user policy. |
41 virtual void RegisterUserPrefs( | 42 virtual void RegisterUserPrefs( |
42 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; | 43 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; |
43 | 44 |
44 private: | 45 private: |
45 friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>; | 46 friend struct DefaultSingletonTraits<UserPolicySigninServiceFactory>; |
46 | 47 |
47 UserPolicySigninServiceFactory(); | 48 UserPolicySigninServiceFactory(); |
48 virtual ~UserPolicySigninServiceFactory(); | 49 virtual ~UserPolicySigninServiceFactory(); |
49 | 50 |
50 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceFactory); | 51 DISALLOW_COPY_AND_ASSIGN(UserPolicySigninServiceFactory); |
51 }; | 52 }; |
52 | 53 |
53 } // namespace policy | 54 } // namespace policy |
54 | 55 |
55 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ | 56 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_POLICY_SIGNIN_SERVICE_FACTORY_H_ |
OLD | NEW |