| 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 c6175c9f22729eb75d442d0be697a370eb8cfbb7..dde537997b4f56380c0cc1111f82015300db6f99 100644
|
| --- a/components/autofill/content/renderer/form_autofill_util.cc
|
| +++ b/components/autofill/content/renderer/form_autofill_util.cc
|
| @@ -56,15 +56,22 @@ namespace {
|
|
|
| // A bit field mask for FillForm functions to not fill some fields.
|
| enum FieldFilterMask {
|
| - FILTER_NONE = 0,
|
| - FILTER_DISABLED_ELEMENTS = 1 << 0,
|
| - FILTER_READONLY_ELEMENTS = 1 << 1,
|
| - FILTER_NON_FOCUSABLE_ELEMENTS = 1 << 2,
|
| - FILTER_ALL_NON_EDITIABLE_ELEMENTS = FILTER_DISABLED_ELEMENTS |
|
| - FILTER_READONLY_ELEMENTS |
|
| - FILTER_NON_FOCUSABLE_ELEMENTS,
|
| + FILTER_NONE = 0,
|
| + FILTER_DISABLED_ELEMENTS = 1 << 0,
|
| + FILTER_READONLY_ELEMENTS = 1 << 1,
|
| + FILTER_NON_FOCUSABLE_ELEMENTS = 1 << 2,
|
| + FILTER_ALL_NON_EDITABLE_ELEMENTS = FILTER_DISABLED_ELEMENTS |
|
| + FILTER_READONLY_ELEMENTS |
|
| + FILTER_NON_FOCUSABLE_ELEMENTS,
|
| };
|
|
|
| +RequirementsMask ExtractionRequirements() {
|
| + return base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + switches::kIgnoreAutocompleteOffForAutofill)
|
| + ? REQUIRE_NONE
|
| + : REQUIRE_AUTOCOMPLETE;
|
| +}
|
| +
|
| bool IsOptionElement(const WebElement& element) {
|
| CR_DEFINE_STATIC_LOCAL(WebString, kOption, ("option"));
|
| return element.hasHTMLTagName(kOption);
|
| @@ -480,8 +487,8 @@ void ForEachMatchingFormField(const WebFormElement& form_element,
|
| bool force_override,
|
| Callback callback) {
|
| std::vector<WebFormControlElement> control_elements;
|
| - ExtractAutofillableElements(form_element, REQUIRE_AUTOCOMPLETE,
|
| - &control_elements);
|
| + ExtractAutofillableElements(
|
| + form_element, ExtractionRequirements(), &control_elements);
|
|
|
| if (control_elements.size() != data.fields.size()) {
|
| // This case should be reachable only for pathological websites and tests,
|
| @@ -1001,7 +1008,7 @@ void FillForm(const FormData& form, const WebFormControlElement& element) {
|
| ForEachMatchingFormField(form_element,
|
| element,
|
| form,
|
| - FILTER_ALL_NON_EDITIABLE_ELEMENTS,
|
| + FILTER_ALL_NON_EDITABLE_ELEMENTS,
|
| false, /* dont force override */
|
| &FillFormField);
|
| }
|
| @@ -1042,7 +1049,7 @@ void PreviewForm(const FormData& form, const WebFormControlElement& element) {
|
| ForEachMatchingFormField(form_element,
|
| element,
|
| form,
|
| - FILTER_ALL_NON_EDITIABLE_ELEMENTS,
|
| + FILTER_ALL_NON_EDITABLE_ELEMENTS,
|
| false, /* dont force override */
|
| &PreviewFormField);
|
| }
|
| @@ -1054,8 +1061,8 @@ bool ClearPreviewedFormWithElement(const WebFormControlElement& element,
|
| return false;
|
|
|
| std::vector<WebFormControlElement> control_elements;
|
| - ExtractAutofillableElements(form_element, REQUIRE_AUTOCOMPLETE,
|
| - &control_elements);
|
| + ExtractAutofillableElements(
|
| + form_element, ExtractionRequirements(), &control_elements);
|
| 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
|
| @@ -1114,8 +1121,8 @@ bool FormWithElementIsAutofilled(const WebInputElement& element) {
|
| return false;
|
|
|
| std::vector<WebFormControlElement> control_elements;
|
| - ExtractAutofillableElements(form_element, REQUIRE_AUTOCOMPLETE,
|
| - &control_elements);
|
| + ExtractAutofillableElements(
|
| + form_element, ExtractionRequirements(), &control_elements);
|
| for (size_t i = 0; i < control_elements.size(); ++i) {
|
| WebInputElement* input_element = toWebInputElement(&control_elements[i]);
|
| if (!IsAutofillableInputElement(input_element))
|
|
|