Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: components/password_manager/core/browser/password_form_manager.cc

Issue 2886413002: Fix sending autofill votes for sign-in forms. (Closed)
Patch Set: fix compilation error Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_form_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 eb88be67ab7c5ccd1a549ad592c423236fc4d6b3..f350a0f2d46eefe285bd9098ba372a33d8bc6810 100644
--- a/components/password_manager/core/browser/password_form_manager.cc
+++ b/components/password_manager/core/browser/password_form_manager.cc
@@ -197,14 +197,6 @@ void LabelFields(const FieldTypeMap& field_types,
}
}
-// Check whether |form_data| corresponds to a 2 field form with 1 text field and
-// 1 password field. Such form is likely sign-in form.
-bool IsSignInSubmission(const FormData& form_data) {
- return form_data.fields.size() == 2 &&
- form_data.fields[0].form_control_type == "text" &&
- form_data.fields[1].form_control_type == "password";
-}
-
} // namespace
PasswordFormManager::PasswordFormManager(
@@ -1298,8 +1290,16 @@ void PasswordFormManager::SendVotesOnSave() {
if (observed_form_.IsPossibleChangePasswordFormWithoutUsername())
return;
- if (IsSignInSubmission(pending_credentials_.form_data)) {
- SendSignInVote(pending_credentials_.form_data);
+ // Send votes for sign-in form.
+ autofill::FormData& form_data = pending_credentials_.form_data;
+ if (form_data.fields.size() == 2 &&
+ form_data.fields[0].form_control_type == "text" &&
+ form_data.fields[1].form_control_type == "password") {
+ // |form_data| is received from the renderer and does not contain field
+ // values. Fill username field value with username to allow AutofillManager
+ // to detect username autofill type.
+ form_data.fields[0].value = pending_credentials_.username_value;
+ SendSignInVote(form_data);
return;
}
« no previous file with comments | « no previous file | components/password_manager/core/browser/password_form_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698