Index: components/autofill/core/browser/form_structure.cc |
diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc |
index 5dbcde171b0746e6d2123bb9d173fc25176031ff..982ed2ac58ec2ea86a06965c4ecfbf114a3d0563 100644 |
--- a/components/autofill/core/browser/form_structure.cc |
+++ b/components/autofill/core/browser/form_structure.cc |
@@ -239,6 +239,9 @@ bool ContactTypeHintMatchesFieldType(const std::string& token, |
HtmlFieldType FieldTypeFromAutocompleteAttributeValue( |
const std::string& autocomplete_attribute_value, |
const AutofillField& field) { |
+ if (autocomplete_attribute_value == "") |
+ return HTML_TYPE_UNSPECIFIED; |
+ |
if (autocomplete_attribute_value == "name") |
return HTML_TYPE_NAME; |
@@ -366,7 +369,7 @@ HtmlFieldType FieldTypeFromAutocompleteAttributeValue( |
if (autocomplete_attribute_value == "email") |
return HTML_TYPE_EMAIL; |
- return HTML_TYPE_UNKNOWN; |
+ return HTML_TYPE_UNRECOGNIZED; |
} |
std::string StripDigitsIfRequired(const base::string16& input) { |
@@ -426,7 +429,7 @@ void FormStructure::DetermineHeuristicTypes() { |
if (!was_parsed_for_autocomplete_attributes_) |
ParseFieldTypesFromAutocompleteAttributes(); |
- if (!has_author_specified_types_) { |
+ if (active_field_count() >= kRequiredFieldsForPredictionRoutines) { |
ServerFieldTypeMap field_type_map; |
FormField::ParseFormFields(fields_.get(), is_form_tag_, &field_type_map); |
for (size_t i = 0; i < field_count(); ++i) { |
@@ -782,8 +785,9 @@ bool FormStructure::ShouldBeParsed() const { |
} |
bool FormStructure::ShouldBeCrowdsourced() const { |
- return (has_password_field_ || !has_author_specified_types_) && |
- ShouldBeParsed(); |
+ return (has_password_field_ || |
+ active_field_count() >= kRequiredFieldsForPredictionRoutines) && |
+ ShouldBeParsed(); |
} |
void FormStructure::UpdateFromCache(const FormStructure& cached_form) { |
@@ -1166,7 +1170,7 @@ void FormStructure::ParseFieldTypesFromAutocompleteAttributes() { |
tokens.pop_back(); |
HtmlFieldType field_type = |
FieldTypeFromAutocompleteAttributeValue(field_type_token, *field); |
- if (field_type == HTML_TYPE_UNKNOWN) |
+ if (field_type == HTML_TYPE_UNSPECIFIED) |
continue; |
// The preceding token, if any, may be a type hint. |