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

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

Issue 12502017: signin: pull basic SigninManager functionality into new SigninManagerBase class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: deal with new enterprise_platform_keys_private_api Created 7 years, 8 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/profiles/profile_dependency_manager.h" 8 #include "chrome/browser/profiles/profile_dependency_manager.h"
9 #include "chrome/browser/signin/signin_manager.h" 9 #include "chrome/browser/signin/signin_manager.h"
10 #include "chrome/browser/signin/token_service_factory.h" 10 #include "chrome/browser/signin/token_service_factory.h"
11 #include "chrome/browser/ui/global_error/global_error_service_factory.h" 11 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
12 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
13 #include "components/user_prefs/pref_registry_syncable.h" 13 #include "components/user_prefs/pref_registry_syncable.h"
14 14
15 SigninManagerFactory::SigninManagerFactory() 15 SigninManagerFactory::SigninManagerFactory()
16 : ProfileKeyedServiceFactory("SigninManager", 16 : ProfileKeyedServiceFactory("SigninManager",
17 ProfileDependencyManager::GetInstance()) { 17 ProfileDependencyManager::GetInstance()) {
18 DependsOn(TokenServiceFactory::GetInstance()); 18 DependsOn(TokenServiceFactory::GetInstance());
19 DependsOn(GlobalErrorServiceFactory::GetInstance()); 19 DependsOn(GlobalErrorServiceFactory::GetInstance());
20 } 20 }
21 21
22 SigninManagerFactory::~SigninManagerFactory() {} 22 SigninManagerFactory::~SigninManagerFactory() {}
23 23
24 #if defined(OS_CHROMEOS)
25 // static
26 SigninManagerBase* SigninManagerFactory::GetForProfileIfExists(
27 Profile* profile) {
28 return static_cast<SigninManagerBase*>(
29 GetInstance()->GetServiceForProfile(profile, false));
30 }
31
32 // static
33 SigninManagerBase* SigninManagerFactory::GetForProfile(
34 Profile* profile) {
35 return static_cast<SigninManagerBase*>(
36 GetInstance()->GetServiceForProfile(profile, true));
37 }
38
39 #else
24 // static 40 // static
25 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) { 41 SigninManager* SigninManagerFactory::GetForProfile(Profile* profile) {
26 return static_cast<SigninManager*>( 42 return static_cast<SigninManager*>(
27 GetInstance()->GetServiceForProfile(profile, true)); 43 GetInstance()->GetServiceForProfile(profile, true));
28 } 44 }
29 45
30 // static 46 // static
31 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) { 47 SigninManager* SigninManagerFactory::GetForProfileIfExists(Profile* profile) {
32 return static_cast<SigninManager*>( 48 return static_cast<SigninManager*>(
33 GetInstance()->GetServiceForProfile(profile, false)); 49 GetInstance()->GetServiceForProfile(profile, false));
34 } 50 }
51 #endif
35 52
36 // static 53 // static
37 SigninManagerFactory* SigninManagerFactory::GetInstance() { 54 SigninManagerFactory* SigninManagerFactory::GetInstance() {
38 return Singleton<SigninManagerFactory>::get(); 55 return Singleton<SigninManagerFactory>::get();
39 } 56 }
40 57
41 void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) { 58 void SigninManagerFactory::RegisterUserPrefs(PrefRegistrySyncable* registry) {
42 registry->RegisterStringPref(prefs::kGoogleServicesLastUsername, 59 registry->RegisterStringPref(prefs::kGoogleServicesLastUsername,
43 std::string(), 60 std::string(),
44 PrefRegistrySyncable::UNSYNCABLE_PREF); 61 PrefRegistrySyncable::UNSYNCABLE_PREF);
(...skipping 10 matching lines...) Expand all
55 } 72 }
56 73
57 // static 74 // static
58 void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) { 75 void SigninManagerFactory::RegisterPrefs(PrefRegistrySimple* registry) {
59 registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern, 76 registry->RegisterStringPref(prefs::kGoogleServicesUsernamePattern,
60 std::string()); 77 std::string());
61 } 78 }
62 79
63 ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor( 80 ProfileKeyedService* SigninManagerFactory::BuildServiceInstanceFor(
64 Profile* profile) const { 81 Profile* profile) const {
65 SigninManager* service = new SigninManager(); 82
83 SigninManagerBase* service = NULL;
84 #if defined(OS_CHROMEOS)
85 service = new SigninManagerBase();
86 #else
87 service = new SigninManager();
88 #endif
89
66 service->Initialize(profile); 90 service->Initialize(profile);
67 return service; 91 return service;
68 } 92 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/signin_manager_factory.h ('k') | chrome/browser/signin/signin_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698