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

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

Issue 166043006: Add password manager autocomplete suggestion when a username element in clicked. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on ToT Created 6 years, 5 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 a9b5badfa19b6be46a3d994ea0b344e0f27e9990..c21ef5505e1d0d61fe5ed22ce5b64034ae937bbf 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() {
@@ -375,7 +382,7 @@ void AutofillAgent::TextFieldDidChangeImpl(
}
}
- 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;
}
« 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