summaryrefslogtreecommitdiffstats
path: root/chrome/browser/render_view_host.cc
diff options
context:
space:
mode:
authorpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-08 02:38:04 +0000
committerpetersont@google.com <petersont@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-08 02:38:04 +0000
commitf0961cfdecddaaac9c89fb65c67ba3377d066043 (patch)
tree61ad1f994b2130b8fbc67555d08319c14fa5793b /chrome/browser/render_view_host.cc
parentd893ab9643e5284db08087bc7514f59e37d6b319 (diff)
downloadchromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.zip
chromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.tar.gz
chromium_src-f0961cfdecddaaac9c89fb65c67ba3377d066043.tar.bz2
Review URL: http://codereview.chromium.org/10237
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5059 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_view_host.cc')
-rw-r--r--chrome/browser/render_view_host.cc38
1 files changed, 30 insertions, 8 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc
index d6b7f74..71c9574 100644
--- a/chrome/browser/render_view_host.cc
+++ b/chrome/browser/render_view_host.cc
@@ -1233,15 +1233,37 @@ void RenderViewHost::OnQueryFormFieldAutofill(const std::wstring& field_name,
const std::wstring& user_text,
int64 node_id,
int request_id) {
- delegate_->GetAutofillSuggestions(field_name, user_text, node_id, 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");
+ }
+
-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.
+ 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::NotifyRendererUnresponsive() {