Chromium Code Reviews| 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 #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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 content::BrowserContext* context) const { | 113 content::BrowserContext* context) const { |
| 109 SigninManagerBase* service = NULL; | 114 SigninManagerBase* service = NULL; |
| 110 Profile* profile = static_cast<Profile*>(context); | 115 Profile* profile = static_cast<Profile*>(context); |
| 111 SigninClient* client = | 116 SigninClient* client = |
| 112 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); | 117 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile); |
| 113 #if defined(OS_CHROMEOS) | 118 #if defined(OS_CHROMEOS) |
| 114 service = new SigninManagerBase( | 119 service = new SigninManagerBase( |
| 115 client, | 120 client, |
| 116 AccountTrackerServiceFactory::GetForProfile(profile)); | 121 AccountTrackerServiceFactory::GetForProfile(profile)); |
| 117 #else | 122 #else |
| 118 service = new SigninManager( | 123 #if !defined(OS_ANDROID) |
| 119 client, | 124 if (ForceSigninManager::IsForceSigninEnabled()) |
| 120 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 125 service = new ForceSigninManager( |
| 121 AccountTrackerServiceFactory::GetForProfile(profile), | 126 profile, client, |
| 122 GaiaCookieManagerServiceFactory::GetForProfile(profile)); | 127 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 128 AccountTrackerServiceFactory::GetForProfile(profile), | |
| 129 GaiaCookieManagerServiceFactory::GetForProfile(profile)); | |
| 130 else | |
| 131 #endif | |
| 132 service = new SigninManager( | |
| 133 client, ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | |
| 134 AccountTrackerServiceFactory::GetForProfile(profile), | |
| 135 GaiaCookieManagerServiceFactory::GetForProfile(profile)); | |
|
Roger Tawa OOO till Jul 10th
2016/10/26 18:25:31
Nit: add { and } around if and else blocks.
| |
| 123 AccountFetcherServiceFactory::GetForProfile(profile); | 136 AccountFetcherServiceFactory::GetForProfile(profile); |
| 124 #endif | 137 #endif |
| 125 service->Initialize(g_browser_process->local_state()); | 138 service->Initialize(g_browser_process->local_state()); |
| 126 for (Observer& observer : observer_list_) | 139 for (Observer& observer : observer_list_) |
| 127 observer.SigninManagerCreated(service); | 140 observer.SigninManagerCreated(service); |
| 128 return service; | 141 return service; |
| 129 } | 142 } |
| 130 | 143 |
| 131 void SigninManagerFactory::BrowserContextShutdown( | 144 void SigninManagerFactory::BrowserContextShutdown( |
| 132 content::BrowserContext* context) { | 145 content::BrowserContext* context) { |
| 133 SigninManagerBase* manager = static_cast<SigninManagerBase*>( | 146 SigninManagerBase* manager = static_cast<SigninManagerBase*>( |
| 134 GetServiceForBrowserContext(context, false)); | 147 GetServiceForBrowserContext(context, false)); |
| 135 if (manager) { | 148 if (manager) { |
| 136 for (Observer& observer : observer_list_) | 149 for (Observer& observer : observer_list_) |
| 137 observer.SigninManagerShutdown(manager); | 150 observer.SigninManagerShutdown(manager); |
| 138 } | 151 } |
| 139 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); | 152 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); |
| 140 } | 153 } |
| OLD | NEW |