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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/signin/account_tracker_service_factory.h" | 9 #include "chrome/browser/signin/account_tracker_service_factory.h" |
10 #include "chrome/browser/signin/chrome_signin_client_factory.h" | 10 #include "chrome/browser/signin/chrome_signin_client_factory.h" |
11 #include "chrome/browser/signin/signin_error_controller_factory.h" | 11 #include "chrome/browser/signin/signin_error_controller_factory.h" |
12 #include "chrome/browser/web_data_service_factory.h" | 12 #include "chrome/browser/web_data_service_factory.h" |
13 #include "chrome/common/features.h" | 13 #include "chrome/common/features.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/signin/core/browser/profile_oauth2_token_service.h" | 15 #include "components/signin/core/browser/profile_oauth2_token_service.h" |
16 | 16 |
17 #if BUILDFLAG(ANDROID_JAVA_UI) | 17 #if defined(OS_ANDROID) |
18 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" | 18 #include "chrome/browser/signin/oauth2_token_service_delegate_android.h" |
19 #else | 19 #else |
20 #include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h" | 20 #include "chrome/browser/signin/mutable_profile_oauth2_token_service_delegate.h" |
21 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 21 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
22 #endif | 22 #endif |
23 | 23 |
24 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() | 24 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() |
25 : BrowserContextKeyedServiceFactory( | 25 : BrowserContextKeyedServiceFactory( |
26 "ProfileOAuth2TokenService", | 26 "ProfileOAuth2TokenService", |
27 BrowserContextDependencyManager::GetInstance()) { | 27 BrowserContextDependencyManager::GetInstance()) { |
(...skipping 17 matching lines...) Expand all Loading... |
45 | 45 |
46 // static | 46 // static |
47 ProfileOAuth2TokenServiceFactory* | 47 ProfileOAuth2TokenServiceFactory* |
48 ProfileOAuth2TokenServiceFactory::GetInstance() { | 48 ProfileOAuth2TokenServiceFactory::GetInstance() { |
49 return base::Singleton<ProfileOAuth2TokenServiceFactory>::get(); | 49 return base::Singleton<ProfileOAuth2TokenServiceFactory>::get(); |
50 } | 50 } |
51 | 51 |
52 KeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( | 52 KeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( |
53 content::BrowserContext* context) const { | 53 content::BrowserContext* context) const { |
54 Profile* profile = static_cast<Profile*>(context); | 54 Profile* profile = static_cast<Profile*>(context); |
55 #if BUILDFLAG(ANDROID_JAVA_UI) | 55 #if defined(OS_ANDROID) |
56 OAuth2TokenServiceDelegateAndroid* delegate = | 56 OAuth2TokenServiceDelegateAndroid* delegate = |
57 new OAuth2TokenServiceDelegateAndroid( | 57 new OAuth2TokenServiceDelegateAndroid( |
58 AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)); | 58 AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)); |
59 #else | 59 #else |
60 MutableProfileOAuth2TokenServiceDelegate* delegate = | 60 MutableProfileOAuth2TokenServiceDelegate* delegate = |
61 new MutableProfileOAuth2TokenServiceDelegate( | 61 new MutableProfileOAuth2TokenServiceDelegate( |
62 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), | 62 ChromeSigninClientFactory::GetInstance()->GetForProfile(profile), |
63 SigninErrorControllerFactory::GetInstance()->GetForProfile(profile), | 63 SigninErrorControllerFactory::GetInstance()->GetForProfile(profile), |
64 AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)); | 64 AccountTrackerServiceFactory::GetInstance()->GetForProfile(profile)); |
65 #endif | 65 #endif |
66 ProfileOAuth2TokenService* service = new ProfileOAuth2TokenService(delegate); | 66 ProfileOAuth2TokenService* service = new ProfileOAuth2TokenService(delegate); |
67 return service; | 67 return service; |
68 } | 68 } |
OLD | NEW |