Chromium Code Reviews| Index: components/password_manager/core/browser/password_form_manager.cc |
| diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc |
| index 1248b11787ab7207efe6975f35a0e3f638cf4103..eab586cec2ec68bf73a81d3449d1d27068045ae3 100644 |
| --- a/components/password_manager/core/browser/password_form_manager.cc |
| +++ b/components/password_manager/core/browser/password_form_manager.cc |
| @@ -375,11 +375,12 @@ void PasswordFormManager::OnRequestDone( |
| // the PasswordForm objects pointed to by the result vector, thus we keep |
| // copies to a minimum here. |
| + bool autofill_result_filtered = false; |
| int best_score = 0; |
| // These credentials will be in the final result regardless of score. |
| std::vector<PasswordForm> credentials_to_keep; |
| for (size_t i = 0; i < logins_result.size(); i++) { |
| - if (IgnoreResult(*logins_result[i])) { |
| + if (ShouldIgnoreResult(*logins_result[i], &autofill_result_filtered)) { |
| delete logins_result[i]; |
| continue; |
| } |
| @@ -439,6 +440,9 @@ void PasswordFormManager::OnRequestDone( |
| // We're done matching now. |
| state_ = POST_MATCHING_PHASE; |
| + UMA_HISTOGRAM_BOOLEAN("PasswordManager.AutofillResultsFiltered", |
| + autofill_result_filtered); |
| + |
| if (best_score <= 0) { |
| return; |
| } |
| @@ -507,7 +511,8 @@ void PasswordFormManager::OnGetPasswordStoreResults( |
| OnRequestDone(results); |
| } |
| -bool PasswordFormManager::IgnoreResult(const PasswordForm& form) const { |
| +bool PasswordFormManager::ShouldIgnoreResult( |
| + const PasswordForm& form, bool* autofill_result_filtered) const { |
|
Ilya Sherman
2014/08/13 20:48:15
nit: One arg per line, please.
Garrett Casto
2014/08/13 23:12:54
Done.
|
| // Do not autofill on sign-up or change password forms (until we have some |
| // working change password functionality). |
| if (!observed_form_.new_password_element.empty()) |
| @@ -515,6 +520,11 @@ bool PasswordFormManager::IgnoreResult(const PasswordForm& form) const { |
| // Don't match an invalid SSL form with one saved under secure circumstances. |
| if (form.ssl_valid && !observed_form_.ssl_valid) |
| return true; |
| + |
| + if (client_->ShouldFilterAutofillResult(form)) { |
| + *autofill_result_filtered = true; |
| + return true; |
| + } |
| return false; |
| } |