| 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 "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.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_tracker_service_factory.h" | 11 #include "chrome/browser/signin/account_tracker_service_factory.h" |
| 11 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 12 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 12 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" | 13 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h" |
| 13 #include "chrome/browser/signin/local_auth.h" | 14 #include "chrome/browser/signin/local_auth.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 16 #include "components/signin/core/browser/signin_manager.h" | 17 #include "components/signin/core/browser/signin_manager.h" |
| 17 | 18 |
| 18 SigninManagerFactory::SigninManagerFactory() | 19 SigninManagerFactory::SigninManagerFactory() |
| 19 : BrowserContextKeyedServiceFactory( | 20 : BrowserContextKeyedServiceFactory( |
| 20 "SigninManager", | 21 "SigninManager", |
| 21 BrowserContextDependencyManager::GetInstance()) { | 22 BrowserContextDependencyManager::GetInstance()) { |
| 22 DependsOn(ChromeSigninClientFactory::GetInstance()); | 23 DependsOn(ChromeSigninClientFactory::GetInstance()); |
| 23 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); | 24 DependsOn(GaiaCookieManagerServiceFactory::GetInstance()); |
| 24 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 25 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
| 26 DependsOn(AccountFetcherServiceFactory::GetInstance()); |
| 25 DependsOn(AccountTrackerServiceFactory::GetInstance()); | 27 DependsOn(AccountTrackerServiceFactory::GetInstance()); |
| 26 } | 28 } |
| 27 | 29 |
| 28 SigninManagerFactory::~SigninManagerFactory() { | 30 SigninManagerFactory::~SigninManagerFactory() { |
| 29 } | 31 } |
| 30 | 32 |
| 31 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
| 32 // static | 34 // static |
| 33 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists( | 35 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists( |
| 34 Profile* profile) { | 36 Profile* profile) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #if defined(OS_CHROMEOS) | 112 #if defined(OS_CHROMEOS) |
| 111 service = new SigninManagerBase( | 113 service = new SigninManagerBase( |
| 112 client, | 114 client, |
| 113 AccountTrackerServiceFactory::GetForProfile(profile)); | 115 AccountTrackerServiceFactory::GetForProfile(profile)); |
| 114 #else | 116 #else |
| 115 service = new SigninManager( | 117 service = new SigninManager( |
| 116 client, | 118 client, |
| 117 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 119 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 118 AccountTrackerServiceFactory::GetForProfile(profile), | 120 AccountTrackerServiceFactory::GetForProfile(profile), |
| 119 GaiaCookieManagerServiceFactory::GetForProfile(profile)); | 121 GaiaCookieManagerServiceFactory::GetForProfile(profile)); |
| 122 AccountFetcherServiceFactory::GetForProfile(profile); |
| 120 #endif | 123 #endif |
| 121 service->Initialize(g_browser_process->local_state()); | 124 service->Initialize(g_browser_process->local_state()); |
| 122 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service)); | 125 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerCreated(service)); |
| 123 return service; | 126 return service; |
| 124 } | 127 } |
| 125 | 128 |
| 126 void SigninManagerFactory::BrowserContextShutdown( | 129 void SigninManagerFactory::BrowserContextShutdown( |
| 127 content::BrowserContext* context) { | 130 content::BrowserContext* context) { |
| 128 SigninManagerBase* manager = static_cast<SigninManagerBase*>( | 131 SigninManagerBase* manager = static_cast<SigninManagerBase*>( |
| 129 GetServiceForBrowserContext(context, false)); | 132 GetServiceForBrowserContext(context, false)); |
| 130 if (manager) | 133 if (manager) |
| 131 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager)); | 134 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager)); |
| 132 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); | 135 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); |
| 133 } | 136 } |
| OLD | NEW |