| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_default.h" | 5 #include "chrome/browser/password_manager/password_store_default.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 const PasswordForms& forms = | 87 const PasswordForms& forms = |
| 88 static_cast<const WDResult<PasswordForms>*>(result)->GetValue(); | 88 static_cast<const WDResult<PasswordForms>*>(result)->GetValue(); |
| 89 for (PasswordForms::const_iterator it = forms.begin(); | 89 for (PasswordForms::const_iterator it = forms.begin(); |
| 90 it != forms.end(); ++it) { | 90 it != forms.end(); ++it) { |
| 91 password_store_->AddLogin(**it); | 91 password_store_->AddLogin(**it); |
| 92 web_data_service_->RemoveLogin(**it); | 92 web_data_service_->RemoveLogin(**it); |
| 93 delete *it; | 93 delete *it; |
| 94 } | 94 } |
| 95 if (handles_.empty()) { | 95 if (handles_.empty()) { |
| 96 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, | 96 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, |
| 97 true); | 97 true, |
| 98 PrefService::UNSYNCABLE_PREF); |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 | 101 |
| 101 PasswordStoreDefault::PasswordStoreDefault(LoginDatabase* login_db, | 102 PasswordStoreDefault::PasswordStoreDefault(LoginDatabase* login_db, |
| 102 Profile* profile, | 103 Profile* profile, |
| 103 WebDataService* web_data_service) | 104 WebDataService* web_data_service) |
| 104 : web_data_service_(web_data_service), | 105 : web_data_service_(web_data_service), |
| 105 login_db_(login_db), profile_(profile) { | 106 login_db_(login_db), profile_(profile) { |
| 106 DCHECK(login_db); | 107 DCHECK(login_db); |
| 107 DCHECK(profile); | 108 DCHECK(profile); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 } | 209 } |
| 209 | 210 |
| 210 void PasswordStoreDefault::MigrateIfNecessary() { | 211 void PasswordStoreDefault::MigrateIfNecessary() { |
| 211 PrefService* prefs = profile_->GetPrefs(); | 212 PrefService* prefs = profile_->GetPrefs(); |
| 212 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) | 213 if (prefs->FindPreference(prefs::kLoginDatabaseMigrated)) |
| 213 return; | 214 return; |
| 214 DCHECK(!migrate_helper_.get()); | 215 DCHECK(!migrate_helper_.get()); |
| 215 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); | 216 migrate_helper_.reset(new MigrateHelper(profile_, web_data_service_, this)); |
| 216 migrate_helper_->Init(); | 217 migrate_helper_->Init(); |
| 217 } | 218 } |
| OLD | NEW |