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/profile_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.h" |
8 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 8 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
9 #include "chrome/browser/signin/signin_manager_factory.h" | 9 #include "chrome/browser/signin/signin_manager_factory.h" |
10 #include "chrome/browser/signin/token_service_factory.h" | 10 #include "chrome/browser/signin/token_service_factory.h" |
11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 11 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
12 | 12 |
13 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
14 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" | 14 #include "chrome/browser/signin/android_profile_oauth2_token_service.h" |
15 #endif | 15 #endif |
16 | 16 |
17 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() | 17 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() |
18 : ProfileKeyedServiceFactory("ProfileOAuth2TokenService", | 18 : BrowserContextKeyedServiceFactory( |
19 ProfileDependencyManager::GetInstance()) { | 19 "ProfileOAuth2TokenService", |
| 20 BrowserContextDependencyManager::GetInstance()) { |
20 DependsOn(SigninManagerFactory::GetInstance()); | 21 DependsOn(SigninManagerFactory::GetInstance()); |
21 DependsOn(TokenServiceFactory::GetInstance()); | 22 DependsOn(TokenServiceFactory::GetInstance()); |
22 } | 23 } |
23 | 24 |
24 ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() { | 25 ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() { |
25 } | 26 } |
26 | 27 |
27 // static | 28 // static |
28 ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile( | 29 ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile( |
29 Profile* profile) { | 30 Profile* profile) { |
30 return static_cast<ProfileOAuth2TokenService*>( | 31 return static_cast<ProfileOAuth2TokenService*>( |
31 GetInstance()->GetServiceForProfile(profile, true)); | 32 GetInstance()->GetServiceForBrowserContext(profile, true)); |
32 } | 33 } |
33 | 34 |
34 // static | 35 // static |
35 ProfileOAuth2TokenServiceFactory* | 36 ProfileOAuth2TokenServiceFactory* |
36 ProfileOAuth2TokenServiceFactory::GetInstance() { | 37 ProfileOAuth2TokenServiceFactory::GetInstance() { |
37 return Singleton<ProfileOAuth2TokenServiceFactory>::get(); | 38 return Singleton<ProfileOAuth2TokenServiceFactory>::get(); |
38 } | 39 } |
39 | 40 |
40 ProfileKeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( | 41 BrowserContextKeyedService* |
| 42 ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( |
41 content::BrowserContext* context) const { | 43 content::BrowserContext* context) const { |
42 Profile* profile = static_cast<Profile*>(context); | 44 Profile* profile = static_cast<Profile*>(context); |
43 ProfileOAuth2TokenService* service; | 45 ProfileOAuth2TokenService* service; |
44 #if defined(OS_ANDROID) | 46 #if defined(OS_ANDROID) |
45 service = new AndroidProfileOAuth2TokenService(profile->GetRequestContext()); | 47 service = new AndroidProfileOAuth2TokenService(profile->GetRequestContext()); |
46 #else | 48 #else |
47 service = new ProfileOAuth2TokenService(profile->GetRequestContext()); | 49 service = new ProfileOAuth2TokenService(profile->GetRequestContext()); |
48 #endif | 50 #endif |
49 service->Initialize(profile); | 51 service->Initialize(profile); |
50 return service; | 52 return service; |
51 } | 53 } |
OLD | NEW |