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 71694ad4a5df47528f17f6d728cfffcdff9b8e93..5be5f7f11e87cc58885f3c71114cc67adf71c19d 100644 |
--- a/chrome/browser/password_manager/password_store_x.cc |
+++ b/chrome/browser/password_manager/password_store_x.cc |
@@ -146,17 +146,18 @@ 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 PasswordStoreDefault::FillMatchingLogins(form, prompt_policy); |
+ return matched_forms.Pass(); |
} |
- return matched_forms.Pass(); |
+ if (allow_default_store()) |
+ return PasswordStoreDefault::FillMatchingLogins(form, prompt_policy); |
+ return ScopedVector<autofill::PasswordForm>(); |
} |
bool PasswordStoreX::FillAutofillableLogins( |
ScopedVector<autofill::PasswordForm>* forms) { |
+ forms->clear(); |
CheckMigration(); |
if (use_native_backend() && backend_->GetAutofillableLogins(forms)) { |
SortLoginsByOrigin(&forms->get()); |
@@ -172,6 +173,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. |
@@ -221,8 +223,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 |