OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/login/oauth2_login_manager_factory.h" | 5 #include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h" |
6 | 6 |
7 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" | 7 #include "chrome/browser/chromeos/login/oauth2_login_manager.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
10 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
11 #include "chrome/browser/signin/token_service_factory.h" | 11 #include "chrome/browser/signin/token_service_factory.h" |
12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 OAuth2LoginManagerFactory::OAuth2LoginManagerFactory() | 17 OAuth2LoginManagerFactory::OAuth2LoginManagerFactory() |
18 : BrowserContextKeyedServiceFactory( | 18 : BrowserContextKeyedServiceFactory( |
19 "OAuth2LoginManager", | 19 "OAuth2LoginManager", |
20 BrowserContextDependencyManager::GetInstance()) { | 20 BrowserContextDependencyManager::GetInstance()) { |
21 DependsOn(GlobalErrorServiceFactory::GetInstance()); | 21 DependsOn(GlobalErrorServiceFactory::GetInstance()); |
22 DependsOn(SigninManagerFactory::GetInstance()); | 22 DependsOn(SigninManagerFactory::GetInstance()); |
23 DependsOn(TokenServiceFactory::GetInstance()); | |
24 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); | 23 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance()); |
25 } | 24 } |
26 | 25 |
27 OAuth2LoginManagerFactory::~OAuth2LoginManagerFactory() { | 26 OAuth2LoginManagerFactory::~OAuth2LoginManagerFactory() { |
28 } | 27 } |
29 | 28 |
30 // static | 29 // static |
31 OAuth2LoginManager* OAuth2LoginManagerFactory::GetForProfile( | 30 OAuth2LoginManager* OAuth2LoginManagerFactory::GetForProfile( |
32 Profile* profile) { | 31 Profile* profile) { |
33 return static_cast<OAuth2LoginManager*>( | 32 return static_cast<OAuth2LoginManager*>( |
34 GetInstance()->GetServiceForBrowserContext(profile, true)); | 33 GetInstance()->GetServiceForBrowserContext(profile, true)); |
35 } | 34 } |
36 | 35 |
37 // static | 36 // static |
38 OAuth2LoginManagerFactory* | 37 OAuth2LoginManagerFactory* |
39 OAuth2LoginManagerFactory::GetInstance() { | 38 OAuth2LoginManagerFactory::GetInstance() { |
40 return Singleton<OAuth2LoginManagerFactory>::get(); | 39 return Singleton<OAuth2LoginManagerFactory>::get(); |
41 } | 40 } |
42 | 41 |
43 BrowserContextKeyedService* | 42 BrowserContextKeyedService* |
44 OAuth2LoginManagerFactory::BuildServiceInstanceFor( | 43 OAuth2LoginManagerFactory::BuildServiceInstanceFor( |
45 content::BrowserContext* context) const { | 44 content::BrowserContext* context) const { |
46 Profile* profile = static_cast<Profile*>(context); | 45 Profile* profile = static_cast<Profile*>(context); |
47 OAuth2LoginManager* service; | 46 OAuth2LoginManager* service; |
48 service = new OAuth2LoginManager(profile); | 47 service = new OAuth2LoginManager(profile); |
49 return service; | 48 return service; |
50 } | 49 } |
51 | 50 |
52 } // namespace chromeos | 51 } // namespace chromeos |
OLD | NEW |