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 e09021e2c0e49b6365dc77a9221882531c15a325..fec0b79616247d26ea41a2659d0ec50140e81ead 100644 |
| --- a/components/autofill/content/renderer/autofill_agent.cc |
| +++ b/components/autofill/content/renderer/autofill_agent.cc |
| @@ -156,11 +156,14 @@ AutofillAgent::AutofillAgent(content::RenderFrame* render_frame, |
| has_shown_autofill_popup_for_current_edit_(false), |
| ignore_text_changes_(false), |
| is_popup_possibly_visible_(false), |
| + is_generation_popup_possibly_visible_(false), |
| weak_ptr_factory_(this) { |
| render_frame->GetWebFrame()->setAutofillClient(this); |
| // This owns itself, and will delete itself when |render_frame| is destructed |
| - // (same as AutofillAgent). |
| + // (same as AutofillAgent). This object must be constructed after |
| + // AutofillAgent so that password generation UI is shown before password |
| + // manager UI (see https://crbug.com/498545). |
| new PageClickTracker(render_frame, this); |
| } |
| @@ -280,6 +283,7 @@ void AutofillAgent::FocusChangeComplete() { |
| if (!focused_element.isNull() && password_generation_agent_ && |
| password_generation_agent_->FocusedNodeHasChanged(focused_element)) { |
| + is_generation_popup_possibly_visible_ = true; |
| is_popup_possibly_visible_ = true; |
| } |
| } |
| @@ -352,6 +356,9 @@ void AutofillAgent::FormControlElementClicked( |
| if (!input_element && !IsTextAreaElement(element)) |
| return; |
| + if (is_generation_popup_possibly_visible_) |
| + return; |
| + |
| ShowSuggestionsOptions options; |
| options.autofill_on_empty_values = true; |
| options.show_full_suggestion_list = element.isAutofilled(); |
| @@ -657,13 +664,15 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element, |
| element_ = element; |
| if (IsAutofillableInputElement(input_element) && |
| - (password_autofill_agent_->ShowSuggestions( |
| - *input_element, options.show_full_suggestion_list) || |
| - options.show_password_suggestions_only)) { |
| + password_autofill_agent_->ShowSuggestions( |
| + *input_element, options.show_full_suggestion_list)) { |
| is_popup_possibly_visible_ = true; |
| return; |
| } |
| + if (options.show_password_suggestions_only) |
| + return; |
|
Ilya Sherman
2015/06/16 02:24:09
This is a small bugfix that's otherwise unrelated
Garrett Casto
2015/06/16 06:15:04
Yes. My original intent was to not introduce a new
|
| + |
| // Password field elements should only have suggestions shown by the password |
| // autofill agent. |
| if (input_element && input_element->isPasswordField()) |
| @@ -753,6 +762,7 @@ void AutofillAgent::HidePopup() { |
| if (!is_popup_possibly_visible_) |
| return; |
| is_popup_possibly_visible_ = false; |
| + is_generation_popup_possibly_visible_ = false; |
| Send(new AutofillHostMsg_HidePopup(routing_id())); |
| } |