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

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

Issue 1257663002: iOS factories for SigninManager and GaiaCookieManagerService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fakeSigninManager
Patch Set: Fix copyright Created 5 years, 5 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
OLDNEW
(Empty)
1 // Copyright 2015 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 IOS_CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_
6 #define IOS_CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_
7
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "base/observer_list.h"
11 #include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
12
13 template <typename T>
14 struct DefaultSingletonTraits;
15
16 class SigninManagerFactoryObserver;
17 class SigninManager;
18 class PrefRegistrySimple;
19
20 namespace ios {
21
22 class ChromeBrowserState;
23
24 // Singleton that owns all SigninManagers and associates them with browser
25 // states.
26 class SigninManagerFactory : public BrowserStateKeyedServiceFactory {
27 public:
28 static SigninManager* GetForBrowserState(
29 ios::ChromeBrowserState* browser_state);
30 static SigninManager* GetForBrowserStateIfExists(
31 ios::ChromeBrowserState* browser_state);
32
33 // Returns an instance of the SigninManagerFactory singleton.
34 static SigninManagerFactory* GetInstance();
35
36 // Implementation of BrowserStateKeyedServiceFactory (public so tests
37 // can call it).
38 void RegisterBrowserStatePrefs(
39 user_prefs::PrefRegistrySyncable* registry) override;
40
41 // Registers the browser-global prefs used by SigninManager.
42 static void RegisterPrefs(PrefRegistrySimple* registry);
43
44 // Methods to register or remove observers of SigninManager creation/shutdown.
45 void AddObserver(SigninManagerFactoryObserver* observer);
46 void RemoveObserver(SigninManagerFactoryObserver* observer);
47
48 // Notifies observers of |manager|'s creation. Should be called only by test
49 // SigninManager subclasses whose construction does not occur in
50 // |BuildServiceInstanceFor()|.
51 void NotifyObserversOfSigninManagerCreationForTesting(SigninManager* manager);
52
53 private:
54 friend struct DefaultSingletonTraits<SigninManagerFactory>;
55
56 SigninManagerFactory();
57 ~SigninManagerFactory() override;
58
59 // List of observers. Checks that list is empty on destruction.
60 mutable base::ObserverList<SigninManagerFactoryObserver, true> observer_list_;
61
62 // BrowserStateKeyedServiceFactory:
63 scoped_ptr<KeyedService> BuildServiceInstanceFor(
64 web::BrowserState* context) const override;
65 void BrowserStateShutdown(web::BrowserState* context) override;
66 };
67 }
68
69 #endif // IOS_CHROME_BROWSER_SIGNIN_SIGNIN_MANAGER_FACTORY_H_
OLDNEW
« no previous file with comments | « ios/chrome/browser/signin/gaia_cookie_manager_service_factory.cc ('k') | ios/chrome/browser/signin/signin_manager_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698