Chromium Code Reviews| 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 94049ff0729ae84a3a7cbdb5ffd41a22cbebdb68..9a63f67dcdd9592a4e645039b6bef712b2e5b9c5 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) { |
| @@ -810,8 +811,13 @@ 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() || |
| + form.active_field_count() < kRequiredFieldsForPredictionRoutines) { |
|
Evan Stade
2015/11/17 19:13:36
nit: this function now looks like
if (a)
return
sebsg
2015/11/18 16:40:27
Done.
|
| return false; |
| + } |
| return true; |
| } |
| @@ -1360,6 +1366,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( |