| 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/sync_metrics.h" | 10 #include "chrome/browser/password_manager/sync_metrics.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ps = new PasswordStoreX(main_thread_runner, | 220 ps = new PasswordStoreX(main_thread_runner, |
| 221 db_thread_runner, | 221 db_thread_runner, |
| 222 login_db.release(), | 222 login_db.release(), |
| 223 backend.release()); | 223 backend.release()); |
| 224 #elif defined(USE_OZONE) | 224 #elif defined(USE_OZONE) |
| 225 ps = new password_manager::PasswordStoreDefault( | 225 ps = new password_manager::PasswordStoreDefault( |
| 226 main_thread_runner, db_thread_runner, login_db.release()); | 226 main_thread_runner, db_thread_runner, login_db.release()); |
| 227 #else | 227 #else |
| 228 NOTIMPLEMENTED(); | 228 NOTIMPLEMENTED(); |
| 229 #endif | 229 #endif |
| 230 std::string sync_username = | |
| 231 password_manager_sync_metrics::GetSyncUsername(profile); | |
| 232 if (!ps.get() || | 230 if (!ps.get() || |
| 233 !ps->Init(sync_start_util::GetFlareForSyncableService(profile->GetPath()), | 231 !ps->Init( |
| 234 sync_username)) { | 232 sync_start_util::GetFlareForSyncableService(profile->GetPath()))) { |
| 235 NOTREACHED() << "Could not initialize password manager."; | 233 NOTREACHED() << "Could not initialize password manager."; |
| 236 return NULL; | 234 return NULL; |
| 237 } | 235 } |
| 238 | 236 |
| 239 return new PasswordStoreService(ps); | 237 return new PasswordStoreService(ps); |
| 240 } | 238 } |
| 241 | 239 |
| 242 void PasswordStoreFactory::RegisterProfilePrefs( | 240 void PasswordStoreFactory::RegisterProfilePrefs( |
| 243 user_prefs::PrefRegistrySyncable* registry) { | 241 user_prefs::PrefRegistrySyncable* registry) { |
| 244 #if !defined(OS_CHROMEOS) && defined(USE_X11) | 242 #if !defined(OS_CHROMEOS) && defined(USE_X11) |
| 245 // Notice that the preprocessor conditions above are exactly those that will | 243 // Notice that the preprocessor conditions above are exactly those that will |
| 246 // result in using PasswordStoreX in BuildServiceInstanceFor(). | 244 // result in using PasswordStoreX in BuildServiceInstanceFor(). |
| 247 registry->RegisterIntegerPref( | 245 registry->RegisterIntegerPref( |
| 248 password_manager::prefs::kLocalProfileId, | 246 password_manager::prefs::kLocalProfileId, |
| 249 kInvalidLocalProfileId, | 247 kInvalidLocalProfileId, |
| 250 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 248 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 251 #endif | 249 #endif |
| 252 } | 250 } |
| 253 | 251 |
| 254 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( | 252 content::BrowserContext* PasswordStoreFactory::GetBrowserContextToUse( |
| 255 content::BrowserContext* context) const { | 253 content::BrowserContext* context) const { |
| 256 return chrome::GetBrowserContextRedirectedInIncognito(context); | 254 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 257 } | 255 } |
| 258 | 256 |
| 259 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { | 257 bool PasswordStoreFactory::ServiceIsNULLWhileTesting() const { |
| 260 return true; | 258 return true; |
| 261 } | 259 } |
| OLD | NEW |