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

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

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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 "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 SigninManagerBase;
12 class PrefRegistrySimple; 13 class PrefRegistrySimple;
13 class PrefRegistrySyncable; 14 class PrefRegistrySyncable;
14 class Profile; 15 class Profile;
15 16
16 // Singleton that owns all SigninManagers and associates them with 17 // Singleton that owns all SigninManagers and associates them with
17 // Profiles. Listens for the Profile's destruction notification and cleans up 18 // Profiles. Listens for the Profile's destruction notification and cleans up
18 // the associated SigninManager. 19 // the associated SigninManager.
19 class SigninManagerFactory : public ProfileKeyedServiceFactory { 20 class SigninManagerFactory : public ProfileKeyedServiceFactory {
20 public: 21 public:
21 // Returns the instance of SigninManager associated with this profile 22 // Returns the instance of SigninManager associated with this profile
22 // (creating one if none exists). Returns NULL if this profile cannot have a 23 // (creating one if none exists). Returns NULL if this profile cannot have a
23 // SigninManager (for example, if |profile| is incognito). 24 // SigninManager (for example, if |profile| is incognito).
24 static SigninManager* GetForProfile(Profile* profile); 25 static SigninManagerBase* GetBaseForProfile(Profile* profile);
Roger Tawa OOO till Jul 10th 2013/03/27 17:36:33 Instead of two methods GetBaseForProfile() and Get
tim (not reviewing) 2013/03/29 18:03:16 Right I noticed the vast majority of callsites jus
25 26
26 // Returns the instance of SigninManager associated with this profile. Returns 27 // Returns the instance of SigninManager associated with this profile. Returns
27 // null if no SigninManager instance currently exists (will not create a new 28 // null if no SigninManager instance currently exists (will not create a new
28 // instance). 29 // instance).
30 static SigninManagerBase* GetBaseForProfileIfExists(Profile* profile);
31
32 // On non-ChromeOS platforms, the SigninManager the factory creates will be
33 // an instance of the extended SigninManager class.
34 //
35 // TODO(tim): Make the above statement true in BuildServiceInstanceFor, and
36 // rename these (to e.g GetExtendedForProfile) and ifdef out on chrome os.
Roger Tawa OOO till Jul 10th 2013/03/27 17:36:33 Why change BuildServiceInstanceFor() in a second s
tim (not reviewing) 2013/03/29 18:03:16 I wanted to split it up to avoid a massive CL mixe
37 // Most callers should use SigninManagerBase.
38 static SigninManager* GetForProfile(Profile* profile);
29 static SigninManager* GetForProfileIfExists(Profile* profile); 39 static SigninManager* GetForProfileIfExists(Profile* profile);
30 40
31 // Returns an instance of the SigninManagerFactory singleton. 41 // Returns an instance of the SigninManagerFactory singleton.
32 static SigninManagerFactory* GetInstance(); 42 static SigninManagerFactory* GetInstance();
33 43
34 // Implementation of ProfileKeyedServiceFactory (public so tests can call it). 44 // Implementation of ProfileKeyedServiceFactory (public so tests can call it).
35 virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE; 45 virtual void RegisterUserPrefs(PrefRegistrySyncable* registry) OVERRIDE;
36 46
37 // Registers the browser-global prefs used by SigninManager. 47 // Registers the browser-global prefs used by SigninManager.
38 static void RegisterPrefs(PrefRegistrySimple* registry); 48 static void RegisterPrefs(PrefRegistrySimple* registry);
39 49
40 private: 50 private:
41 friend struct DefaultSingletonTraits<SigninManagerFactory>; 51 friend struct DefaultSingletonTraits<SigninManagerFactory>;
42 52
43 SigninManagerFactory(); 53 SigninManagerFactory();
44 virtual ~SigninManagerFactory(); 54 virtual ~SigninManagerFactory();
45 55
46 // ProfileKeyedServiceFactory: 56 // ProfileKeyedServiceFactory:
47 virtual ProfileKeyedService* BuildServiceInstanceFor( 57 virtual ProfileKeyedService* BuildServiceInstanceFor(
48 Profile* profile) const OVERRIDE; 58 Profile* profile) const OVERRIDE;
49 }; 59 };
50 60
51 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_ 61 #endif // CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698