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

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

Issue 15517005: Remove references to Profile from browser_context_keyed_service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/signin/signin_manager_factory.h" 5 #include "chrome/browser/signin/signin_manager_factory.h"
6 6
7 #include "base/prefs/pref_registry_simple.h" 7 #include "base/prefs/pref_registry_simple.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/signin/chrome_signin_manager_delegate.h" 9 #include "chrome/browser/signin/chrome_signin_manager_delegate.h"
10 #include "chrome/browser/signin/signin_manager.h" 10 #include "chrome/browser/signin/signin_manager.h"
11 #include "chrome/browser/signin/token_service_factory.h" 11 #include "chrome/browser/signin/token_service_factory.h"
12 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 12 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
13 #include "chrome/common/pref_names.h" 13 #include "chrome/common/pref_names.h"
14 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" 14 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
15 #include "components/user_prefs/pref_registry_syncable.h" 15 #include "components/user_prefs/pref_registry_syncable.h"
16 16
17 SigninManagerFactory::SigninManagerFactory() 17 SigninManagerFactory::SigninManagerFactory()
18 : ProfileKeyedServiceFactory("SigninManager", 18 : BrowserContextKeyedServiceFactory("SigninManager",
19 ProfileDependencyManager::GetInstance()) { 19 BrowserContextDependencyManager::GetInstance()) {
20 DependsOn(TokenServiceFactory::GetInstance()); 20 DependsOn(TokenServiceFactory::GetInstance());
21 DependsOn(GlobalErrorServiceFactory::GetInstance()); 21 DependsOn(GlobalErrorServiceFactory::GetInstance());
22 } 22 }
23 23
24 SigninManagerFactory::~SigninManagerFactory() {} 24 SigninManagerFactory::~SigninManagerFactory() {}
25 25
26 #if defined(OS_CHROMEOS) 26 #if defined(OS_CHROMEOS)
27 // static 27 // static
28 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists( 28 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists(
29 Profile* profile) { 29 Profile* profile) {
30 return static_cast<SigninManagerBase*>( 30 return static_cast<SigninManagerBase*>(
31 GetInstance()->GetServiceForProfile(profile, false)); 31 GetInstance()->GetServiceForBrowserContext(profile, false));
32 } 32 }
33 33
34 // static 34 // static
35 SigninManagerBase* SigninManagerFactory::GetForProfile( 35 SigninManagerBase* SigninManagerFactory::GetForProfile(
36 Profile* profile) { 36 Profile* profile) {
37 return static_cast<SigninManagerBase*>( 37 return static_cast<SigninManagerBase*>(
38 GetInstance()->GetServiceForProfile(profile, true)); 38 GetInstance()->GetServiceForBrowserContext(profile, true));
39 } 39 }
40 40
41 #else 41 #else
42 // static 42 // static
43 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) { 43 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) {
44 return static_cast<SigninManager*>( 44 return static_cast<SigninManager*>(
45 GetInstance()->GetServiceForProfile(profile, true)); 45 GetInstance()->GetServiceForBrowserContext(profile, true));
46 } 46 }
47 47
48 // static 48 // static
49 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) { 49 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) {
50 return static_cast<SigninManager*>( 50 return static_cast<SigninManager*>(
51 GetInstance()->GetServiceForProfile(profile, false)); 51 GetInstance()->GetServiceForBrowserContext(profile, false));
52 } 52 }
53 #endif 53 #endif
54 54
55 // static 55 // static
56 SigninManagerFactory* SigninManagerFactory::GetInstance() { 56 SigninManagerFactory* SigninManagerFactory::GetInstance() {
57 return Singleton<SigninManagerFactory>::get(); 57 return Singleton<SigninManagerFactory>::get();
58 } 58 }
59 59
60 void SigninManagerFactory::RegisterUserPrefs( 60 void SigninManagerFactory::RegisterUserPrefs(
61 user_prefs::PrefRegistrySyncable* registry) { 61 user_prefs::PrefRegistrySyncable* registry) {
(...skipping 17 matching lines...) Expand all
79 new ListValue, 79 new ListValue,
80 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 80 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
81 } 81 }
82 82
83 // static 83 // static
84 void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) { 84 void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) {
85 registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, 85 registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern,
86 std::string()); 86 std::string());
87 } 87 }
88 88
89 ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor( 89 BrowserContextKeyedService* SigninManagerFactory::BuildServiceInstanceFor(
90 content::BrowserContext* context) const { 90 content::BrowserContext* context) const {
91 SigninManagerBase* service = NULL; 91 SigninManagerBase* service = NULL;
92 Profile* profile = static_cast<Profile*>(context); 92 Profile* profile = static_cast<Profile*>(context);
93 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
94 service = new SigninManagerBase(); 94 service = new SigninManagerBase();
95 #else 95 #else
96 service = new SigninManager( 96 service = new SigninManager(
97 scoped_ptr<SigninManagerDelegate>( 97 scoped_ptr<SigninManagerDelegate>(
98 new ChromeSigninManagerDelegate(profile))); 98 new ChromeSigninManagerDelegate(profile)));
99 #endif 99 #endif
100 service->Initialize(profile, g_browser_process->local_state()); 100 service->Initialize(profile, g_browser_process->local_state());
101 return service; 101 return service;
102 } 102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698