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

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

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 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/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/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/signin/account_tracker_service_factory.h" 10 #include "chrome/browser/signin/account_tracker_service_factory.h"
(...skipping 18 matching lines...) Expand all
29 } 29 }
30 30
31 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
32 // static 32 // static
33 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists( 33 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists(
34 Profile* profile) { 34 Profile* profile) {
35 return static_cast<SigninManagerBase*>( 35 return static_cast<SigninManagerBase*>(
36 GetInstance()->GetServiceForBrowserContext(profile, false)); 36 GetInstance()->GetServiceForBrowserContext(profile, false));
37 } 37 }
38 38
39 const SigninManagerBase* SigninManagerFactory::GetForProfileIfExists(
40 const Profile* profile) {
41 return static_cast<const SigninManagerBase*>(
42 GetInstance()->GetServiceForBrowserContext(
43 const_cast<Profile*>(profile), false));
44 }
45
39 // static 46 // static
40 SigninManagerBase* SigninManagerFactory::GetForProfile( 47 SigninManagerBase* SigninManagerFactory::GetForProfile(
41 Profile* profile) { 48 Profile* profile) {
42 return static_cast<SigninManagerBase*>( 49 return static_cast<SigninManagerBase*>(
43 GetInstance()->GetServiceForBrowserContext(profile, true)); 50 GetInstance()->GetServiceForBrowserContext(profile, true));
44 } 51 }
45 52
46 #else 53 #else
47 // static 54 // static
48 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) { 55 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) {
49 return static_cast<SigninManager*>( 56 return static_cast<SigninManager*>(
50 GetInstance()->GetServiceForBrowserContext(profile, true)); 57 GetInstance()->GetServiceForBrowserContext(profile, true));
51 } 58 }
52 59
53 // static 60 // static
54 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) { 61 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) {
55 return static_cast<SigninManager*>( 62 return static_cast<SigninManager*>(
56 GetInstance()->GetServiceForBrowserContext(profile, false)); 63 GetInstance()->GetServiceForBrowserContext(profile, false));
57 } 64 }
65
66 // static
67 const SigninManager* SigninManagerFactory::GetForProfileIfExists(
68 const Profile* profile) {
69 return static_cast<const SigninManager*>(
70 GetInstance()->GetServiceForBrowserContext(
71 const_cast<Profile*>(profile), false));
72 }
58 #endif 73 #endif
59 74
60 // static 75 // static
61 SigninManagerFactory* SigninManagerFactory::GetInstance() { 76 SigninManagerFactory* SigninManagerFactory::GetInstance() {
62 return Singleton<SigninManagerFactory>::get(); 77 return Singleton<SigninManagerFactory>::get();
63 } 78 }
64 79
65 void SigninManagerFactory::RegisterProfilePrefs( 80 void SigninManagerFactory::RegisterProfilePrefs(
66 user_prefs::PrefRegistrySyncable* registry) { 81 user_prefs::PrefRegistrySyncable* registry) {
67 registry->RegisterStringPref( 82 registry->RegisterStringPref(
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 } 160 }
146 161
147 void SigninManagerFactory::BrowserContextShutdown( 162 void SigninManagerFactory::BrowserContextShutdown(
148 content::BrowserContext* context) { 163 content::BrowserContext* context) {
149 SigninManagerBase* manager = static_cast<SigninManagerBase*>( 164 SigninManagerBase* manager = static_cast<SigninManagerBase*>(
150 GetServiceForBrowserContext(context, false)); 165 GetServiceForBrowserContext(context, false));
151 if (manager) 166 if (manager)
152 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager)); 167 FOR_EACH_OBSERVER(Observer, observer_list_, SigninManagerShutdown(manager));
153 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context); 168 BrowserContextKeyedServiceFactory::BrowserContextShutdown(context);
154 } 169 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698