Chromium Code Reviews| Index: components/autofill/content/renderer/form_autofill_util.cc |
| diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc |
| index c9c6f8789db4e31532694666c8f93db64f4a4ede..04a9883b41089d93243e50364989ab46dbac7442 100644 |
| --- a/components/autofill/content/renderer/form_autofill_util.cc |
| +++ b/components/autofill/content/renderer/form_autofill_util.cc |
| @@ -639,6 +639,11 @@ bool IsMonthInput(const WebInputElement* element) { |
| return element && element->formControlType() == kMonth; |
| } |
| +bool IsPasswordInput(const WebInputElement* element) { |
| + CR_DEFINE_STATIC_LOCAL(WebString, kPassword, ("password")); |
| + return element && element->formControlType() == kPassword; |
|
Ilya Sherman
2014/03/21 22:35:19
There is already an "element.isPasswordField()" me
ziran.sun
2014/03/25 18:25:26
Done.
|
| +} |
| + |
| // All text fields, including password fields, should be extracted. |
| bool IsTextInput(const WebInputElement* element) { |
| return element && element->isTextField(); |
| @@ -1047,14 +1052,15 @@ void PreviewForm(const FormData& form, const WebInputElement& element) { |
| } |
| bool ClearPreviewedFormWithElement(const WebInputElement& element, |
| - bool was_autofilled) { |
| + RequirementsMask requirements, |
| + bool was_autofilled, |
| + bool was_password_autofilled) { |
| WebFormElement form_element = element.form(); |
| if (form_element.isNull()) |
| return false; |
| std::vector<WebFormControlElement> control_elements; |
| - ExtractAutofillableElements(form_element, REQUIRE_AUTOCOMPLETE, |
| - &control_elements); |
| + ExtractAutofillableElements(form_element, requirements, &control_elements); |
|
Ilya Sherman
2014/03/21 22:35:19
Hmm, would anything go wrong if we were to just al
ziran.sun
2014/03/25 18:25:26
I feel that it might be safe to use REQUIRE_NONE h
Ilya Sherman
2014/03/25 19:45:27
I think since neither of us sees any reason not to
|
| for (size_t i = 0; i < control_elements.size(); ++i) { |
| // There might be unrelated elements in this form which have already been |
| // auto-filled. For example, the user might have already filled the address |
| @@ -1089,6 +1095,8 @@ bool ClearPreviewedFormWithElement(const WebInputElement& element, |
| bool is_initiating_node = (element == *input_element); |
| if (is_initiating_node) |
| input_element->setAutofilled(was_autofilled); |
| + else if (IsPasswordInput(input_element)) |
| + input_element->setAutofilled(was_password_autofilled); |
| else |
| input_element->setAutofilled(false); |