diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/autofill_messages.cc | 104 | ||||
-rw-r--r-- | chrome/common/autofill_messages.h | 125 | ||||
-rw-r--r-- | chrome/common/render_messages.cc | 111 | ||||
-rw-r--r-- | chrome/common/render_messages.h | 30 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 74 |
5 files changed, 239 insertions, 205 deletions
diff --git a/chrome/common/autofill_messages.cc b/chrome/common/autofill_messages.cc new file mode 100644 index 0000000..80b43f3 --- /dev/null +++ b/chrome/common/autofill_messages.cc @@ -0,0 +1,104 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/common_param_traits.h" +#include "webkit/glue/form_data.h" +#include "webkit/glue/form_field.h" +#include "webkit/glue/password_form.h" +#include "webkit/glue/password_form_dom_manager.h" + +#define IPC_MESSAGE_IMPL +#include "chrome/common/autofill_messages.h" + +namespace IPC { + +void ParamTraits<webkit_glue::FormField>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.label()); + WriteParam(m, p.name()); + WriteParam(m, p.value()); + WriteParam(m, p.form_control_type()); + WriteParam(m, p.max_length()); + WriteParam(m, p.is_autofilled()); + WriteParam(m, p.option_strings()); +} + +bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, + param_type* p) { + string16 label, name, value, form_control_type; + int max_length = 0; + bool is_autofilled; + std::vector<string16> options; + bool result = ReadParam(m, iter, &label); + result = result && ReadParam(m, iter, &name); + result = result && ReadParam(m, iter, &value); + result = result && ReadParam(m, iter, &form_control_type); + result = result && ReadParam(m, iter, &max_length); + result = result && ReadParam(m, iter, &is_autofilled); + result = result && ReadParam(m, iter, &options); + if (!result) + return false; + + p->set_label(label); + p->set_name(name); + p->set_value(value); + p->set_form_control_type(form_control_type); + p->set_max_length(max_length); + p->set_autofilled(is_autofilled); + p->set_option_strings(options); + return true; +} + +void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, + std::string* l) { + l->append("<FormField>"); +} + +void ParamTraits<webkit_glue::FormData>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.method); + WriteParam(m, p.origin); + WriteParam(m, p.action); + WriteParam(m, p.user_submitted); + WriteParam(m, p.fields); +} + +bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->method) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->action) && + ReadParam(m, iter, &p->user_submitted) && + ReadParam(m, iter, &p->fields); +} + +void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, + std::string* l) { + l->append("<FormData>"); +} + +void ParamTraits<webkit_glue::PasswordFormFillData>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.basic_data); + WriteParam(m, p.additional_logins); + WriteParam(m, p.wait_for_username); +} + +bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( + const Message* m, void** iter, param_type* r) { + return + ReadParam(m, iter, &r->basic_data) && + ReadParam(m, iter, &r->additional_logins) && + ReadParam(m, iter, &r->wait_for_username); +} + +void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, + std::string* l) { + l->append("<PasswordFormFillData>"); +} + +} // namespace IPC diff --git a/chrome/common/autofill_messages.h b/chrome/common/autofill_messages.h new file mode 100644 index 0000000..4e2f9bc --- /dev/null +++ b/chrome/common/autofill_messages.h @@ -0,0 +1,125 @@ +// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_AUTOFILL_MESSAGES_H_ +#define CHROME_COMMON_AUTOFILL_MESSAGES_H_ +#pragma once + +#include <string> + +#include "ipc/ipc_message_macros.h" + +#define IPC_MESSAGE_START AutoFillMsgStart + +namespace webkit_glue { +class FormField; +struct FormData; +struct PasswordForm; +struct PasswordFormFillData; +} + +namespace IPC { + +template <> +struct ParamTraits<webkit_glue::FormField> { + typedef webkit_glue::FormField param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + + +// Traits for FormData structure to pack/unpack. +template <> +struct ParamTraits<webkit_glue::FormData> { + typedef webkit_glue::FormData param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits<webkit_glue::PasswordFormFillData> { + typedef webkit_glue::PasswordFormFillData param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +// AutoFill messages sent from the browser to the renderer. + +// Reply to the AutoFillHostMsg_QueryFormFieldAutoFill message with the +// AutoFill suggestions. +IPC_MESSAGE_ROUTED5(AutoFillMsg_SuggestionsReturned, + int /* id of the request message */, + std::vector<string16> /* names */, + std::vector<string16> /* labels */, + std::vector<string16> /* icons */, + std::vector<int> /* unique_ids */) + +// Reply to the AutoFillHostMsg_FillAutoFillFormData message with the +// AutoFill form data. +IPC_MESSAGE_ROUTED2(AutoFillMsg_FormDataFilled, + int /* id of the request message */, + webkit_glue::FormData /* form data */) + +// Fill a password form and prepare field autocomplete for multiple +// matching logins. +IPC_MESSAGE_ROUTED1(AutoFillMsg_FillPasswordForm, + webkit_glue::PasswordFormFillData) + + +// AutoFill messages sent from the renderer to the browser. + +// Notification that forms have been seen that are candidates for +// filling/submitting by the AutoFillManager. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_FormsSeen, + std::vector<webkit_glue::FormData> /* forms */) + +// Notification that password forms have been seen that are candidates for +// filling/submitting by the password manager. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_PasswordFormsFound, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that initial layout has occurred and the following password +// forms are visible on the page (e.g. not set to display:none.) +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_PasswordFormsVisible, + std::vector<webkit_glue::PasswordForm> /* forms */) + +// Notification that a form has been submitted. The user hit the button. +IPC_MESSAGE_ROUTED1(AutoFillHostMsg_FormSubmitted, + webkit_glue::FormData /* form */) + +// Queries the browser for AutoFill suggestions for a form input field. +IPC_MESSAGE_ROUTED3(AutoFillHostMsg_QueryFormFieldAutoFill, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */) + +// Sent when the popup with AutoFill suggestions for a form is shown. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_DidShowAutoFillSuggestions) + +// Instructs the browser to fill in the values for a form using AutoFill +// profile data. +IPC_MESSAGE_ROUTED4(AutoFillHostMsg_FillAutoFillFormData, + int /* id of this message */, + webkit_glue::FormData /* the form */, + webkit_glue::FormField /* the form field */, + int /* profile unique ID */) + +// Sent when a form is previewed or filled with AutoFill suggestions. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_DidFillAutoFillFormData) + +// Instructs the browser to remove the specified Autocomplete entry from the +// database. +IPC_MESSAGE_ROUTED2(AutoFillHostMsg_RemoveAutocompleteEntry, + string16 /* field name */, + string16 /* value */) + +// Instructs the browser to show the AutoFill dialog. +IPC_MESSAGE_ROUTED0(AutoFillHostMsg_ShowAutoFillDialog) + +#endif // CHROME_COMMON_AUTOFILL_MESSAGES_H_ diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index bab7445..d872fec 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -20,8 +20,6 @@ #include "third_party/skia/include/core/SkBitmap.h" #include "webkit/appcache/appcache_interfaces.h" #include "webkit/blob/blob_data.h" -#include "webkit/glue/form_field.h" -#include "webkit/glue/password_form.h" #include "webkit/glue/resource_loader_bridge.h" #include "webkit/glue/webaccessibility.h" #include "webkit/glue/webcookie.h" @@ -71,49 +69,6 @@ struct ParamTraits<WebMenuItem::Type> { } }; - -void ParamTraits<webkit_glue::FormField>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.label()); - WriteParam(m, p.name()); - WriteParam(m, p.value()); - WriteParam(m, p.form_control_type()); - WriteParam(m, p.max_length()); - WriteParam(m, p.is_autofilled()); - WriteParam(m, p.option_strings()); -} - -bool ParamTraits<webkit_glue::FormField>::Read(const Message* m, void** iter, - param_type* p) { - string16 label, name, value, form_control_type; - int max_length = 0; - bool is_autofilled; - std::vector<string16> options; - bool result = ReadParam(m, iter, &label); - result = result && ReadParam(m, iter, &name); - result = result && ReadParam(m, iter, &value); - result = result && ReadParam(m, iter, &form_control_type); - result = result && ReadParam(m, iter, &max_length); - result = result && ReadParam(m, iter, &is_autofilled); - result = result && ReadParam(m, iter, &options); - if (!result) - return false; - - p->set_label(label); - p->set_name(name); - p->set_value(value); - p->set_form_control_type(form_control_type); - p->set_max_length(max_length); - p->set_autofilled(is_autofilled); - p->set_option_strings(options); - return true; -} - -void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, - std::string* l) { - l->append("<FormField>"); -} - #if defined(OS_MACOSX) void ParamTraits<FontDescriptor>::Write(Message* m, const param_type& p) { WriteParam(m, p.font_name); @@ -299,26 +254,6 @@ void ParamTraits<webkit::npapi::WebPluginInfo>::Log(const param_type& p, l->append(")"); } -void ParamTraits<webkit_glue::PasswordFormFillData>::Write( - Message* m, const param_type& p) { - WriteParam(m, p.basic_data); - WriteParam(m, p.additional_logins); - WriteParam(m, p.wait_for_username); -} - -bool ParamTraits<webkit_glue::PasswordFormFillData>::Read( - const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->basic_data) && - ReadParam(m, iter, &r->additional_logins) && - ReadParam(m, iter, &r->wait_for_username); -} - -void ParamTraits<webkit_glue::PasswordFormFillData>::Log(const param_type& p, - std::string* l) { - l->append("<PasswordFormFillData>"); -} - void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( Message* m, const param_type& p) { WriteParam(m, p.get() != NULL); @@ -563,48 +498,22 @@ void ParamTraits<ResourceResponseHead>::Log(const param_type& p, } void ParamTraits<SyncLoadResult>::Write(Message* m, const param_type& p) { - ParamTraits<ResourceResponseHead>::Write(m, p); - WriteParam(m, p.final_url); - WriteParam(m, p.data); - } + ParamTraits<ResourceResponseHead>::Write(m, p); + WriteParam(m, p.final_url); + WriteParam(m, p.data); +} bool ParamTraits<SyncLoadResult>::Read(const Message* m, void** iter, param_type* r) { - return - ParamTraits<ResourceResponseHead>::Read(m, iter, r) && - ReadParam(m, iter, &r->final_url) && - ReadParam(m, iter, &r->data); - } - -void ParamTraits<SyncLoadResult>::Log(const param_type& p, std::string* l) { - // log more? - ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); - } - -void ParamTraits<webkit_glue::FormData>::Write(Message* m, - const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.method); - WriteParam(m, p.origin); - WriteParam(m, p.action); - WriteParam(m, p.user_submitted); - WriteParam(m, p.fields); -} - -bool ParamTraits<webkit_glue::FormData>::Read(const Message* m, void** iter, - param_type* p) { return - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->method) && - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->action) && - ReadParam(m, iter, &p->user_submitted) && - ReadParam(m, iter, &p->fields); + ParamTraits<ResourceResponseHead>::Read(m, iter, r) && + ReadParam(m, iter, &r->final_url) && + ReadParam(m, iter, &r->data); } -void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, - std::string* l) { - l->append("<FormData>"); +void ParamTraits<SyncLoadResult>::Log(const param_type& p, std::string* l) { + // log more? + ParamTraits<webkit_glue::ResourceResponseInfo>::Log(p, l); } void ParamTraits<RendererPreferences>::Write(Message* m, const param_type& p) { diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 8cc75ff..f0ce905 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -49,9 +49,6 @@ class BlobData; } namespace webkit_glue { -struct FormData; -class FormField; -struct PasswordFormFillData; struct ResourceDevToolsInfo; struct ResourceLoadTimingInfo; struct ResourceResponseInfo; @@ -136,15 +133,6 @@ enum ViewHostMsg_JavaScriptStressTestControl_Commands { namespace IPC { -// Traits for FormField_Params structure to pack/unpack. -template <> -struct ParamTraits<webkit_glue::FormField> { - typedef webkit_glue::FormField param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - #if defined(OS_MACOSX) // Traits for FontDescriptor structure to pack/unpack. template <> @@ -189,15 +177,6 @@ struct ParamTraits<webkit::npapi::WebPluginInfo> { static void Log(const param_type& p, std::string* l); }; -// Traits for webkit_glue::PasswordFormDomManager::FillData. -template <> -struct ParamTraits<webkit_glue::PasswordFormFillData> { - typedef webkit_glue::PasswordFormFillData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - template <> struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { typedef scoped_refptr<net::HttpResponseHeaders> param_type; @@ -248,15 +227,6 @@ struct ParamTraits<SyncLoadResult> { static void Log(const param_type& p, std::string* l); }; -// Traits for FormData structure to pack/unpack. -template <> -struct ParamTraits<webkit_glue::FormData> { - typedef webkit_glue::FormData param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - // Traits for reading/writing CSS Colors template <> struct ParamTraits<CSSColors::CSSColorName> { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index b93e606..6d331d0 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -27,8 +27,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebScreenInfo.h" #include "webkit/glue/context_menu.h" -#include "webkit/glue/form_data.h" -#include "webkit/glue/password_form_dom_manager.h" #include "webkit/glue/webdropdata.h" #include "webkit/plugins/npapi/webplugininfo.h" @@ -465,15 +463,6 @@ IPC_MESSAGE_ROUTED0(ViewMsg_ResetPageEncodingToDefault) IPC_MESSAGE_ROUTED1(ViewMsg_ReservePageIDRange, int /* size_of_range */) -// Fill a form with data and optionally submit it -IPC_MESSAGE_ROUTED1(ViewMsg_FormFill, - webkit_glue::FormData /* form */) - -// Fill a password form and prepare field autocomplete for multiple -// matching logins. -IPC_MESSAGE_ROUTED1(ViewMsg_FillPasswordForm, - webkit_glue::PasswordFormFillData) - // D&d drop target messages. IPC_MESSAGE_ROUTED4(ViewMsg_DragTargetDragEnter, WebDropData /* drop_data */, @@ -699,21 +688,6 @@ IPC_MESSAGE_CONTROL2(AppCacheMsg_ContentBlocked, int /* host_id */, GURL /* manifest_url */) -// Reply to the ViewHostMsg_QueryFormFieldAutoFill message with the -// AutoFill suggestions. -IPC_MESSAGE_ROUTED5(ViewMsg_AutoFillSuggestionsReturned, - int /* id of the request message */, - std::vector<string16> /* names */, - std::vector<string16> /* labels */, - std::vector<string16> /* icons */, - std::vector<int> /* unique_ids */) - -// Reply to the ViewHostMsg_FillAutoFillFormData message with the -// AutoFill form data. -IPC_MESSAGE_ROUTED2(ViewMsg_AutoFillFormDataFilled, - int /* id of the request message */, - webkit_glue::FormData /* form data */) - // Sent by the Browser process to alert a window about whether a it should // allow a scripted window.close(). The renderer assumes every new window is a // blocked popup until notified otherwise. @@ -1664,25 +1638,6 @@ IPC_MESSAGE_ROUTED1(ViewHostMsg_SelectionChanged, IPC_MESSAGE_ROUTED1(ViewHostMsg_RunFileChooser, ViewHostMsg_RunFileChooser_Params) -// Notification that forms have been seen that are candidates for -// filling/submitting by the AutoFillManager. -IPC_MESSAGE_ROUTED1(ViewHostMsg_FormsSeen, - std::vector<webkit_glue::FormData> /* forms */) - -// Notification that password forms have been seen that are candidates for -// filling/submitting by the password manager. -IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsFound, - std::vector<webkit_glue::PasswordForm> /* forms */) - -// Notification that initial layout has occurred and the following password -// forms are visible on the page (e.g. not set to display:none.) -IPC_MESSAGE_ROUTED1(ViewHostMsg_PasswordFormsVisible, - std::vector<webkit_glue::PasswordForm> /* forms */) - -// Notification that a form has been submitted. The user hit the button. -IPC_MESSAGE_ROUTED1(ViewHostMsg_FormSubmitted, - webkit_glue::FormData /* 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 @@ -2027,35 +1982,6 @@ IPC_SYNC_MESSAGE_CONTROL1_1(AppCacheMsg_GetResourceList, std::vector<appcache::AppCacheResourceInfo> /* resources out */) -// Queries the browser for AutoFill suggestions for a form input field. -IPC_MESSAGE_ROUTED3(ViewHostMsg_QueryFormFieldAutoFill, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */) - -// Sent when the popup with AutoFill suggestions for a form is shown. -IPC_MESSAGE_ROUTED0(ViewHostMsg_DidShowAutoFillSuggestions) - -// Instructs the browser to fill in the values for a form using AutoFill -// profile data. -IPC_MESSAGE_ROUTED4(ViewHostMsg_FillAutoFillFormData, - int /* id of this message */, - webkit_glue::FormData /* the form */, - webkit_glue::FormField /* the form field */, - int /* profile unique ID */) - -// Sent when a form is previewed or filled with AutoFill suggestions. -IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFillAutoFillFormData) - -// Instructs the browser to remove the specified Autocomplete entry from the -// database. -IPC_MESSAGE_ROUTED2(ViewHostMsg_RemoveAutocompleteEntry, - string16 /* field name */, - string16 /* value */) - -// Instructs the browser to show the AutoFill dialog. -IPC_MESSAGE_ROUTED0(ViewHostMsg_ShowAutoFillDialog) - // Get the list of proxies to use for |url|, as a semicolon delimited list // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also // PluginProcessHostMsg_ResolveProxy which does the same thing. |