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
3 // found in the LICENSE file.
5 #include "chrome/browser/signin/chrome_signin_client_factory.h"
7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/signin/signin_error_controller_factory.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
11 ChromeSigninClientFactory::ChromeSigninClientFactory()
12 : BrowserContextKeyedServiceFactory(
14 BrowserContextDependencyManager::GetInstance()) {
15 DependsOn(SigninErrorControllerFactory::GetInstance());
18 ChromeSigninClientFactory::~ChromeSigninClientFactory() {}
21 SigninClient
* ChromeSigninClientFactory::GetForProfile(Profile
* profile
) {
22 return static_cast<SigninClient
*>(
23 GetInstance()->GetServiceForBrowserContext(profile
, true));
27 ChromeSigninClientFactory
* ChromeSigninClientFactory::GetInstance() {
28 return Singleton
<ChromeSigninClientFactory
>::get();
31 KeyedService
* ChromeSigninClientFactory::BuildServiceInstanceFor(
32 content::BrowserContext
* context
) const {
33 Profile
* profile
= static_cast<Profile
*>(context
);
34 ChromeSigninClient
* client
= new ChromeSigninClient(
35 profile
, SigninErrorControllerFactory::GetForProfile(profile
));