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

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1184913002: [Password Manager] Suppress UI when password generation is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 5 years, 6 months 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 side-by-side diff with in-line comments
Download patch
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..d0c5ea05ce45b0ad86a868aa63254869bf4d8dc5 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;
}
}
@@ -657,13 +661,19 @@ 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_generation_popup_possibly_visible_)) {
is_popup_possibly_visible_ = true;
return;
}
+ if (is_generation_popup_possibly_visible_)
+ return;
+
+ if (options.show_password_suggestions_only)
+ return;
+
// Password field elements should only have suggestions shown by the password
// autofill agent.
if (input_element && input_element->isPasswordField())
@@ -753,6 +763,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()));
}
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698