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

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

Issue 1447283006: [Autofill] Clicking datalist chooser arrow now shows Autofill/Autocomplete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial Created 5 years, 1 month 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
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ed9969d5834f18bf12085e9961b29be782d55f9a..2be9215db3efe98e7fc9119466feabf6d8effeaa 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -130,7 +130,6 @@ void TrimStringVectorForIPC(std::vector<base::string16>* strings) {
AutofillAgent::ShowSuggestionsOptions::ShowSuggestionsOptions()
: autofill_on_empty_values(false),
requires_caret_at_end(false),
- datalist_only(false),
show_full_suggestion_list(false),
show_password_suggestions_only(false) {
}
@@ -465,7 +464,6 @@ void AutofillAgent::textFieldDidReceiveKeyDown(const WebInputElement& element,
void AutofillAgent::openTextDataListChooser(const WebInputElement& element) {
ShowSuggestionsOptions options;
options.autofill_on_empty_values = true;
- options.datalist_only = true;
ShowSuggestions(element, options);
}
@@ -652,14 +650,14 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
const ShowSuggestionsOptions& options) {
if (!element.isEnabled() || element.isReadOnly())
return;
- if (!options.datalist_only && !element.suggestedValue().isEmpty())
+ if (!element.suggestedValue().isEmpty())
return;
const WebInputElement* input_element = toWebInputElement(&element);
if (input_element) {
if (!input_element->isTextField())
return;
- if (!options.datalist_only && !input_element->suggestedValue().isEmpty())
+ if (!input_element->suggestedValue().isEmpty())
return;
} else {
DCHECK(form_util::IsTextAreaElement(element));
@@ -670,12 +668,11 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
// Don't attempt to autofill with values that are too large or if filling
// criteria are not met.
WebString value = element.editingValue();
- if (!options.datalist_only &&
- (value.length() > kMaxDataLength ||
- (!options.autofill_on_empty_values && value.isEmpty()) ||
- (options.requires_caret_at_end &&
- (element.selectionStart() != element.selectionEnd() ||
- element.selectionEnd() != static_cast<int>(value.length()))))) {
+ if (value.length() > kMaxDataLength ||
+ (!options.autofill_on_empty_values && value.isEmpty()) ||
+ (options.requires_caret_at_end &&
+ (element.selectionStart() != element.selectionEnd() ||
+ element.selectionEnd() != static_cast<int>(value.length())))) {
// Any popup currently showing is obsolete.
HidePopup();
return;
@@ -701,12 +698,11 @@ void AutofillAgent::ShowSuggestions(const WebFormControlElement& element,
if (input_element && input_element->isPasswordField())
return;
- QueryAutofillSuggestions(element, options.datalist_only);
+ QueryAutofillSuggestions(element);
}
void AutofillAgent::QueryAutofillSuggestions(
- const WebFormControlElement& element,
- bool datalist_only) {
+ const WebFormControlElement& element) {
if (!element.document().frame())
return;
@@ -723,8 +719,6 @@ void AutofillAgent::QueryAutofillSuggestions(
// at providing suggestions.
WebFormControlElementToFormField(element, form_util::EXTRACT_VALUE, &field);
}
- if (datalist_only)
- field.should_autocomplete = false;
gfx::RectF bounding_box_scaled = form_util::GetScaledBoundingBox(
render_frame()->GetRenderView()->GetWebView()->pageScaleFactor(),
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698