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

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: Update from gcasto's comments Created 6 years, 9 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 f172bbc7ecfced10d4d9c66c65c8218b45f55859..7f70e30acbb77fd178613c889b56692f8e2b2db1 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -292,8 +292,16 @@ void AutofillAgent::setIgnoreTextChanges(bool ignore) {
void AutofillAgent::InputElementClicked(const WebInputElement& element,
bool was_focused,
bool is_focused) {
- if (was_focused)
- ShowSuggestions(element, true, false, true, false);
+ bool show_full_suggestion_list = (element.isAutofilled() && !was_focused) ||
+ (!element.isAutofilled() && was_focused);
Garrett Casto 2014/03/12 06:50:45 This seems overly complicated to me. If the elemen
jww 2014/03/19 01:08:02 This is for the case you argue for later, not crea
Garrett Casto 2014/03/19 20:54:41 Ahh, my fault. For some reason I thought that we w
jww 2014/06/20 18:43:46 So I've actually had a bit of a change of heart on
+ bool show_password_suggestions_only = !was_focused;
+ ShowSuggestions(element,
+ true,
+ false,
+ true,
+ false,
+ show_full_suggestion_list,
+ show_password_suggestions_only);
}
void AutofillAgent::InputElementLostFocus() {
@@ -342,7 +350,7 @@ void AutofillAgent::TextFieldDidChangeImpl(const WebInputElement& element) {
return;
}
- ShowSuggestions(element, false, true, false, false);
+ ShowSuggestions(element, false, true, false, false, false, false);
FormData form;
FormFieldData field;
@@ -361,11 +369,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::AcceptDataListSuggestion(
@@ -496,7 +504,9 @@ void AutofillAgent::ShowSuggestions(const WebInputElement& 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() || !element.isTextField() ||
element.isPasswordField())
return;
@@ -518,7 +528,9 @@ void AutofillAgent::ShowSuggestions(const WebInputElement& element,
}
element_ = element;
- if (password_autofill_agent_->ShowSuggestions(element)) {
+ if (password_autofill_agent_->ShowSuggestions(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