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

Side by Side Diff: chrome/browser/managed_mode/managed_user_registration_service_factory.cc

Issue 16173008: Reland 203015 "Add ManagedUserTokenFetcher to fetch scoped-down ..." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/managed_mode/managed_user_registration_service_factory. h" 5 #include "chrome/browser/managed_mode/managed_user_registration_service_factory. h"
6 6
7 #include "chrome/browser/managed_mode/managed_user_refresh_token_fetcher.h"
7 #include "chrome/browser/managed_mode/managed_user_registration_service.h" 8 #include "chrome/browser/managed_mode/managed_user_registration_service.h"
9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/profile_oauth2_token_service.h"
11 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
8 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 12 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
9 13
10 // static 14 // static
11 ManagedUserRegistrationService* 15 ManagedUserRegistrationService*
12 ManagedUserRegistrationServiceFactory::GetForProfile(Profile* profile) { 16 ManagedUserRegistrationServiceFactory::GetForProfile(Profile* profile) {
13 return static_cast<ManagedUserRegistrationService*>( 17 return static_cast<ManagedUserRegistrationService*>(
14 GetInstance()->GetServiceForBrowserContext(profile, true)); 18 GetInstance()->GetServiceForBrowserContext(profile, true));
15 } 19 }
16 20
17 // static 21 // static
18 ManagedUserRegistrationServiceFactory* 22 ManagedUserRegistrationServiceFactory*
19 ManagedUserRegistrationServiceFactory::GetInstance() { 23 ManagedUserRegistrationServiceFactory::GetInstance() {
20 return Singleton<ManagedUserRegistrationServiceFactory>::get(); 24 return Singleton<ManagedUserRegistrationServiceFactory>::get();
21 } 25 }
22 26
23 // static 27 // static
24 BrowserContextKeyedService* 28 BrowserContextKeyedService*
25 ManagedUserRegistrationServiceFactory::BuildInstanceFor(Profile* profile) { 29 ManagedUserRegistrationServiceFactory::BuildInstanceFor(Profile* profile) {
26 return new ManagedUserRegistrationService(profile->GetPrefs()); 30 OAuth2TokenService* oauth2_token_service =
31 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
32 return new ManagedUserRegistrationService(
33 profile->GetPrefs(),
34 ManagedUserRefreshTokenFetcher::Create(oauth2_token_service,
35 profile->GetRequestContext()));
27 } 36 }
28 37
29 ManagedUserRegistrationServiceFactory::ManagedUserRegistrationServiceFactory() 38 ManagedUserRegistrationServiceFactory::ManagedUserRegistrationServiceFactory()
30 : BrowserContextKeyedServiceFactory( 39 : BrowserContextKeyedServiceFactory(
31 "ManagedUserRegistrationService", 40 "ManagedUserRegistrationService",
32 BrowserContextDependencyManager::GetInstance()) {} 41 BrowserContextDependencyManager::GetInstance()) {
42 DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
43 }
33 44
34 ManagedUserRegistrationServiceFactory:: 45 ManagedUserRegistrationServiceFactory::
35 ~ManagedUserRegistrationServiceFactory() {} 46 ~ManagedUserRegistrationServiceFactory() {}
36 47
37 BrowserContextKeyedService* 48 BrowserContextKeyedService*
38 ManagedUserRegistrationServiceFactory::BuildServiceInstanceFor( 49 ManagedUserRegistrationServiceFactory::BuildServiceInstanceFor(
39 content::BrowserContext* profile) const { 50 content::BrowserContext* profile) const {
40 return BuildInstanceFor(static_cast<Profile*>(profile)); 51 return BuildInstanceFor(static_cast<Profile*>(profile));
41 } 52 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698