diff options
author | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:50:58 +0000 |
---|---|---|
committer | dhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-07 17:50:58 +0000 |
commit | 33bd60f508a0eaa7ddfefb497b35c1627a6ff0be (patch) | |
tree | 5ccf0d1a06ce8faa8d8bba5dca828ba6485cb4bc /webkit | |
parent | 3acdf835f850997396ef30c61688a9a2f55fb594 (diff) | |
download | chromium_src-33bd60f508a0eaa7ddfefb497b35c1627a6ff0be.zip chromium_src-33bd60f508a0eaa7ddfefb497b35c1627a6ff0be.tar.gz chromium_src-33bd60f508a0eaa7ddfefb497b35c1627a6ff0be.tar.bz2 |
Autocomplete and AutoFill entries are shown combined in the suggestions popup.
These changes merge popup menu suggestions for Autocomplete and AutoFill. Suggestions are collected from both sources and returned to the renderer as a single list. This combined list is given to WebKit to display in the suggestions popup. When the user selects an item in the popup the appropriate result gets filled in the fields.
BUG=41328
TEST=AutoFillManagerTest.*
Review URL: http://codereview.chromium.org/2878020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51736 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webpasswordautocompletelistener_impl.cc | 19 | ||||
-rw-r--r-- | webkit/glue/webpasswordautocompletelistener_impl.h | 3 |
2 files changed, 14 insertions, 8 deletions
diff --git a/webkit/glue/webpasswordautocompletelistener_impl.cc b/webkit/glue/webpasswordautocompletelistener_impl.cc index 8791c80..a1ea755 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.cc +++ b/webkit/glue/webpasswordautocompletelistener_impl.cc @@ -54,12 +54,19 @@ void WebInputElementDelegate::SetSelectionRange(size_t start, size_t end) { } void WebInputElementDelegate::RefreshAutofillPopup( - const std::vector<string16>& suggestions, - int default_suggestion_index) { + const std::vector<string16>& suggestions) { WebView* webview = element_.document().frame()->view(); - if (webview) - webview->applyAutocompleteSuggestions(element_, suggestions, - default_suggestion_index); + if (webview) { + std::vector<string16> names; + std::vector<string16> labels; + + for (size_t i = 0; i < suggestions.size(); ++i) { + names.push_back(suggestions[i]); + labels.push_back(string16()); + } + + webview->applyAutoFillSuggestions(element_, names, labels, -1); + } } WebPasswordAutocompleteListenerImpl::WebPasswordAutocompleteListenerImpl( @@ -151,7 +158,7 @@ bool WebPasswordAutocompleteListenerImpl::showSuggestionPopup( if (suggestions.empty()) return false; - username_delegate_->RefreshAutofillPopup(suggestions, -1); + username_delegate_->RefreshAutofillPopup(suggestions); return true; } diff --git a/webkit/glue/webpasswordautocompletelistener_impl.h b/webkit/glue/webpasswordautocompletelistener_impl.h index 0c37b89e..ca4604b 100644 --- a/webkit/glue/webpasswordautocompletelistener_impl.h +++ b/webkit/glue/webpasswordautocompletelistener_impl.h @@ -34,8 +34,7 @@ class WebInputElementDelegate { virtual bool IsAutofilled() const; virtual void SetAutofilled(bool autofilled); virtual void SetSelectionRange(size_t start, size_t end); - virtual void RefreshAutofillPopup(const std::vector<string16>& suggestions, - int default_suggestion_index); + virtual void RefreshAutofillPopup(const std::vector<string16>& suggestions); private: // The underlying DOM element we're wrapping. |