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