Index: components/password_manager/core/browser/password_manager.cc |
diff --git a/components/password_manager/core/browser/password_manager.cc b/components/password_manager/core/browser/password_manager.cc |
index 5d8bd589a9940b8c098fc4f815aefded3b2cac0c..2e619e04e86f8db555288f050a0b3f03658ea9e1 100644 |
--- a/components/password_manager/core/browser/password_manager.cc |
+++ b/components/password_manager/core/browser/password_manager.cc |
@@ -178,7 +178,6 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
// Below, "matching" is in DoesManage-sense and "not ready" in |
// !HasCompletedMatching sense. We keep track of such PasswordFormManager |
// instances for UMA. |
- bool has_found_matching_managers_which_were_not_ready = false; |
for (ScopedVector<PasswordFormManager>::iterator iter = |
pending_login_managers_.begin(); |
iter != pending_login_managers_.end(); ++iter) { |
@@ -195,11 +194,6 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
continue; |
} |
- if (!(*iter)->HasCompletedMatching()) { |
- has_found_matching_managers_which_were_not_ready = true; |
- continue; |
- } |
- |
if (result == PasswordFormManager::RESULT_COMPLETE_MATCH) { |
// If we find a manager that exactly matches the submitted form including |
// the action URL, exit the loop. |
@@ -241,25 +235,11 @@ void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { |
// |manager|. |
manager.reset(*matched_manager_it); |
pending_login_managers_.weak_erase(matched_manager_it); |
- } else if (has_found_matching_managers_which_were_not_ready) { |
- // We found some managers, but none finished matching yet. The user has |
- // tried to submit credentials before we had time to even find matching |
- // results for the given form and autofill. If this is the case, we just |
- // give up. |
- RecordFailure(MATCHING_NOT_COMPLETE, form.origin, logger.get()); |
- return; |
} else { |
RecordFailure(NO_MATCHING_FORM, form.origin, logger.get()); |
return; |
} |
- // Also get out of here if the user told us to 'never remember' passwords for |
- // this form. |
- if (manager->IsBlacklisted()) { |
- RecordFailure(FORM_BLACKLISTED, form.origin, logger.get()); |
- return; |
- } |
- |
// Bail if we're missing any of the necessary form components. |
if (!manager->HasValidPasswordForm()) { |
RecordFailure(INVALID_FORM, form.origin, logger.get()); |
@@ -467,6 +447,26 @@ void PasswordManager::OnPasswordFormsRendered( |
return; |
} |
+ if (!provisional_save_manager_->HasCompletedMatching()) { |
+ // We have a provisional save manager, but it didn't finish matching yet. |
+ // We just give up. |
+ RecordFailure(MATCHING_NOT_COMPLETE, |
+ provisional_save_manager_->observed_form().origin, |
+ logger.get()); |
+ provisional_save_manager_.reset(); |
+ return; |
+ } |
+ |
+ // Also get out of here if the user told us to 'never remember' passwords for |
+ // this form. |
+ if (provisional_save_manager_->IsBlacklisted()) { |
+ RecordFailure(FORM_BLACKLISTED, |
+ provisional_save_manager_->observed_form().origin, |
+ logger.get()); |
+ provisional_save_manager_.reset(); |
+ return; |
+ } |
+ |
DCHECK(client_->IsSavingEnabledForCurrentPage()); |
// If the server throws an internal error, access denied page, page not |