OLD | NEW |
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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "chrome/browser/password_manager/login_database.h" | 10 #include "chrome/browser/password_manager/login_database.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 if (!backend.get()) { | 177 if (!backend.get()) { |
178 LOG(WARNING) << "Using basic (unencrypted) store for password storage. " | 178 LOG(WARNING) << "Using basic (unencrypted) store for password storage. " |
179 "See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for " | 179 "See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for " |
180 "more information about password storage options."; | 180 "more information about password storage options."; |
181 } | 181 } |
182 | 182 |
183 ps = new PasswordStoreX(login_db, profile, backend.release()); | 183 ps = new PasswordStoreX(login_db, profile, backend.release()); |
184 #else | 184 #else |
185 NOTIMPLEMENTED(); | 185 NOTIMPLEMENTED(); |
186 #endif | 186 #endif |
187 if (!ps) | 187 if (!ps.get()) |
188 delete login_db; | 188 delete login_db; |
189 | 189 |
190 if (!ps || !ps->Init()) { | 190 if (!ps.get() || !ps->Init()) { |
191 NOTREACHED() << "Could not initialize password manager."; | 191 NOTREACHED() << "Could not initialize password manager."; |
192 return NULL; | 192 return NULL; |
193 } | 193 } |
194 | 194 |
195 return ps; | 195 return ps; |
196 } | 196 } |
197 | 197 |
198 void PasswordStoreFactory::RegisterUserPrefs( | 198 void PasswordStoreFactory::RegisterUserPrefs( |
199 user_prefs::PrefRegistrySyncable* registry) { | 199 user_prefs::PrefRegistrySyncable* registry) { |
200 #if !defined(OS_CHROMEOS) && defined(USE_X11) | 200 #if !defined(OS_CHROMEOS) && defined(USE_X11) |
201 registry->RegisterIntegerPref( | 201 registry->RegisterIntegerPref( |
202 prefs::kLocalProfileId, | 202 prefs::kLocalProfileId, |
203 kInvalidLocalProfileId, | 203 kInvalidLocalProfileId, |
204 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 204 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
205 | 205 |
206 // Notice that the preprocessor conditions above are exactly those that will | 206 // Notice that the preprocessor conditions above are exactly those that will |
207 // result in using PasswordStoreX in CreatePasswordStore() below. | 207 // result in using PasswordStoreX in CreatePasswordStore() below. |
208 PasswordStoreX::RegisterUserPrefs(registry); | 208 PasswordStoreX::RegisterUserPrefs(registry); |
209 #endif | 209 #endif |
210 } | 210 } |
211 | 211 |
212 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( | 212 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( |
213 content::BrowserContext* context) const { | 213 content::BrowserContext* context) const { |
214 return chrome::GetBrowserContextRedirectedInIncognito(context); | 214 return chrome::GetBrowserContextRedirectedInIncognito(context); |
215 } | 215 } |
216 | 216 |
217 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { | 217 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { |
218 return true; | 218 return true; |
219 } | 219 } |
OLD | NEW |