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