From 6f2ff8526c54090bf6afe9c80f2d63551231e997 Mon Sep 17 00:00:00 2001 From: "petersont@google.com" Date: Wed, 5 Nov 2008 20:26:28 +0000 Subject: Added functions to WebDatabase and WebDataService for recording frequent entries in text input elements in forms. Also added the class AutofillManager which gets instantiated once per WebContents and provides an API from which the database can be easily accessed to provide a list of possible desired values to be entered in a text field given what the user has already typed there. Review URL: http://codereview.chromium.org/8845 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4809 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/common/render_messages.h | 33 ++++++++++++++++++++++++++++++++ chrome/common/render_messages_internal.h | 4 ++++ 2 files changed, 37 insertions(+) (limited to 'chrome/common') diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index fbc1798..d50faa6 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -7,6 +7,7 @@ #include #include +#include #include "base/basictypes.h" #include "base/ref_counted.h" @@ -18,6 +19,7 @@ #include "googleurl/src/gurl.h" #include "net/base/upload_data.h" #include "net/url_request/url_request_status.h" +#include "webkit/glue/autofill_form.h" #include "webkit/glue/cache_manager.h" #include "webkit/glue/context_node_types.h" #include "webkit/glue/form_data.h" @@ -823,6 +825,37 @@ struct ParamTraits { } }; +// Traits for AutofillForm_Params structure to pack/unpack. +template <> +struct ParamTraits { + typedef AutofillForm param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.elements.size()); + for (std::vector::const_iterator itr = + p.elements.begin(); + itr != p.elements.end(); + itr++) { + WriteParam(m, itr->name); + WriteParam(m, itr->value); + } + } + static bool Read(const Message* m, void** iter, param_type* p) { + bool result = true; + size_t elements_size = 0; + result = result && ReadParam(m, iter, &elements_size); + p->elements.resize(elements_size); + for (size_t i = 0; i < elements_size; i++) { + std::wstring s; + result = result && ReadParam(m, iter, &(p->elements[i].name)); + result = result && ReadParam(m, iter, &(p->elements[i].value)); + } + return result; + } + static void Log(const param_type& p, std::wstring* l) { + l->append(L""); + } +}; + // Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack. template <> struct ParamTraits { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 4e7e3dc..286b2e5 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -838,6 +838,10 @@ IPC_BEGIN_MESSAGES(ViewHost, 2) IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsSeen, std::vector /* forms */) + // Notification that a form has been submitted. The user hit the button. + IPC_MESSAGE_ROUTED1(ViewHostMsg_AutofillFormSubmitted, + AutofillForm /* form */) + // Used to tell the parent the user started dragging in the content area. The // WebDropData struct contains contextual information about the pieces of the // page the user dragged. The parent uses this notification to initiate a -- cgit v1.1