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

Unified Diff: components/autofill/content/renderer/form_cache.cc

Issue 1670763006: Autofill server-side heuristics for 2 fields password form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 10 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
Index: components/autofill/content/renderer/form_cache.cc
diff --git a/components/autofill/content/renderer/form_cache.cc b/components/autofill/content/renderer/form_cache.cc
index 334afa94fa69d331cb1ba78b5411cc9ca74e2980..8e74098541d388a0e07f7160cb14a6e81ace0f93 100644
--- a/components/autofill/content/renderer/form_cache.cc
+++ b/components/autofill/content/renderer/form_cache.cc
@@ -65,15 +65,21 @@ bool IsFormInteresting(const FormData& form, size_t num_editable_elements) {
// If the form has at least one field with an autocomplete attribute, it is a
// candidate for autofill.
+ bool all_fields_are_passwords = true;
for (const FormFieldData& field : form.fields) {
if (!field.autocomplete_attribute.empty())
return true;
+ if (field.form_control_type != "password")
+ all_fields_are_passwords = false;
}
// If there are no autocomplete attributes, the form needs to have at least
// the required number of editable fields for the prediction routines to be a
// candidate for autofill.
- return num_editable_elements >= kRequiredFieldsForPredictionRoutines;
+ return num_editable_elements >= kRequiredFieldsForPredictionRoutines ||
+ (all_fields_are_passwords &&
+ num_editable_elements >=
+ kRequiredFieldsForFormsWithOnlyPasswordFields);
}
} // namespace
« no previous file with comments | « chrome/renderer/autofill/form_autofill_browsertest.cc ('k') | components/autofill/core/browser/autofill_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698