Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 773573004: Fill on account select in the password manager behind a flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Fix browser_test crashes Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 603
604 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, 604 void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
605 const ShowSuggestionsOptions& options) { 605 const ShowSuggestionsOptions& options) {
606 if (!element.isEnabled() || element.isReadOnly()) 606 if (!element.isEnabled() || element.isReadOnly())
607 return; 607 return;
608 if (!options.datalist_only && !element.suggestedValue().isEmpty()) 608 if (!options.datalist_only && !element.suggestedValue().isEmpty())
609 return; 609 return;
610 610
611 const WebInputElement* input_element = toWebInputElement(&element); 611 const WebInputElement* input_element = toWebInputElement(&element);
612 if (input_element) { 612 if (input_element) {
613 if (!input_element->isTextField() || input_element->isPasswordField()) 613 if (!input_element->isTextField())
614 return; 614 return;
615 if (!options.datalist_only && !input_element->suggestedValue().isEmpty()) 615 if (!options.datalist_only && !input_element->suggestedValue().isEmpty())
616 return; 616 return;
617 } else { 617 } else {
618 DCHECK(IsTextAreaElement(element)); 618 DCHECK(IsTextAreaElement(element));
619 if (!element.toConst<WebTextAreaElement>().suggestedValue().isEmpty()) 619 if (!element.toConst<WebTextAreaElement>().suggestedValue().isEmpty())
620 return; 620 return;
621 } 621 }
622 622
623 // Don't attempt to autofill with values that are too large or if filling 623 // Don't attempt to autofill with values that are too large or if filling
(...skipping 12 matching lines...) Expand all
636 636
637 element_ = element; 637 element_ = element;
638 if (IsAutofillableInputElement(input_element) && 638 if (IsAutofillableInputElement(input_element) &&
639 (password_autofill_agent_->ShowSuggestions( 639 (password_autofill_agent_->ShowSuggestions(
640 *input_element, options.show_full_suggestion_list) || 640 *input_element, options.show_full_suggestion_list) ||
641 options.show_password_suggestions_only)) { 641 options.show_password_suggestions_only)) {
642 is_popup_possibly_visible_ = true; 642 is_popup_possibly_visible_ = true;
643 return; 643 return;
644 } 644 }
645 645
646 // Password field elements should only have suggestions shown by the password
647 // autofill agent.
648 if (input_element && input_element->isPasswordField())
649 return;
650
646 // If autocomplete is disabled at the field level, ensure that the native 651 // If autocomplete is disabled at the field level, ensure that the native
647 // UI won't try to show a warning, since that may conflict with a custom 652 // UI won't try to show a warning, since that may conflict with a custom
648 // popup. Note that we cannot use the WebKit method element.autoComplete() 653 // popup. Note that we cannot use the WebKit method element.autoComplete()
649 // as it does not allow us to distinguish the case where autocomplete is 654 // as it does not allow us to distinguish the case where autocomplete is
650 // disabled for *both* the element and for the form. 655 // disabled for *both* the element and for the form.
651 bool display_warning = options.display_warning_if_disabled; 656 bool display_warning = options.display_warning_if_disabled;
652 if (display_warning) { 657 if (display_warning) {
653 const base::string16 autocomplete_attribute = 658 const base::string16 autocomplete_attribute =
654 element.getAttribute("autocomplete"); 659 element.getAttribute("autocomplete");
655 if (LowerCaseEqualsASCII(autocomplete_attribute, "off")) 660 if (LowerCaseEqualsASCII(autocomplete_attribute, "off"))
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 void AutofillAgent::LegacyAutofillAgent::Resized() { 832 void AutofillAgent::LegacyAutofillAgent::Resized() {
828 agent_->Resized(); 833 agent_->Resized();
829 } 834 }
830 835
831 void AutofillAgent::LegacyAutofillAgent::FrameWillClose( 836 void AutofillAgent::LegacyAutofillAgent::FrameWillClose(
832 blink::WebFrame* frame) { 837 blink::WebFrame* frame) {
833 agent_->LegacyFrameWillClose(frame); 838 agent_->LegacyFrameWillClose(frame);
834 } 839 }
835 840
836 } // namespace autofill 841 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698