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