diff options
author | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 08:28:21 +0000 |
---|---|---|
committer | csharp@chromium.org <csharp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-26 08:28:21 +0000 |
commit | 45a07944f41929553254bdb13a823d259c4093d3 (patch) | |
tree | 1dbe4d433fcb96f27449d2b09db96d2667439be7 /components | |
parent | b2b71dbe4babd5337b536df85784530f79c6cf32 (diff) | |
download | chromium_src-45a07944f41929553254bdb13a823d259c4093d3.zip chromium_src-45a07944f41929553254bdb13a823d259c4093d3.tar.gz chromium_src-45a07944f41929553254bdb13a823d259c4093d3.tar.bz2 |
[Autofill] Remove the last sections of the old Autofill UI code.
All the remaining code in autofill_agent.cc is needed by the new UI,
to handle the interactions between the browser and renderer process.
TBR=jschuh@chromium.org
BUG=255625
Review URL: https://chromiumcodereview.appspot.com/19647010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213798 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
4 files changed, 7 insertions, 79 deletions
diff --git a/components/autofill/content/browser/autofill_driver_impl.cc b/components/autofill/content/browser/autofill_driver_impl.cc index a603e15..930eaa6 100644 --- a/components/autofill/content/browser/autofill_driver_impl.cc +++ b/components/autofill/content/browser/autofill_driver_impl.cc @@ -172,9 +172,6 @@ bool AutofillDriverImpl::OnMessageReceived(const IPC::Message& message) { IPC_MESSAGE_FORWARD(AutofillHostMsg_DidFillAutofillFormData, autofill_manager_.get(), AutofillManager::OnDidFillAutofillFormData) - IPC_MESSAGE_FORWARD(AutofillHostMsg_DidShowAutofillSuggestions, - autofill_manager_.get(), - AutofillManager::OnDidShowAutofillSuggestions) IPC_MESSAGE_FORWARD(AutofillHostMsg_DidEndTextFieldEditing, autofill_manager_.get(), AutofillManager::OnDidEndTextFieldEditing) diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc index a818184..f61902f 100644 --- a/components/autofill/content/renderer/autofill_agent.cc +++ b/components/autofill/content/renderer/autofill_agent.cc @@ -65,11 +65,12 @@ const size_t kMaximumDataListSizeForAutofill = 30; const int kAutocheckoutClickTimeout = 3; -void AppendDataListSuggestions(const WebKit::WebInputElement& element, - std::vector<base::string16>* values, - std::vector<base::string16>* labels, - std::vector<base::string16>* icons, - std::vector<int>* item_ids) { + +// Gets all the data list values (with corresponding label) for the given +// element. +void GetDataListSuggestions(const WebKit::WebInputElement& element, + std::vector<base::string16>* values, + std::vector<base::string16>* labels) { WebNodeCollection options = element.dataListOptions(); if (options.isNull()) return; @@ -94,8 +95,6 @@ void AppendDataListSuggestions(const WebKit::WebInputElement& element, labels->push_back(option.label()); else labels->push_back(base::string16()); - icons->push_back(base::string16()); - item_ids->push_back(WebAutofillClient::MenuItemIDDataListEntry); } } @@ -429,54 +428,6 @@ void AutofillAgent::textFieldDidReceiveKeyDown(const WebInputElement& element, ShowSuggestions(element, true, true, true); } -void AutofillAgent::CombineDataListEntriesAndShow( - const WebKit::WebInputElement& element, - const std::vector<base::string16>& values, - const std::vector<base::string16>& labels, - const std::vector<base::string16>& icons, - const std::vector<int>& item_ids, - bool has_autofill_item) { - std::vector<base::string16> v; - std::vector<base::string16> l; - std::vector<base::string16> i; - std::vector<int> ids; - - AppendDataListSuggestions(element, &v, &l, &i, &ids); - - // If there are both <datalist> items and Autofill suggestions, add a - // separator between them. - if (!v.empty() && !values.empty()) { - v.push_back(base::string16()); - l.push_back(base::string16()); - i.push_back(base::string16()); - ids.push_back(WebAutofillClient::MenuItemIDSeparator); - } - - // Append the Autofill suggestions. - v.insert(v.end(), values.begin(), values.end()); - l.insert(l.end(), labels.begin(), labels.end()); - i.insert(i.end(), icons.begin(), icons.end()); - ids.insert(ids.end(), item_ids.begin(), item_ids.end()); - - if (v.empty()) { - // No suggestions, any popup currently showing is obsolete. - HideAutofillUI(); - return; - } - - WebKit::WebView* web_view = render_view()->GetWebView(); - if (!web_view) - return; - - // Send to WebKit for display. - web_view->applyAutofillSuggestions(element, v, l, i, ids); - - Send(new AutofillHostMsg_DidShowAutofillSuggestions( - routing_id(), - has_autofill_item && !has_shown_autofill_popup_for_current_edit_)); - has_shown_autofill_popup_for_current_edit_ |= has_autofill_item; -} - void AutofillAgent::AcceptDataListSuggestion( const base::string16& suggested_value) { base::string16 new_value = suggested_value; @@ -741,14 +692,7 @@ void AutofillAgent::QueryAutofillSuggestions(const WebInputElement& element, // Find the datalist values and send them to the browser process. std::vector<base::string16> data_list_values; std::vector<base::string16> data_list_labels; - std::vector<base::string16> data_list_icons; - std::vector<int> data_list_unique_ids; - // TODO(csharp): Stop passing in icon and unique id vectors. - AppendDataListSuggestions(element_, - &data_list_values, - &data_list_labels, - &data_list_icons, - &data_list_unique_ids); + GetDataListSuggestions(element_, &data_list_values, &data_list_labels); TrimStringVectorForIPC(&data_list_values); TrimStringVectorForIPC(&data_list_labels); diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h index 5f34029..319b3aa 100644 --- a/components/autofill/content/renderer/autofill_agent.h +++ b/components/autofill/content/renderer/autofill_agent.h @@ -163,15 +163,6 @@ class AutofillAgent : public content::RenderViewObserver, void QueryAutofillSuggestions(const WebKit::WebInputElement& element, bool display_warning_if_disabled); - // Combines DataList suggestion entries with the autofill ones and show them - // to the user. - void CombineDataListEntriesAndShow(const WebKit::WebInputElement& element, - const std::vector<base::string16>& values, - const std::vector<base::string16>& labels, - const std::vector<base::string16>& icons, - const std::vector<int>& item_ids, - bool has_autofill_item); - // Sets the element value to reflect the selected |suggested_value|. void AcceptDataListSuggestion(const base::string16& suggested_value); diff --git a/components/autofill/core/common/autofill_messages.h b/components/autofill/core/common/autofill_messages.h index db7ce28..5fa5ead 100644 --- a/components/autofill/core/common/autofill_messages.h +++ b/components/autofill/core/common/autofill_messages.h @@ -229,10 +229,6 @@ IPC_MESSAGE_ROUTED5(AutofillHostMsg_QueryFormFieldAutofill, gfx::RectF /* input field bounds, window-relative */, bool /* display warning if autofill disabled */) -// Sent when the popup with Autofill suggestions for a form is shown. -IPC_MESSAGE_ROUTED1(AutofillHostMsg_DidShowAutofillSuggestions, - bool /* is this a new popup? */) - // Instructs the browser to fill in the values for a form using Autofill // profile data. IPC_MESSAGE_ROUTED4(AutofillHostMsg_FillAutofillFormData, |