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

Side by Side Diff: ios/chrome/browser/signin/oauth2_token_service_factory.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/signin/oauth2_token_service_factory.h" 5 #include "ios/chrome/browser/signin/oauth2_token_service_factory.h"
6 6
7 #include "base/memory/singleton.h" 7 #include "base/memory/singleton.h"
8 #include "components/keyed_service/ios/browser_state_dependency_manager.h" 8 #include "components/keyed_service/ios/browser_state_dependency_manager.h"
9 #include "components/pref_registry/pref_registry_syncable.h" 9 #include "components/pref_registry/pref_registry_syncable.h"
10 #include "components/signin/core/browser/profile_oauth2_token_service.h" 10 #include "components/signin/core/browser/profile_oauth2_token_service.h"
(...skipping 17 matching lines...) Expand all
28 OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() {} 28 OAuth2TokenServiceFactory::~OAuth2TokenServiceFactory() {}
29 29
30 ProfileOAuth2TokenService* OAuth2TokenServiceFactory::GetForBrowserState( 30 ProfileOAuth2TokenService* OAuth2TokenServiceFactory::GetForBrowserState(
31 ios::ChromeBrowserState* browser_state) { 31 ios::ChromeBrowserState* browser_state) {
32 return static_cast<ProfileOAuth2TokenService*>( 32 return static_cast<ProfileOAuth2TokenService*>(
33 GetInstance()->GetServiceForBrowserState(browser_state, true)); 33 GetInstance()->GetServiceForBrowserState(browser_state, true));
34 } 34 }
35 35
36 // static 36 // static
37 OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() { 37 OAuth2TokenServiceFactory* OAuth2TokenServiceFactory::GetInstance() {
38 return Singleton<OAuth2TokenServiceFactory>::get(); 38 return base::Singleton<OAuth2TokenServiceFactory>::get();
39 } 39 }
40 40
41 void OAuth2TokenServiceFactory::RegisterBrowserStatePrefs( 41 void OAuth2TokenServiceFactory::RegisterBrowserStatePrefs(
42 user_prefs::PrefRegistrySyncable* registry) { 42 user_prefs::PrefRegistrySyncable* registry) {
43 registry->RegisterBooleanPref(prefs::kTokenServiceExcludeAllSecondaryAccounts, 43 registry->RegisterBooleanPref(prefs::kTokenServiceExcludeAllSecondaryAccounts,
44 false); 44 false);
45 registry->RegisterListPref(prefs::kTokenServiceExcludedSecondaryAccounts); 45 registry->RegisterListPref(prefs::kTokenServiceExcludedSecondaryAccounts);
46 } 46 }
47 47
48 scoped_ptr<KeyedService> OAuth2TokenServiceFactory::BuildServiceInstanceFor( 48 scoped_ptr<KeyedService> OAuth2TokenServiceFactory::BuildServiceInstanceFor(
49 web::BrowserState* context) const { 49 web::BrowserState* context) const {
50 ios::ChromeBrowserState* chrome_browser_state = 50 ios::ChromeBrowserState* chrome_browser_state =
51 ios::ChromeBrowserState::FromBrowserState(context); 51 ios::ChromeBrowserState::FromBrowserState(context);
52 ProfileOAuth2TokenServiceIOSDelegate* delegate = 52 ProfileOAuth2TokenServiceIOSDelegate* delegate =
53 new ProfileOAuth2TokenServiceIOSDelegate( 53 new ProfileOAuth2TokenServiceIOSDelegate(
54 SigninClientFactory::GetForBrowserState(chrome_browser_state), 54 SigninClientFactory::GetForBrowserState(chrome_browser_state),
55 ios::GetChromeBrowserProvider() 55 ios::GetChromeBrowserProvider()
56 ->GetProfileOAuth2TokenServiceIOSProvider(), 56 ->GetProfileOAuth2TokenServiceIOSProvider(),
57 ios::AccountTrackerServiceFactory::GetForBrowserState( 57 ios::AccountTrackerServiceFactory::GetForBrowserState(
58 chrome_browser_state), 58 chrome_browser_state),
59 ios::SigninErrorControllerFactory::GetForBrowserState( 59 ios::SigninErrorControllerFactory::GetForBrowserState(
60 chrome_browser_state)); 60 chrome_browser_state));
61 return make_scoped_ptr(new ProfileOAuth2TokenService(delegate)); 61 return make_scoped_ptr(new ProfileOAuth2TokenService(delegate));
62 } 62 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/signin/oauth2_token_service_factory.h ('k') | ios/chrome/browser/signin/signin_client_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698