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..6a0bbf75643f436f39dada86922f37536447f4ee 100644 |
--- a/components/autofill/core/browser/form_structure.cc |
+++ b/components/autofill/core/browser/form_structure.cc |
@@ -366,7 +366,10 @@ HtmlFieldType FieldTypeFromAutocompleteAttributeValue( |
if (autocomplete_attribute_value == "email") |
return HTML_TYPE_EMAIL; |
- return HTML_TYPE_UNKNOWN; |
+ if (autocomplete_attribute_value == "") |
Mathieu
2016/01/13 01:03:20
this should probably be first in the function, bec
sebsg
2016/01/13 16:05:13
Absolutely, I should have thought of this. Thanks!
|
+ return HTML_TYPE_UNSPECIFIED; |
+ |
+ 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) |
Mathieu
2016/01/13 01:03:20
shouldn't we also "continue" if it's unrecognized?
sebsg
2016/01/13 16:05:13
No because if we continue, it's like we give up on
|
continue; |
// The preceding token, if any, may be a type hint. |