Chromium Code Reviews| Index: components/autofill/content/renderer/autofill_agent.cc |
| diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc |
| index a9b5badfa19b6be46a3d994ea0b344e0f27e9990..00b6e72cf475169c79b1acf16397b0e7819916d4 100644 |
| --- a/components/autofill/content/renderer/autofill_agent.cc |
| +++ b/components/autofill/content/renderer/autofill_agent.cc |
| @@ -318,8 +318,15 @@ void AutofillAgent::FormControlElementClicked( |
| if (!input_element && !IsTextAreaElement(element)) |
| return; |
| - if (was_focused) |
| - ShowSuggestions(element, true, false, true, false); |
| + bool show_full_suggestion_list = element.isAutofilled() || was_focused; |
| + bool show_password_suggestions_only = !was_focused; |
| + ShowSuggestions(element, |
| + true, |
| + false, |
| + true, |
| + false, |
| + show_full_suggestion_list, |
| + show_password_suggestions_only); |
| } |
| void AutofillAgent::FormControlElementLostFocus() { |
| @@ -368,14 +375,14 @@ void AutofillAgent::TextFieldDidChangeImpl( |
| is_popup_possibly_visible_ = true; |
| return; |
| } |
| + } |
| - if (password_autofill_agent_->TextDidChangeInTextField(*input_element)) { |
| - element_ = element; |
| - return; |
| - } |
| + if (password_autofill_agent_->TextDidChangeInTextField(*input_element)) { |
|
Garrett Casto
2014/07/15 22:17:19
Was this change intentional? Seems like it would c
jww
2014/07/15 22:48:25
No, I think this was a rebase mistake. Good catch!
|
| + element_ = element; |
| + return; |
| } |
| - ShowSuggestions(element, false, true, false, false); |
| + ShowSuggestions(element, false, true, false, false, false, false); |
| FormData form; |
| FormFieldData field; |
| @@ -397,11 +404,11 @@ void AutofillAgent::textFieldDidReceiveKeyDown(const WebInputElement& element, |
| if (event.windowsKeyCode == ui::VKEY_DOWN || |
| event.windowsKeyCode == ui::VKEY_UP) |
| - ShowSuggestions(element, true, true, true, false); |
| + ShowSuggestions(element, true, true, true, false, false, false); |
| } |
| void AutofillAgent::openTextDataListChooser(const WebInputElement& element) { |
| - ShowSuggestions(element, true, false, false, true); |
| + ShowSuggestions(element, true, false, false, true, false, false); |
| } |
| void AutofillAgent::firstUserGestureObserved() { |
| @@ -553,9 +560,13 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, |
| bool autofill_on_empty_values, |
| bool requires_caret_at_end, |
| bool display_warning_if_disabled, |
| - bool datalist_only) { |
| + bool datalist_only, |
| + bool show_full_suggestion_list, |
| + bool show_password_suggestions_only) { |
| if (!element.isEnabled() || element.isReadOnly()) |
| return; |
| + if (!datalist_only && !element.suggestedValue().isEmpty()) |
| + return; |
| const WebInputElement* input_element = toWebInputElement(&element); |
| if (input_element) { |
| @@ -584,8 +595,10 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, |
| } |
| element_ = element; |
| - if (input_element && |
| - password_autofill_agent_->ShowSuggestions(*input_element)) { |
| + if (IsAutofillableInputElement(input_element) && |
| + (password_autofill_agent_->ShowSuggestions(*input_element, |
| + show_full_suggestion_list) || |
| + show_password_suggestions_only)) { |
| is_popup_possibly_visible_ = true; |
| return; |
| } |