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_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ |
6 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ | 6 #define CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_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 SigninManager; | 11 class SigninManager; |
| 12 class PrefServiceSimple; |
| 13 class PrefServiceSyncable; |
12 class Profile; | 14 class Profile; |
13 | 15 |
14 // Singleton that owns all SigninManagers and associates them with | 16 // Singleton that owns all SigninManagers and associates them with |
15 // Profiles. Listens for the Profile's destruction notification and cleans up | 17 // Profiles. Listens for the Profile's destruction notification and cleans up |
16 // the associated SigninManager. | 18 // the associated SigninManager. |
17 class SigninManagerFactory : public ProfileKeyedServiceFactory { | 19 class SigninManagerFactory : public ProfileKeyedServiceFactory { |
18 public: | 20 public: |
19 // Returns the instance of SigninManager associated with this profile | 21 // Returns the instance of SigninManager associated with this profile |
20 // (creating one if none exists). Returns NULL if this profile cannot have a | 22 // (creating one if none exists). Returns NULL if this profile cannot have a |
21 // SigninManager (for example, if |profile| is incognito). | 23 // SigninManager (for example, if |profile| is incognito). |
22 static SigninManager* GetForProfile(Profile* profile); | 24 static SigninManager* GetForProfile(Profile* profile); |
23 | 25 |
24 // Returns the instance of SigninManager associated with this profile. Returns | 26 // Returns the instance of SigninManager associated with this profile. Returns |
25 // null if no SigninManager instance currently exists (will not create a new | 27 // null if no SigninManager instance currently exists (will not create a new |
26 // instance). | 28 // instance). |
27 static SigninManager* GetForProfileIfExists(Profile* profile); | 29 static SigninManager* GetForProfileIfExists(Profile* profile); |
28 | 30 |
29 // Returns an instance of the SigninManagerFactory singleton. | 31 // Returns an instance of the SigninManagerFactory singleton. |
30 static SigninManagerFactory* GetInstance(); | 32 static SigninManagerFactory* GetInstance(); |
31 | 33 |
32 // Implementation of ProfileKeyedServiceFactory (public so tests can call it). | 34 // Implementation of ProfileKeyedServiceFactory (public so tests can call it). |
33 virtual void RegisterUserPrefs(PrefService* user_prefs) OVERRIDE; | 35 virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) OVERRIDE; |
34 | 36 |
35 // Registers the browser-global prefs used by SigninManager. | 37 // Registers the browser-global prefs used by SigninManager. |
36 static void RegisterPrefs(PrefService* local_state); | 38 static void RegisterPrefs(PrefServiceSimple* local_state); |
37 | 39 |
38 private: | 40 private: |
39 friend struct DefaultSingletonTraits<SigninManagerFactory>; | 41 friend struct DefaultSingletonTraits<SigninManagerFactory>; |
40 | 42 |
41 SigninManagerFactory(); | 43 SigninManagerFactory(); |
42 virtual ~SigninManagerFactory(); | 44 virtual ~SigninManagerFactory(); |
43 | 45 |
44 // ProfileKeyedServiceFactory: | 46 // ProfileKeyedServiceFactory: |
45 virtual ProfileKeyedService* BuildServiceInstanceFor( | 47 virtual ProfileKeyedService* BuildServiceInstanceFor( |
46 Profile* profile) const OVERRIDE; | 48 Profile* profile) const OVERRIDE; |
47 }; | 49 }; |
48 | 50 |
49 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ | 51 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ |
OLD | NEW |