ExtensionSyncService: listen for relevant changes instead of being explicitly called...
[chromium-blink-merge.git] / chrome / browser / chromeos / login / signin / oauth2_login_manager_factory.cc
blob8a534015b5b690dc9891df8feccb7202133ae5af
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/chromeos/login/signin/oauth2_login_manager_factory.h"
7 #include "chrome/browser/chromeos/login/signin/oauth2_login_manager.h"
8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/signin/account_tracker_service_factory.h"
10 #include "chrome/browser/signin/gaia_cookie_manager_service_factory.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
12 #include "chrome/browser/signin/signin_manager_factory.h"
13 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
16 namespace chromeos {
18 OAuth2LoginManagerFactory::OAuth2LoginManagerFactory()
19 : BrowserContextKeyedServiceFactory(
20 "OAuth2LoginManager",
21 BrowserContextDependencyManager::GetInstance()) {
22 DependsOn(AccountTrackerServiceFactory::GetInstance());
23 DependsOn(GlobalErrorServiceFactory::GetInstance());
24 DependsOn(SigninManagerFactory::GetInstance());
25 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
26 DependsOn(GaiaCookieManagerServiceFactory::GetInstance());
29 OAuth2LoginManagerFactory::~OAuth2LoginManagerFactory() {
32 // static
33 OAuth2LoginManager* OAuth2LoginManagerFactory::GetForProfile(
34 Profile* profile) {
35 return static_cast<OAuth2LoginManager*>(
36 GetInstance()->GetServiceForBrowserContext(profile, true));
39 // static
40 OAuth2LoginManagerFactory*
41 OAuth2LoginManagerFactory::GetInstance() {
42 return Singleton<OAuth2LoginManagerFactory>::get();
45 KeyedService* OAuth2LoginManagerFactory::BuildServiceInstanceFor(
46 content::BrowserContext* context) const {
47 Profile* profile = static_cast<Profile*>(context);
48 OAuth2LoginManager* service;
49 service = new OAuth2LoginManager(profile);
50 return service;
53 } // namespace chromeos