Popular sites on the NTP: re-download popular suggestions once per Chrome run
[chromium-blink-merge.git] / chrome / browser / signin / chrome_signin_client_factory.cc
blobf86834ce918e0af20ccaed0bae746b8a122ad48d
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(
13 "ChromeSigninClient",
14 BrowserContextDependencyManager::GetInstance()) {
15 DependsOn(SigninErrorControllerFactory::GetInstance());
18 ChromeSigninClientFactory::~ChromeSigninClientFactory() {}
20 // static
21 SigninClient* ChromeSigninClientFactory::GetForProfile(Profile* profile) {
22 return static_cast<SigninClient*>(
23 GetInstance()->GetServiceForBrowserContext(profile, true));
26 // static
27 ChromeSigninClientFactory* ChromeSigninClientFactory::GetInstance() {
28 return base::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));
36 return client;