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

Unified Diff: components/autofill/core/browser/autofill_manager.cc

Issue 1411363003: [Autofill] Always show available data when encountering autocomplete attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed mathp's comments Created 5 years, 2 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/core/browser/autofill_manager.cc
diff --git a/components/autofill/core/browser/autofill_manager.cc b/components/autofill/core/browser/autofill_manager.cc
index f346849ee94073dbdd73c2280ba185af6ff1ce2b..1d2709a869d8cdcd183a43384d785930b0e8be77 100644
--- a/components/autofill/core/browser/autofill_manager.cc
+++ b/components/autofill/core/browser/autofill_manager.cc
@@ -44,6 +44,7 @@
#include "components/autofill/core/browser/phone_number.h"
#include "components/autofill/core/browser/phone_number_i18n.h"
#include "components/autofill/core/browser/popup_item_ids.h"
+#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_data_validation.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/autofill_switches.h"
@@ -386,8 +387,8 @@ void AutofillManager::OnQueryFormFieldAutofill(int query_id,
AutofillField* autofill_field = NULL;
bool got_autofillable_form =
GetCachedFormAndField(form, field, &form_structure, &autofill_field) &&
- // Don't send suggestions or track forms that aren't auto-fillable.
- form_structure->IsAutofillable();
+ // Don't send suggestions or track forms that should not be parsed.
+ form_structure->ShouldBeParsed();
// Logging interactions of forms that are autofillable.
if (got_autofillable_form) {
@@ -1400,6 +1401,8 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) {
for (const FormData& form : forms) {
scoped_ptr<FormStructure> form_structure(new FormStructure(form));
+ form_structure->ParseFieldTypesFromAutocompleteAttributes();
+
if (!form_structure->ShouldBeParsed()) {
if (form_structure->has_password_field()) {
AutofillMetrics::LogPasswordFormQueryVolume(
@@ -1521,7 +1524,11 @@ bool AutofillManager::ShouldUploadForm(const FormStructure& form) {
return false;
// Disregard forms that we wouldn't ever autofill in the first place.
- if (!form.ShouldBeParsed())
+ // ShouldBeParsed can return true for small forms in certain situations so a
+ // specific check for the number of active fields is necessary to avoid
+ // uploading very small forms.
+ if (!form.ShouldBeParsed() &&
Evan Stade 2015/10/21 19:12:31 shouldn't this be an or not an and?
sebsg 2015/10/26 15:57:56 Done.
Evan Stade 2015/10/27 17:08:37 does one of the tests you added verify the correct
sebsg 2015/11/10 19:04:50 Done.
+ form.active_field_count() < kRequiredAutofillFields)
return false;
return true;

Powered by Google App Engine
This is Rietveld 408576698