OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/content/renderer/autofill_agent.h" | 5 #include "components/autofill/content/renderer/autofill_agent.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 | 625 |
626 static int query_counter = 0; | 626 static int query_counter = 0; |
627 autofill_query_id_ = query_counter++; | 627 autofill_query_id_ = query_counter++; |
628 display_warning_if_disabled_ = display_warning_if_disabled; | 628 display_warning_if_disabled_ = display_warning_if_disabled; |
629 | 629 |
630 // If autocomplete is disabled at the form level, we want to see if there | 630 // If autocomplete is disabled at the form level, we want to see if there |
631 // would have been any suggestions were it enabled, so that we can show a | 631 // would have been any suggestions were it enabled, so that we can show a |
632 // warning. Otherwise, we want to ignore fields that disable autocomplete, so | 632 // warning. Otherwise, we want to ignore fields that disable autocomplete, so |
633 // that the suggestions list does not include suggestions for these form | 633 // that the suggestions list does not include suggestions for these form |
634 // fields -- see comment 1 on http://crbug.com/69914 | 634 // fields -- see comment 1 on http://crbug.com/69914 |
635 const RequirementsMask requirements = | 635 RequirementsMask requirements = |
636 element.autoComplete() ? REQUIRE_AUTOCOMPLETE : REQUIRE_NONE; | 636 element.autoComplete() ? REQUIRE_AUTOCOMPLETE : REQUIRE_NONE; |
637 | 637 |
| 638 // If we're ignoring autocomplete="off", always extract everything. |
| 639 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 640 switches::kIgnoreAutocompleteOffForAutofill)) { |
| 641 requirements = REQUIRE_NONE; |
| 642 } |
| 643 |
638 FormData form; | 644 FormData form; |
639 FormFieldData field; | 645 FormFieldData field; |
640 if (!FindFormAndFieldForFormControlElement(element, &form, &field, | 646 if (!FindFormAndFieldForFormControlElement(element, &form, &field, |
641 requirements)) { | 647 requirements)) { |
642 // If we didn't find the cached form, at least let autocomplete have a shot | 648 // If we didn't find the cached form, at least let autocomplete have a shot |
643 // at providing suggestions. | 649 // at providing suggestions. |
644 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); | 650 WebFormControlElementToFormField(element, EXTRACT_VALUE, &field); |
645 } | 651 } |
646 if (datalist_only) | 652 if (datalist_only) |
647 field.should_autocomplete = false; | 653 field.should_autocomplete = false; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 ProcessForms(*frame); | 737 ProcessForms(*frame); |
732 password_autofill_agent_->OnDynamicFormsSeen(frame); | 738 password_autofill_agent_->OnDynamicFormsSeen(frame); |
733 if (password_generation_agent_) | 739 if (password_generation_agent_) |
734 password_generation_agent_->OnDynamicFormsSeen(frame); | 740 password_generation_agent_->OnDynamicFormsSeen(frame); |
735 return; | 741 return; |
736 } | 742 } |
737 } | 743 } |
738 } | 744 } |
739 | 745 |
740 } // namespace autofill | 746 } // namespace autofill |
OLD | NEW |