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

Side by Side Diff: chrome/browser/chromeos/login/oauth2_login_manager_factory.cc

Issue 23678007: OAuth2LoginManager+MergeSessionThrottle hardening, multi-profle support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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/chromeos/login/oauth2_login_manager_factory.h"
6
7 #include "chrome/browser/chromeos/login/oauth2_login_manager.h"
8 #include "chrome/browser/profiles/profile.h"
5 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
6
7 #include "chrome/browser/profiles/profile.h"
8 #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 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
13 14
14 ProfileOAuth2TokenServiceFactory::ProfileOAuth2TokenServiceFactory() 15 namespace chromeos {
16
17 OAuth2LoginManagerFactory::OAuth2LoginManagerFactory()
15 : BrowserContextKeyedServiceFactory( 18 : BrowserContextKeyedServiceFactory(
16 "ProfileOAuth2TokenService", 19 "OAuth2LoginManager",
17 BrowserContextDependencyManager::GetInstance()) { 20 BrowserContextDependencyManager::GetInstance()) {
18 DependsOn(GlobalErrorServiceFactory::GetInstance()); 21 DependsOn(GlobalErrorServiceFactory::GetInstance());
19 DependsOn(SigninManagerFactory::GetInstance()); 22 DependsOn(SigninManagerFactory::GetInstance());
20 DependsOn(TokenServiceFactory::GetInstance()); 23 DependsOn(TokenServiceFactory::GetInstance());
24 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
21 } 25 }
22 26
23 ProfileOAuth2TokenServiceFactory::~ProfileOAuth2TokenServiceFactory() { 27 OAuth2LoginManagerFactory::~OAuth2LoginManagerFactory() {
24 } 28 }
25 29
26 #if defined(OS_ANDROID)
27 // static 30 // static
28 AndroidProfileOAuth2TokenService* 31 OAuth2LoginManager* OAuth2LoginManagerFactory::GetForProfile(
29 ProfileOAuth2TokenServiceFactory::GetForProfile(Profile* profile) { 32 Profile* profile) {
30 return static_cast<AndroidProfileOAuth2TokenService*>( 33 return static_cast<OAuth2LoginManager*>(
31 GetInstance()->GetServiceForBrowserContext(profile, true)); 34 GetInstance()->GetServiceForBrowserContext(profile, true));
32 } 35 }
33 #else
34 // static
35 ProfileOAuth2TokenService* ProfileOAuth2TokenServiceFactory::GetForProfile(
36 Profile* profile) {
37 return static_cast<ProfileOAuth2TokenService*>(
38 GetInstance()->GetServiceForBrowserContext(profile, true));
39 }
40 #endif // defined(OS_ANDROID)
41 36
42 // static 37 // static
43 ProfileOAuth2TokenServiceFactory* 38 OAuth2LoginManagerFactory*
44 ProfileOAuth2TokenServiceFactory::GetInstance() { 39 OAuth2LoginManagerFactory::GetInstance() {
45 return Singleton<ProfileOAuth2TokenServiceFactory>::get(); 40 return Singleton<OAuth2LoginManagerFactory>::get();
46 } 41 }
47 42
48 BrowserContextKeyedService* 43 BrowserContextKeyedService*
49 ProfileOAuth2TokenServiceFactory::BuildServiceInstanceFor( 44 OAuth2LoginManagerFactory::BuildServiceInstanceFor(
50 content::BrowserContext* context) const { 45 content::BrowserContext* context) const {
51 Profile* profile = static_cast<Profile*>(context); 46 Profile* profile = static_cast<Profile*>(context);
52 ProfileOAuth2TokenService* service; 47 OAuth2LoginManager* service;
53 #if defined(OS_ANDROID) 48 service = new OAuth2LoginManager(profile);
54 service = new AndroidProfileOAuth2TokenService();
55 #else
56 service = new ProfileOAuth2TokenService();
57 #endif
58 service->Initialize(profile);
59 return service; 49 return service;
60 } 50 }
51
52 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/oauth2_login_manager_factory.h ('k') | chrome/browser/chromeos/login/oauth_login_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698