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/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
| 11 #include "chrome/browser/sync/glue/sync_start_util.h" |
11 #include "chrome/browser/webdata/web_data_service.h" | 12 #include "chrome/browser/webdata/web_data_service.h" |
12 #include "chrome/browser/webdata/web_data_service_factory.h" | 13 #include "chrome/browser/webdata/web_data_service_factory.h" |
13 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_switches.h" | 15 #include "chrome/common/chrome_switches.h" |
15 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 16 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
16 #include "components/encryptor/encryptor_switches.h" | 17 #include "components/encryptor/encryptor_switches.h" |
17 #include "components/password_manager/core/browser/login_database.h" | 18 #include "components/password_manager/core/browser/login_database.h" |
18 #include "components/password_manager/core/browser/password_store.h" | 19 #include "components/password_manager/core/browser/password_store.h" |
19 #include "components/password_manager/core/browser/password_store_default.h" | 20 #include "components/password_manager/core/browser/password_store_default.h" |
20 #include "components/password_manager/core/common/password_manager_pref_names.h" | 21 #include "components/password_manager/core/common/password_manager_pref_names.h" |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 ps = new PasswordStoreX(main_thread_runner, | 214 ps = new PasswordStoreX(main_thread_runner, |
214 db_thread_runner, | 215 db_thread_runner, |
215 login_db.release(), | 216 login_db.release(), |
216 backend.release()); | 217 backend.release()); |
217 #elif defined(USE_OZONE) | 218 #elif defined(USE_OZONE) |
218 ps = new PasswordStoreDefault( | 219 ps = new PasswordStoreDefault( |
219 main_thread_runner, db_thread_runner, login_db.release()); | 220 main_thread_runner, db_thread_runner, login_db.release()); |
220 #else | 221 #else |
221 NOTIMPLEMENTED(); | 222 NOTIMPLEMENTED(); |
222 #endif | 223 #endif |
223 if (!ps || !ps->Init()) { | 224 if (!ps || !ps->Init( |
| 225 sync_start_util::GetFlareForSyncableService(profile->GetPath()))) { |
224 NOTREACHED() << "Could not initialize password manager."; | 226 NOTREACHED() << "Could not initialize password manager."; |
225 return NULL; | 227 return NULL; |
226 } | 228 } |
227 | 229 |
228 return new PasswordStoreService(ps); | 230 return new PasswordStoreService(ps); |
229 } | 231 } |
230 | 232 |
231 void PasswordStoreFactory::RegisterProfilePrefs( | 233 void PasswordStoreFactory::RegisterProfilePrefs( |
232 user_prefs::PrefRegistrySyncable* registry) { | 234 user_prefs::PrefRegistrySyncable* registry) { |
233 #if !defined(OS_CHROMEOS) && defined(USE_X11) | 235 #if !defined(OS_CHROMEOS) && defined(USE_X11) |
234 registry->RegisterIntegerPref( | 236 registry->RegisterIntegerPref( |
235 prefs::kLocalProfileId, | 237 prefs::kLocalProfileId, |
236 kInvalidLocalProfileId, | 238 kInvalidLocalProfileId, |
237 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 239 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
238 | 240 |
239 // Notice that the preprocessor conditions above are exactly those that will | 241 // Notice that the preprocessor conditions above are exactly those that will |
240 // result in using PasswordStoreX in CreatePasswordStore() below. | 242 // result in using PasswordStoreX in CreatePasswordStore() below. |
241 PasswordStoreX::RegisterProfilePrefs(registry); | 243 PasswordStoreX::RegisterProfilePrefs(registry); |
242 #endif | 244 #endif |
243 } | 245 } |
244 | 246 |
245 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( | 247 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( |
246 content::BrowserContext* context) const { | 248 content::BrowserContext* context) const { |
247 return chrome::GetBrowserContextRedirectedInIncognito(context); | 249 return chrome::GetBrowserContextRedirectedInIncognito(context); |
248 } | 250 } |
249 | 251 |
250 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { | 252 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { |
251 return true; | 253 return true; |
252 } | 254 } |
OLD | NEW |