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

Side by Side Diff: chrome/browser/password_manager/password_store_factory.cc

Issue 10185008: Taking over issue 10006037: Moved WebDataService to ProfileKeyedService (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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/password_manager/password_store_factory.h" 5 #include "chrome/browser/password_manager/password_store_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/environment.h" 8 #include "base/environment.h"
9 #include "chrome/browser/password_manager/login_database.h" 9 #include "chrome/browser/password_manager/login_database.h"
10 #include "chrome/browser/password_manager/password_store.h" 10 #include "chrome/browser/password_manager/password_store.h"
11 #include "chrome/browser/password_manager/password_store_default.h" 11 #include "chrome/browser/password_manager/password_store_default.h"
12 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
13 #include "chrome/browser/profiles/profile_dependency_manager.h" 13 #include "chrome/browser/profiles/profile_dependency_manager.h"
14 #include "chrome/browser/webdata/web_data_service.h"
15 #include "chrome/browser/webdata/web_data_service_factory.h"
14 #include "chrome/common/chrome_constants.h" 16 #include "chrome/common/chrome_constants.h"
15 #include "chrome/common/chrome_switches.h" 17 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
17 19
18 #if defined(OS_WIN) 20 #if defined(OS_WIN)
19 #include "chrome/browser/password_manager/password_store_win.h" 21 #include "chrome/browser/password_manager/password_store_win.h"
20 #elif defined(OS_MACOSX) 22 #elif defined(OS_MACOSX)
21 #include "chrome/browser/password_manager/password_store_mac.h" 23 #include "chrome/browser/password_manager/password_store_mac.h"
22 #include "crypto/keychain_mac.h" 24 #include "crypto/keychain_mac.h"
23 #include "crypto/mock_keychain_mac.h" 25 #include "crypto/mock_keychain_mac.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 58
57 // static 59 // static
58 PasswordStoreFactory* PasswordStoreFactory::GetInstance() { 60 PasswordStoreFactory* PasswordStoreFactory::GetInstance() {
59 return Singleton<PasswordStoreFactory>::get(); 61 return Singleton<PasswordStoreFactory>::get();
60 } 62 }
61 63
62 PasswordStoreFactory::PasswordStoreFactory() 64 PasswordStoreFactory::PasswordStoreFactory()
63 : RefcountedProfileKeyedServiceFactory( 65 : RefcountedProfileKeyedServiceFactory(
64 "PasswordStore", 66 "PasswordStore",
65 ProfileDependencyManager::GetInstance()) { 67 ProfileDependencyManager::GetInstance()) {
66 // TODO(erg): We must always depend on WebDB; we don't want the dependency 68 DependsOn(WebDataServiceFactory::GetInstance());
67 // graph to be different based on platform.
68 //
69 // DependsOn(WebDataServiceFactory::GetInstance());
70 } 69 }
71 70
72 PasswordStoreFactory::~PasswordStoreFactory() {} 71 PasswordStoreFactory::~PasswordStoreFactory() {}
73 72
74 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && \ 73 #if !defined(OS_MACOSX) && !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && \
75 defined(OS_POSIX) 74 defined(OS_POSIX)
76 LocalProfileId PasswordStoreFactory::GetLocalProfileId( 75 LocalProfileId PasswordStoreFactory::GetLocalProfileId(
77 PrefService* prefs) const { 76 PrefService* prefs) const {
78 LocalProfileId id = prefs->GetInteger(prefs::kLocalProfileId); 77 LocalProfileId id = prefs->GetInteger(prefs::kLocalProfileId);
79 if (id == kInvalidLocalProfileId) { 78 if (id == kInvalidLocalProfileId) {
(...skipping 21 matching lines...) Expand all
101 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName); 100 login_db_file_path = login_db_file_path.Append(chrome::kLoginDataFileName);
102 LoginDatabase* login_db = new LoginDatabase(); 101 LoginDatabase* login_db = new LoginDatabase();
103 if (!login_db->Init(login_db_file_path)) { 102 if (!login_db->Init(login_db_file_path)) {
104 LOG(ERROR) << "Could not initialize login database."; 103 LOG(ERROR) << "Could not initialize login database.";
105 delete login_db; 104 delete login_db;
106 return NULL; 105 return NULL;
107 } 106 }
108 #if defined(OS_WIN) 107 #if defined(OS_WIN)
109 ps = new PasswordStoreWin( 108 ps = new PasswordStoreWin(
110 login_db, profile, 109 login_db, profile,
111 profile->GetWebDataService(Profile::IMPLICIT_ACCESS)); 110 WebDataServiceFactory::GetForProfile(profile, Profile::IMPLICIT_ACCESS));
112 #elif defined(OS_MACOSX) 111 #elif defined(OS_MACOSX)
113 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) { 112 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kUseMockKeychain)) {
114 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db); 113 ps = new PasswordStoreMac(new crypto::MockKeychain(), login_db);
115 } else { 114 } else {
116 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db); 115 ps = new PasswordStoreMac(new crypto::MacKeychain(), login_db);
117 } 116 }
118 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID) 117 #elif defined(OS_CHROMEOS) || defined(OS_ANDROID)
119 // For now, we use PasswordStoreDefault. We might want to make a native 118 // For now, we use PasswordStoreDefault. We might want to make a native
120 // backend for PasswordStoreX (see below) in the future though. 119 // backend for PasswordStoreX (see below) in the future though.
121 ps = new PasswordStoreDefault(login_db, profile); 120 ps = new PasswordStoreDefault(login_db, profile);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 #endif 199 #endif
201 } 200 }
202 201
203 bool PasswordStoreFactory::ServiceRedirectedInIncognito() { 202 bool PasswordStoreFactory::ServiceRedirectedInIncognito() {
204 return true; 203 return true;
205 } 204 }
206 205
207 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() { 206 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() {
208 return true; 207 return true;
209 } 208 }
OLDNEW
« no previous file with comments | « chrome/browser/memory_purger.cc ('k') | chrome/browser/password_manager/password_store_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698