Chromium Code Reviews| 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 e8fd37a40f564ac0043910473491d1d014010a16..94126968e0ac4c16cdacdbdd704e70eb5a1a6e15 100644 |
| --- a/components/autofill/core/browser/form_structure.cc |
| +++ b/components/autofill/core/browser/form_structure.cc |
| @@ -352,7 +352,8 @@ FormStructure::FormStructure(const FormData& form) |
| autofill_count_(0), |
| active_field_count_(0), |
| upload_required_(USE_UPLOAD_RATES), |
| - has_author_specified_types_(false) { |
| + has_author_specified_types_(false), |
| + has_password_field_(false) { |
| // Copy the form fields. |
| std::map<base::string16, size_t> unique_names; |
| for (std::vector<FormFieldData>::const_iterator field = |
| @@ -367,6 +368,9 @@ FormStructure::FormStructure(const FormData& form) |
| ++active_field_count_; |
| } |
| + if (field->form_control_type == "password") |
| + has_password_field_ = true; |
| + |
| // Generate a unique name for this field by appending a counter to the name. |
| // Make sure to prepend the counter with a non-numeric digit so that we are |
| // guaranteed to avoid collisions. |
| @@ -579,6 +583,14 @@ void FormStructure::ParseQueryResponse( |
| if (current_info == field_infos.end()) |
| break; |
| + // If |form->has_author_specified_types| only password fields should be |
| + // updated. |
| + if (form->has_author_specified_types_ && |
| + (*field)->form_control_type != "password") { |
| + ++current_info; |
|
Ilya Sherman
2014/10/25 00:36:18
Oh, sorry, I had not noticed that "++current_info;
|
| + continue; |
| + } |
| + |
| // UNKNOWN_TYPE is reserved for use by the client. |
| DCHECK_NE(current_info->field_type, UNKNOWN_TYPE); |
| @@ -706,7 +718,8 @@ bool FormStructure::ShouldBeParsed() const { |
| } |
| bool FormStructure::ShouldBeCrowdsourced() const { |
| - return !has_author_specified_types_ && ShouldBeParsed(); |
| + return (has_password_field_ || !has_author_specified_types_) && |
| + ShouldBeParsed(); |
| } |
| void FormStructure::UpdateFromCache(const FormStructure& cached_form) { |