Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/signin/profile_oauth2_token_service_factory.cc

Issue 12647008: Refactor OAuth2TokenService to have profile- and device-based implementations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase again Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #if defined(OS_ANDROID)
13 : ProfileKeyedServiceFactory("OAuth2TokenService", 14 #include "chrome/browser/signin/android_profile_oauth2_token_service.h"
15 #endif
16
17 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory()
18 : ProfileKeyedServiceFactory("ProfileOAuth2TokenService",
14 ProfileDependencyManager::GetInstance()) { 19 ProfileDependencyManager::GetInstance()) {
15 DependsOn(SigninManagerFactory::GetInstance()); 20 DependsOn(SigninManagerFactory::GetInstance());
16 DependsOn(TokenServiceFactory::GetInstance()); 21 DependsOn(TokenServiceFactory::GetInstance());
17 } 22 }
18 23
19 OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() { 24 ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() {
20 } 25 }
21 26
22 // static 27 // static
23 OAuth2TokenService* OAuth2TokenServiceFactory::GetForProfile(Profile* profile) { 28 ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile(
24 return static_cast<OAuth2TokenService*>( 29 Profile* profile) {
30 return static_cast<ProfileOAuth2TokenService*>(
25 GetInstance()->GetServiceForProfile(profile, true)); 31 GetInstance()->GetServiceForProfile(profile, true));
26 } 32 }
27 33
28 // static 34 // static
29 OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() { 35 ProfileOAuth2TokenServiceFactory*
30 return Singleton<OAuth2TokenServiceFactory>::get(); 36 ProfileOAuth2TokenServiceFactory::GetInstance() {
37 return Singleton<ProfileOAuth2TokenServiceFactory>::get();
31 } 38 }
32 39
33 ProfileKeyedService* OAuth2TokenServiceFactory::BuildServiceInstanceFor( 40 ProfileKeyedService* ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor(
34 Profile* profile) const { 41 Profile* profile) const {
35 OAuth2TokenService* service = new OAuth2TokenService(); 42 ProfileOAuth2TokenService* service;
43 #if defined(OS_ANDROID)
44 service = new AndroidProfileOAuth2TokenService(profile->GetRequestContext());
45 #else
46 service = new ProfileOAuth2TokenService(profile->GetRequestContext());
47 #endif
36 service->Initialize(profile); 48 service->Initialize(profile);
37 return service; 49 return service;
38 } 50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698