diff options
author | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 21:35:03 +0000 |
---|---|---|
committer | jcampan@chromium.org <jcampan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-07 21:35:03 +0000 |
commit | 0ebf38756f3a68b30fe0d8e9336dbfafda52b5d5 (patch) | |
tree | a9ce0236b330fab3f39124c52fa0c1f184eb3965 /chrome/browser/render_view_host.cc | |
parent | 5e91242859811aef980a929253e6c33eb2cfec6e (diff) | |
download | chromium_src-0ebf38756f3a68b30fe0d8e9336dbfafda52b5d5.zip chromium_src-0ebf38756f3a68b30fe0d8e9336dbfafda52b5d5.tar.gz chromium_src-0ebf38756f3a68b30fe0d8e9336dbfafda52b5d5.tar.bz2 |
Landing this again as I cannot reproduce the perf regression locally.
Will investigate on the bot.
TBR=nsylvain
Review URL: http://codereview.chromium.org/9700
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/render_view_host.cc')
-rw-r--r-- | chrome/browser/render_view_host.cc | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/chrome/browser/render_view_host.cc b/chrome/browser/render_view_host.cc index 6c127a7..71c9574 100644 --- a/chrome/browser/render_view_host.cc +++ b/chrome/browser/render_view_host.cc @@ -696,6 +696,8 @@ void RenderViewHost::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK); IPC_MESSAGE_HANDLER(ViewHostMsg_UnloadListenerChanged, OnUnloadListenerChanged); + IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutofill, + OnQueryFormFieldAutofill) // Have the super handle all other messages. IPC_MESSAGE_UNHANDLED(RenderWidgetHost::OnMessageReceived(msg)) IPC_END_MESSAGE_MAP_EX() @@ -725,10 +727,11 @@ void RenderViewHost::OnMsgCreateWindow(int route_id, view->CreateNewWindow(route_id, modal_dialog_event); } -void RenderViewHost::OnMsgCreateWidget(int route_id) { +void RenderViewHost::OnMsgCreateWidget(int route_id, + bool focus_on_show) { RenderViewHostDelegate::View* view = delegate_->GetViewDelegate(); if (view) - view->CreateNewWidget(route_id); + view->CreateNewWidget(route_id, focus_on_show); } void RenderViewHost::OnMsgShowView(int route_id, @@ -1226,6 +1229,43 @@ void RenderViewHost::OnUnloadListenerChanged(bool has_listener) { has_unload_listener_ = has_listener; } +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"); + } + + + 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() { // If the debugger is attached, we're going to be unresponsive anytime it's // stopped at a breakpoint. |