Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: chrome/browser/signin/signin_manager_factory.h

Issue 44083005: policy: Remove UserCloudPolicyManagerFactory's dependency on Profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "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 SigninManager; 11 class SigninManager;
12 class SigninManagerBase; 12 class SigninManagerBase;
13 class PrefRegistrySimple; 13 class PrefRegistrySimple;
14 class Profile; 14 class Profile;
15 15
16 // Singleton that owns all SigninManagers and associates them with 16 // Singleton that owns all SigninManagers and associates them with
17 // Profiles. Listens for the Profile's destruction notification and cleans up 17 // Profiles. Listens for the Profile's destruction notification and cleans up
18 // the associated SigninManager. 18 // the associated SigninManager.
19 class SigninManagerFactory : public BrowserContextKeyedServiceFactory { 19 class SigninManagerFactory : public BrowserContextKeyedServiceFactory {
20 public: 20 public:
21 21
22 #if defined(OS_CHROMEOS) 22 #if defined(OS_CHROMEOS)
23 // Returns the instance of SigninManager associated with this profile 23 // Returns the instance of SigninManager associated with this profile
24 // (creating one if none exists). Returns NULL if this profile cannot have a 24 // (creating one if none exists). Returns NULL if this profile cannot have a
25 // SigninManager (for example, if |profile| is incognito). 25 // SigninManager (for example, if |profile| is incognito).
26 static SigninManagerBase* GetForProfile(Profile* profile); 26 static SigninManagerBase* GetForProfile(Profile* profile);
27 27
28 // Returns the instance of SigninManager associated with this profile. Returns 28 // Returns the instance of SigninManager associated with this browser context.
29 // null if no SigninManager instance currently exists (will not create a new 29 // Returns null if no SigninManager instance currently exists (will not create
30 // instance). 30 // a new instance).
31 static SigninManagerBase* GetForProfileIfExists(Profile* profile); 31 static SigninManagerBase* GetForBrowserContextIfExists(
32 content::BrowserContext* context);
32 #else 33 #else
33 // On non-ChromeOS platforms, the SigninManager the factory creates will be 34 // On non-ChromeOS platforms, the SigninManager the factory creates will be
34 // an instance of the extended SigninManager class. 35 // an instance of the extended SigninManager class.
35 static SigninManager* GetForProfile(Profile* profile); 36 static SigninManager* GetForProfile(Profile* profile);
36 static SigninManager* GetForProfileIfExists(Profile* profile); 37 static SigninManager* GetForBrowserContextIfExists(
38 content::BrowserContext* context);
37 #endif 39 #endif
38 40
39 // Returns an instance of the SigninManagerFactory singleton. 41 // Returns an instance of the SigninManagerFactory singleton.
40 static SigninManagerFactory* GetInstance(); 42 static SigninManagerFactory* GetInstance();
41 43
42 // Implementation of BrowserContextKeyedServiceFactory (public so tests 44 // Implementation of BrowserContextKeyedServiceFactory (public so tests
43 // can call it). 45 // can call it).
44 virtual void RegisterProfilePrefs( 46 virtual void RegisterProfilePrefs(
45 user_prefs::PrefRegistrySyncable* registry) OVERRIDE; 47 user_prefs::PrefRegistrySyncable* registry) OVERRIDE;
46 48
47 // Registers the browser-global prefs used by SigninManager. 49 // Registers the browser-global prefs used by SigninManager.
48 static void RegisterPrefs(PrefRegistrySimple* registry); 50 static void RegisterPrefs(PrefRegistrySimple* registry);
49 51
50 private: 52 private:
51 friend struct DefaultSingletonTraits<SigninManagerFactory>; 53 friend struct DefaultSingletonTraits<SigninManagerFactory>;
52 54
53 SigninManagerFactory(); 55 SigninManagerFactory();
54 virtual ~SigninManagerFactory(); 56 virtual ~SigninManagerFactory();
55 57
56 // BrowserContextKeyedServiceFactory: 58 // BrowserContextKeyedServiceFactory:
57 virtual BrowserContextKeyedService* BuildServiceInstanceFor( 59 virtual BrowserContextKeyedService* BuildServiceInstanceFor(
58 content::BrowserContext* profile) const OVERRIDE; 60 content::BrowserContext* profile) const OVERRIDE;
59 }; 61 };
60 62
61 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ 63 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698