Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2376)

Unified Diff: chrome/browser/render_view_host.cc

Issue 8885: Implementation of the UI part of the autofill (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/render_view_host.h ('k') | chrome/browser/render_view_host_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/render_view_host.cc
===================================================================
--- chrome/browser/render_view_host.cc (revision 4621)
+++ chrome/browser/render_view_host.cc (working copy)
@@ -680,6 +680,8 @@
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()
@@ -709,10 +711,11 @@
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,
@@ -1203,6 +1206,43 @@
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 (is_waiting_for_unload_ack_ &&
!Singleton<CrossSiteRequestManager>()->HasPendingCrossSiteRequest(
« no previous file with comments | « chrome/browser/render_view_host.h ('k') | chrome/browser/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698