OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/oauth2_token_service_factory.h" | 5 #include "chrome/browser/signin/oauth2_token_service_factory.h" |
6 | 6 |
7 #include "chrome/browser/profiles/profile_dependency_manager.h" | 7 #include "chrome/browser/profiles/profile_dependency_manager.h" |
8 #include "chrome/browser/signin/oauth2_token_service.h" | 8 #include "chrome/browser/signin/oauth2_token_service.h" |
| 9 #include "chrome/browser/signin/signin_manager_factory.h" |
9 #include "chrome/browser/signin/token_service_factory.h" | 10 #include "chrome/browser/signin/token_service_factory.h" |
10 | 11 |
11 OAuth2TokenServiceFactory::OAuth2TokenServiceFactory() | 12 OAuth2TokenServiceFactory::OAuth2TokenServiceFactory() |
12 : ProfileKeyedServiceFactory("OAuth2TokenService", | 13 : ProfileKeyedServiceFactory("OAuth2TokenService", |
13 ProfileDependencyManager::GetInstance()) { | 14 ProfileDependencyManager::GetInstance()) { |
| 15 DependsOn(SigninManagerFactory::GetInstance()); |
14 DependsOn(TokenServiceFactory::GetInstance()); | 16 DependsOn(TokenServiceFactory::GetInstance()); |
15 } | 17 } |
16 | 18 |
17 OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() { | 19 OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() { |
18 } | 20 } |
19 | 21 |
20 // static | 22 // static |
21 OAuth2TokenService* OAuth2TokenServiceFactory::GetForProfile(Profile* profile) { | 23 OAuth2TokenService* OAuth2TokenServiceFactory::GetForProfile(Profile* profile) { |
22 return static_cast<OAuth2TokenService*>( | 24 return static_cast<OAuth2TokenService*>( |
23 GetInstance()->GetServiceForProfile(profile, true)); | 25 GetInstance()->GetServiceForProfile(profile, true)); |
24 } | 26 } |
25 | 27 |
26 // static | 28 // static |
27 OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() { | 29 OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() { |
28 return Singleton<OAuth2TokenServiceFactory>::get(); | 30 return Singleton<OAuth2TokenServiceFactory>::get(); |
29 } | 31 } |
30 | 32 |
31 ProfileKeyedService* OAuth2TokenServiceFactory::BuildServiceInstanceFor( | 33 ProfileKeyedService* OAuth2TokenServiceFactory::BuildServiceInstanceFor( |
32 Profile* profile) const { | 34 Profile* profile) const { |
33 OAuth2TokenService* service = new OAuth2TokenService(); | 35 OAuth2TokenService* service = new OAuth2TokenService(); |
34 service->Initialize(profile); | 36 service->Initialize(profile); |
35 return service; | 37 return service; |
36 } | 38 } |
OLD | NEW |