diff options
author | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 02:13:09 +0000 |
---|---|---|
committer | petersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-08 02:13:09 +0000 |
commit | d893ab9643e5284db08087bc7514f59e37d6b319 (patch) | |
tree | 862077a3e8acbb010157f8c3bdd45e95d7e40ecb /chrome/browser/render_view_host.cc | |
parent | bab654788c013d4cdf3900fc43927e159362b5ed (diff) | |
download | chromium_src-d893ab9643e5284db08087bc7514f59e37d6b319.zip chromium_src-d893ab9643e5284db08087bc7514f59e37d6b319.tar.gz chromium_src-d893ab9643e5284db08087bc7514f59e37d6b319.tar.bz2 |
Entries in a form get recorded when the user submits the form. Database and pop-up menu talk to each other. Pop-up menu appears containing suggestions.
Review URL: http://codereview.chromium.org/9462
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5058 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_view_host.cc')
-rw-r--r-- | chrome/browser/render_view_host.cc | 38 |
1 files changed, 8 insertions, 30 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 71c9574..d6b7f74 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -1233,37 +1233,15 @@ void RenderViewHost::OnQueryFormFieldAutofill(const std::wstring& field_name, const std::wstring& user_text, int64 node_id, int request_id) { - // TODO(jcampan): this is where the suggestions should be queried from the - // database. The sample code commented below is left here in the meantime for - // testing purpose. -#ifndef TEST_AUTOFILL - static std::vector<std::wstring>* suggestions = NULL; - if (!suggestions) { - suggestions = new std::vector<std::wstring>(); - suggestions->push_back(L"Alice"); - suggestions->push_back(L"Jay"); - suggestions->push_back(L"Jason"); - suggestions->push_back(L"Jasmine"); - suggestions->push_back(L"Jamel"); - suggestions->push_back(L"Jamelo"); - suggestions->push_back(L"Volvo"); - suggestions->push_back(L"Volswagen"); - } - + delegate_->GetAutofillSuggestions(field_name, user_text, node_id, request_id); +} - std::vector<std::wstring> result; - for (std::vector<std::wstring>::iterator iter = suggestions->begin(); - iter != suggestions->end(); ++iter) { - if (StartsWith(*iter, user_text, false)) - result.push_back(*iter); - } - Send(new ViewMsg_AutofillSuggestions(routing_id_, - node_id, request_id, result, 0)); -#else - Send(new ViewMsg_AutofillSuggestions(routing_id_, - node_id, request_id, - std::vector<std::wstring>(), 0)); -#endif +void RenderViewHost::AutofillSuggestionsReturned( + const std::vector<std::wstring>& suggestions, + int64 node_id, int request_id, int default_suggestion_index) { + Send(new ViewMsg_AutofillSuggestions(routing_id_, node_id, + request_id, suggestions, -1)); + // Default index -1 means no default suggestion. } void RenderViewHost::NotifyRendererUnresponsive() { |