| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_signin_client_factory.h" | 5 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/signin/signin_error_controller_factory.h" | 8 #include "chrome/browser/signin/signin_error_controller_factory.h" |
| 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 9 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 10 | 10 |
| 11 ChromeSigninClientFactory::ChromeSigninClientFactory() | 11 ChromeSigninClientFactory::ChromeSigninClientFactory() |
| 12 : BrowserContextKeyedServiceFactory( | 12 : BrowserContextKeyedServiceFactory( |
| 13 "ChromeSigninClient", | 13 "ChromeSigninClient", |
| 14 BrowserContextDependencyManager::GetInstance()) { | 14 BrowserContextDependencyManager::GetInstance()) { |
| 15 DependsOn(SigninErrorControllerFactory::GetInstance()); | 15 DependsOn(SigninErrorControllerFactory::GetInstance()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 ChromeSigninClientFactory::~ChromeSigninClientFactory() {} | 18 ChromeSigninClientFactory::~ChromeSigninClientFactory() {} |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 SigninClient* ChromeSigninClientFactory::GetForProfile(Profile* profile) { | 21 SigninClient* ChromeSigninClientFactory::GetForProfile(Profile* profile) { |
| 22 return static_cast<SigninClient*>( | 22 return static_cast<SigninClient*>( |
| 23 GetInstance()->GetServiceForBrowserContext(profile, true)); | 23 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 // static | 26 // static |
| 27 ChromeSigninClientFactory* ChromeSigninClientFactory::GetInstance() { | 27 ChromeSigninClientFactory* ChromeSigninClientFactory::GetInstance() { |
| 28 return Singleton<ChromeSigninClientFactory>::get(); | 28 return base::Singleton<ChromeSigninClientFactory>::get(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 KeyedService* ChromeSigninClientFactory::BuildServiceInstanceFor( | 31 KeyedService* ChromeSigninClientFactory::BuildServiceInstanceFor( |
| 32 content::BrowserContext* context) const { | 32 content::BrowserContext* context) const { |
| 33 Profile* profile = static_cast<Profile*>(context); | 33 Profile* profile = static_cast<Profile*>(context); |
| 34 ChromeSigninClient* client = new ChromeSigninClient( | 34 ChromeSigninClient* client = new ChromeSigninClient( |
| 35 profile, SigninErrorControllerFactory::GetForProfile(profile)); | 35 profile, SigninErrorControllerFactory::GetForProfile(profile)); |
| 36 return client; | 36 return client; |
| 37 } | 37 } |
| OLD | NEW |