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