Index: chrome/browser/password_manager/password_store_x.cc |
diff --git a/chrome/browser/password_manager/password_store_x.cc b/chrome/browser/password_manager/password_store_x.cc |
index 595770f599d5d222c47aca3eed0661fdd58341bf..eecb417b8c12b5f17276b994e9f37b7e05d14dda 100644 |
--- a/chrome/browser/password_manager/password_store_x.cc |
+++ b/chrome/browser/password_manager/password_store_x.cc |
@@ -145,13 +145,14 @@ ScopedVector<autofill::PasswordForm> PasswordStoreX::FillMatchingLogins( |
// The native backend may succeed and return no data even while locked, if |
// the query did not match anything stored. So we continue to allow fallback |
// until we perform a write operation, or until a read returns actual data. |
- if (matched_forms.size() > 0) |
+ if (!matched_forms.empty()) |
allow_fallback_ = false; |
- } else if (allow_default_store()) { |
- DCHECK(matched_forms.empty()); |
+ return matched_forms.Pass(); |
+ } |
+ if (allow_default_store()) { |
engedy
2015/03/09 13:33:18
nit: -{}
vabr (Chromium)
2015/03/09 17:44:15
Done.
|
return PasswordStoreDefault::FillMatchingLogins(form, prompt_policy); |
} |
- return matched_forms.Pass(); |
+ return ScopedVector<autofill::PasswordForm>(); |
} |
void PasswordStoreX::GetAutofillableLoginsImpl( |
@@ -195,6 +196,7 @@ void PasswordStoreX::GetBlacklistLoginsImpl( |
bool PasswordStoreX::FillAutofillableLogins( |
ScopedVector<autofill::PasswordForm>* forms) { |
+ forms->clear(); |
CheckMigration(); |
if (use_native_backend() && backend_->GetAutofillableLogins(forms)) { |
// See GetLoginsImpl() for why we disallow fallback conditionally here. |
@@ -209,6 +211,7 @@ bool PasswordStoreX::FillAutofillableLogins( |
bool PasswordStoreX::FillBlacklistLogins( |
ScopedVector<autofill::PasswordForm>* forms) { |
+ forms->clear(); |
CheckMigration(); |
if (use_native_backend() && backend_->GetBlacklistLogins(forms)) { |
// See GetLoginsImpl() for why we disallow fallback conditionally here. |
@@ -257,8 +260,12 @@ bool PasswordStoreX::allow_default_store() { |
ssize_t PasswordStoreX::MigrateLogins() { |
DCHECK(backend_.get()); |
ScopedVector<autofill::PasswordForm> forms; |
+ ScopedVector<autofill::PasswordForm> blacklist_forms; |
bool ok = PasswordStoreDefault::FillAutofillableLogins(&forms) && |
- PasswordStoreDefault::FillBlacklistLogins(&forms); |
+ PasswordStoreDefault::FillBlacklistLogins(&blacklist_forms); |
+ forms.reserve(forms.size() + blacklist_forms.size()); |
+ forms.insert(forms.end(), blacklist_forms.begin(), blacklist_forms.end()); |
+ blacklist_forms.weak_clear(); |
if (ok) { |
// We add all the passwords (and blacklist entries) to the native backend |
// before attempting to remove any from the login database, to make sure we |