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

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

Issue 2442843002: Override SigninManager::SignOut if force-signin is enabled. (Closed)
Patch Set: fixup Created 4 years, 2 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
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 #include "chrome/browser/signin/signin_manager_factory.h" 5 #include "chrome/browser/signin/signin_manager_factory.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/account_fetcher_service_factory.h" 10 #include "chrome/browser/signin/account_fetcher_service_factory.h"
11 #include "chrome/browser/signin/account_tracker_service_factory.h" 11 #include "chrome/browser/signin/account_tracker_service_factory.h"
12 #include "chrome/browser/signin/chrome_signin_client_factory.h" 12 #include "chrome/browser/signin/chrome_signin_client_factory.h"
13 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" 13 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
14 #include "chrome/browser/signin/local_auth.h" 14 #include "chrome/browser/signin/local_auth.h"
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
16 #include "components/keyed_service/content/browser_context_dependency_manager.h" 16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
17 #include "components/prefs/pref_registry_simple.h" 17 #include "components/prefs/pref_registry_simple.h"
18
19 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
20 #include "chrome/browser/signin/force_signin_manager.h"
21 #else
18 #include "components/signin/core/browser/signin_manager.h" 22 #include "components/signin/core/browser/signin_manager.h"
23 #endif
19 24
20 SigninManagerFactory::SigninManagerFactory() 25 SigninManagerFactory::SigninManagerFactory()
21 : BrowserContextKeyedServiceFactory( 26 : BrowserContextKeyedServiceFactory(
22 "SigninManager", 27 "SigninManager",
23 BrowserContextDependencyManager::GetInstance()) { 28 BrowserContextDependencyManager::GetInstance()) {
24 DependsOn(ChromeSigninClientFactory::GetInstance()); 29 DependsOn(ChromeSigninClientFactory::GetInstance());
25 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); 30 DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
26 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); 31 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
27 DependsOn(AccountTrackerServiceFactory::GetInstance()); 32 DependsOn(AccountTrackerServiceFactory::GetInstance());
28 } 33 }
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 content::BrowserContext* context) const { 112 content::BrowserContext* context) const {
108 SigninManagerBase* service = NULL; 113 SigninManagerBase* service = NULL;
109 Profile* profile = static_cast<Profile*>(context); 114 Profile* profile = static_cast<Profile*>(context);
110 SigninClient* client = 115 SigninClient* client =
111 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); 116 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile);
112 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
113 service = new SigninManagerBase( 118 service = new SigninManagerBase(
114 client, 119 client,
115 AccountTrackerServiceFactory::GetForProfile(profile)); 120 AccountTrackerServiceFactory::GetForProfile(profile));
116 #else 121 #else
117 service = new SigninManager( 122 #if !defined(OS_ANDROID)
118 client, 123 if (ForceSigninManager::IsForceSigninEnabled())
119 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 124 service = new ForceSigninManager(
120 AccountTrackerServiceFactory::GetForProfile(profile), 125 profile, client,
121 GaiaCookieManagerServiceFactory::GetForProfile(profile)); 126 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
127 AccountTrackerServiceFactory::GetForProfile(profile),
128 GaiaCookieManagerServiceFactory::GetForProfile(profile));
129 else
130 #endif
131 service = new SigninManager(
132 client, ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
133 AccountTrackerServiceFactory::GetForProfile(profile),
134 GaiaCookieManagerServiceFactory::GetForProfile(profile));
122 AccountFetcherServiceFactory::GetForProfile(profile); 135 AccountFetcherServiceFactory::GetForProfile(profile);
123 #endif 136 #endif
124 service->Initialize(g_browser_process->local_state()); 137 service->Initialize(g_browser_process->local_state());
125 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service)); 138 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service));
126 return service; 139 return service;
127 } 140 }
128 141
129 void SigninManagerFactory::BrowserContextShutdown( 142 void SigninManagerFactory::BrowserContextShutdown(
130 content::BrowserContext* context) { 143 content::BrowserContext* context) {
131 SigninManagerBase* manager = static_cast<SigninManagerBase*>( 144 SigninManagerBase* manager = static_cast<SigninManagerBase*>(
132 GetServiceForBrowserContext(context, false)); 145 GetServiceForBrowserContext(context, false));
133 if (manager) 146 if (manager)
134 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager)); 147 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager));
135 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); 148 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context);
136 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698