diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 17:48:54 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-12 17:48:54 +0000 |
commit | 996e88a555b61046bfd3bb719042da05f6b68976 (patch) | |
tree | a5fdada9bb2ce14692fc862edb52d5a222ebebdc | |
parent | df24c66010e79acddad6e9b0d82a7ebc1285a2b0 (diff) | |
download | chromium_src-996e88a555b61046bfd3bb719042da05f6b68976.zip chromium_src-996e88a555b61046bfd3bb719042da05f6b68976.tar.gz chromium_src-996e88a555b61046bfd3bb719042da05f6b68976.tar.bz2 |
FBTF: Remove all the easy headers from *_messages.h.
BUG=51411
TEST=compiles
Review URL: http://codereview.chromium.org/3174002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55902 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 1200 insertions, 916 deletions
diff --git a/chrome/browser/extensions/extension_messages_unittest.cc b/chrome/browser/extensions/extension_messages_unittest.cc index b90e92f..3b3c273 100644 --- a/chrome/browser/extensions/extension_messages_unittest.cc +++ b/chrome/browser/extensions/extension_messages_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/values.h" #include "chrome/browser/extensions/extension_message_service.h" #include "chrome/common/render_messages.h" #include "chrome/renderer/extensions/event_bindings.h" diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index a9af09a..e2a7fba 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -18,6 +18,7 @@ #include "app/app_switches.h" #include "base/command_line.h" #include "base/field_trial.h" +#include "base/histogram.h" #include "base/logging.h" #include "base/stl_util-inl.h" #include "base/string_util.h" diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index b957d28..644d116 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -43,8 +43,12 @@ #include "net/base/net_util.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "webkit/glue/context_menu.h" +#include "webkit/glue/dom_operations.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" +#include "webkit/glue/password_form_dom_manager.h" +#include "webkit/glue/webdropdata.h" #if defined(OS_WIN) // TODO(port): accessibility not yet implemented. See http://crbug.com/8288. diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc index 556e654..9960b63 100644 --- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc +++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc @@ -22,6 +22,7 @@ #include "app/x11_util.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/histogram.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" #include "base/task.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index 29e15d9..a3ceea1 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -61,6 +61,7 @@ #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/base/ssl_cert_request_info.h" +#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" #include "webkit/appcache/appcache_interceptor.h" diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index c123007..12c8021 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -85,8 +85,10 @@ #include "net/http/http_transaction_factory.h" #include "net/url_request/url_request_context.h" #include "third_party/WebKit/WebKit/chromium/public/WebNotificationPresenter.h" +#include "webkit/glue/context_menu.h" #include "webkit/glue/plugins/plugin_list.h" #include "webkit/glue/plugins/webplugin.h" +#include "webkit/glue/webcookie.h" #include "webkit/glue/webkit_glue.h" using WebKit::WebCache; diff --git a/chrome/browser/renderer_host/sync_resource_handler.cc b/chrome/browser/renderer_host/sync_resource_handler.cc index 235a22f..6b21697 100644 --- a/chrome/browser/renderer_host/sync_resource_handler.cc +++ b/chrome/browser/renderer_host/sync_resource_handler.cc @@ -3,8 +3,10 @@ // found in the LICENSE file. #include "chrome/browser/renderer_host/sync_resource_handler.h" + #include "base/logging.h" #include "chrome/common/render_messages.h" +#include "net/http/http_response_headers.h"
SyncResourceHandler::SyncResourceHandler( ResourceDispatcherHost::Receiver* receiver, diff --git a/chrome/browser/visitedlink_event_listener.cc b/chrome/browser/visitedlink_event_listener.cc index 9003fcc..ad43ba0 100644 --- a/chrome/browser/visitedlink_event_listener.cc +++ b/chrome/browser/visitedlink_event_listener.cc @@ -6,7 +6,6 @@ #include "base/shared_memory.h" #include "chrome/browser/renderer_host/render_process_host.h" -#include "chrome/common/render_messages.h" using base::Time; using base::TimeDelta; diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index e655435..d6eb2cc 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -407,6 +407,45 @@ void ParamTraits<Geoposition>::Log(const Geoposition& p, std::wstring* l) { LogParam(p.error_code, l); } +void ParamTraits<webkit_glue::PasswordForm>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.signon_realm); + WriteParam(m, p.origin); + WriteParam(m, p.action); + WriteParam(m, p.submit_element); + WriteParam(m, p.username_element); + WriteParam(m, p.username_value); + WriteParam(m, p.password_element); + WriteParam(m, p.password_value); + WriteParam(m, p.old_password_element); + WriteParam(m, p.old_password_value); + WriteParam(m, p.ssl_valid); + WriteParam(m, p.preferred); + WriteParam(m, p.blacklisted_by_user); +} + +bool ParamTraits<webkit_glue::PasswordForm>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->signon_realm) && + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->action) && + ReadParam(m, iter, &p->submit_element) && + ReadParam(m, iter, &p->username_element) && + ReadParam(m, iter, &p->username_value) && + ReadParam(m, iter, &p->password_element) && + ReadParam(m, iter, &p->password_value) && + ReadParam(m, iter, &p->old_password_element) && + ReadParam(m, iter, &p->old_password_value) && + ReadParam(m, iter, &p->ssl_valid) && + ReadParam(m, iter, &p->preferred) && + ReadParam(m, iter, &p->blacklisted_by_user); +} +void ParamTraits<webkit_glue::PasswordForm>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<PasswordForm>"); +} + void ParamTraits<printing::PageRange>::Write(Message* m, const param_type& p) { WriteParam(m, p.from); WriteParam(m, p.to); diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index f39c066..4df6536 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -23,7 +23,6 @@ #include "net/base/upload_data.h" #include "net/url_request/url_request_status.h" #include "printing/native_metafile.h" -#include "webkit/glue/password_form.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/window_open_disposition.h" @@ -369,49 +368,16 @@ struct ParamTraits<Geoposition::ErrorCode> { template <> struct ParamTraits<webkit_glue::PasswordForm> { typedef webkit_glue::PasswordForm param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.signon_realm); - WriteParam(m, p.origin); - WriteParam(m, p.action); - WriteParam(m, p.submit_element); - WriteParam(m, p.username_element); - WriteParam(m, p.username_value); - WriteParam(m, p.password_element); - WriteParam(m, p.password_value); - WriteParam(m, p.old_password_element); - WriteParam(m, p.old_password_value); - WriteParam(m, p.ssl_valid); - WriteParam(m, p.preferred); - WriteParam(m, p.blacklisted_by_user); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->signon_realm) && - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->action) && - ReadParam(m, iter, &p->submit_element) && - ReadParam(m, iter, &p->username_element) && - ReadParam(m, iter, &p->username_value) && - ReadParam(m, iter, &p->password_element) && - ReadParam(m, iter, &p->password_value) && - ReadParam(m, iter, &p->old_password_element) && - ReadParam(m, iter, &p->old_password_value) && - ReadParam(m, iter, &p->ssl_valid) && - ReadParam(m, iter, &p->preferred) && - ReadParam(m, iter, &p->blacklisted_by_user); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<PasswordForm>"); - } + 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::wstring* l); }; template <> struct ParamTraits<printing::PageRange> { typedef printing::PageRange 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::wstring* l); }; @@ -419,9 +385,7 @@ template <> struct ParamTraits<printing::NativeMetafile> { typedef printing::NativeMetafile 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::wstring* l); }; diff --git a/chrome/common/plugin_messages.cc b/chrome/common/plugin_messages.cc index 598de69..3079dcc 100644 --- a/chrome/common/plugin_messages.cc +++ b/chrome/common/plugin_messages.cc @@ -4,6 +4,8 @@ #include "chrome/common/plugin_messages.h" +#include "ipc/ipc_channel_handle.h" + #define MESSAGES_INTERNAL_IMPL_FILE \ "chrome/common/plugin_messages_internal.h" #include "ipc/ipc_message_impl_macros.h" diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index 04a258c..e3aec79 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -4,12 +4,34 @@ #include "chrome/common/render_messages.h" +#include "base/values.h" +#include "chrome/common/edit_command.h" +#include "chrome/common/extensions/extension_extent.h" +#include "chrome/common/extensions/url_pattern.h" +#include "chrome/common/indexed_db_key.h" +#include "chrome/common/serialized_script_value.h" #include "chrome/common/thumbnail_score.h" +#include "gfx/rect.h" +#include "ipc/ipc_channel_handle.h" +#include "net/http/http_response_headers.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" +#include "webkit/appcache/appcache_interfaces.h" +#include "webkit/glue/context_menu.h" +#include "webkit/glue/form_data.h" +#include "webkit/glue/form_field.h" +#include "webkit/glue/password_form_dom_manager.h" +#include "webkit/glue/password_form.h" #include "webkit/glue/webaccessibility.h" +#include "webkit/glue/webcookie.h" #include "webkit/glue/webcursor.h" +#include "webkit/glue/webdropdata.h" +#include "webkit/glue/plugins/webplugin.h" +#include "webkit/glue/plugins/webplugininfo.h" +#include "webkit/glue/dom_operations.h" #define MESSAGES_INTERNAL_IMPL_FILE \ "chrome/common/render_messages_internal.h" @@ -17,6 +39,832 @@ namespace IPC { +void ParamTraits<ViewMsg_Navigate_Params>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.page_id); + WriteParam(m, p.pending_history_list_offset); + WriteParam(m, p.current_history_list_offset); + WriteParam(m, p.current_history_list_length); + WriteParam(m, p.url); + WriteParam(m, p.referrer); + WriteParam(m, p.transition); + WriteParam(m, p.state); + WriteParam(m, p.navigation_type); + WriteParam(m, p.request_time); +} + +bool ParamTraits<ViewMsg_Navigate_Params>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->page_id) && + ReadParam(m, iter, &p->pending_history_list_offset) && + ReadParam(m, iter, &p->current_history_list_offset) && + ReadParam(m, iter, &p->current_history_list_length) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->transition) && + ReadParam(m, iter, &p->state) && + ReadParam(m, iter, &p->navigation_type) && + ReadParam(m, iter, &p->request_time); +} + +void ParamTraits<ViewMsg_Navigate_Params>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + LogParam(p.page_id, l); + l->append(L", "); + LogParam(p.url, l); + l->append(L", "); + LogParam(p.transition, l); + l->append(L", "); + LogParam(p.state, l); + l->append(L", "); + LogParam(p.navigation_type, l); + l->append(L", "); + LogParam(p.request_time, l); + l->append(L")"); +} + +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.size()); + 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 size = 0; + 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, &size); + 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_size(size); + p->set_option_strings(options); + return true; +} + +void ParamTraits<webkit_glue::FormField>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<FormField>"); +} + +void ParamTraits<ContextMenuParams>::Write(Message* m, const param_type& p) { + WriteParam(m, p.media_type); + WriteParam(m, p.x); + WriteParam(m, p.y); + WriteParam(m, p.link_url); + WriteParam(m, p.unfiltered_link_url); + WriteParam(m, p.src_url); + WriteParam(m, p.is_image_blocked); + WriteParam(m, p.page_url); + WriteParam(m, p.frame_url); + WriteParam(m, p.media_flags); + WriteParam(m, p.selection_text); + WriteParam(m, p.misspelled_word); + WriteParam(m, p.dictionary_suggestions); + WriteParam(m, p.spellcheck_enabled); + WriteParam(m, p.is_editable); +#if defined(OS_MACOSX) + WriteParam(m, p.writing_direction_default); + WriteParam(m, p.writing_direction_left_to_right); + WriteParam(m, p.writing_direction_right_to_left); +#endif // OS_MACOSX + WriteParam(m, p.edit_flags); + WriteParam(m, p.security_info); + WriteParam(m, p.frame_charset); + WriteParam(m, p.custom_items); +} + +bool ParamTraits<ContextMenuParams>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->media_type) && + ReadParam(m, iter, &p->x) && + ReadParam(m, iter, &p->y) && + ReadParam(m, iter, &p->link_url) && + ReadParam(m, iter, &p->unfiltered_link_url) && + ReadParam(m, iter, &p->src_url) && + ReadParam(m, iter, &p->is_image_blocked) && + ReadParam(m, iter, &p->page_url) && + ReadParam(m, iter, &p->frame_url) && + ReadParam(m, iter, &p->media_flags) && + ReadParam(m, iter, &p->selection_text) && + ReadParam(m, iter, &p->misspelled_word) && + ReadParam(m, iter, &p->dictionary_suggestions) && + ReadParam(m, iter, &p->spellcheck_enabled) && + ReadParam(m, iter, &p->is_editable) && +#if defined(OS_MACOSX) + ReadParam(m, iter, &p->writing_direction_default) && + ReadParam(m, iter, &p->writing_direction_left_to_right) && + ReadParam(m, iter, &p->writing_direction_right_to_left) && +#endif // OS_MACOSX + ReadParam(m, iter, &p->edit_flags) && + ReadParam(m, iter, &p->security_info) && + ReadParam(m, iter, &p->frame_charset) && + ReadParam(m, iter, &p->custom_items); +} + +void ParamTraits<ContextMenuParams>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<ContextMenuParams>"); +} + +void ParamTraits<ViewHostMsg_UpdateRect_Params>::Write( + Message* m, const param_type& p) { + WriteParam(m, p.bitmap); + WriteParam(m, p.bitmap_rect); + WriteParam(m, p.dx); + WriteParam(m, p.dy); + WriteParam(m, p.scroll_rect); + WriteParam(m, p.copy_rects); + WriteParam(m, p.view_size); + WriteParam(m, p.plugin_window_moves); + WriteParam(m, p.flags); +} + +bool ParamTraits<ViewHostMsg_UpdateRect_Params>::Read( + const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->bitmap) && + ReadParam(m, iter, &p->bitmap_rect) && + ReadParam(m, iter, &p->dx) && + ReadParam(m, iter, &p->dy) && + ReadParam(m, iter, &p->scroll_rect) && + ReadParam(m, iter, &p->copy_rects) && + ReadParam(m, iter, &p->view_size) && + ReadParam(m, iter, &p->plugin_window_moves) && + ReadParam(m, iter, &p->flags); +} + +void ParamTraits<ViewHostMsg_UpdateRect_Params>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + LogParam(p.bitmap, l); + l->append(L", "); + LogParam(p.bitmap_rect, l); + l->append(L", "); + LogParam(p.dx, l); + l->append(L", "); + LogParam(p.dy, l); + l->append(L", "); + LogParam(p.scroll_rect, l); + l->append(L", "); + LogParam(p.copy_rects, l); + l->append(L", "); + LogParam(p.view_size, l); + l->append(L", "); + LogParam(p.plugin_window_moves, l); + l->append(L", "); + LogParam(p.flags, l); + l->append(L")"); +} + +void ParamTraits<webkit_glue::WebPluginGeometry>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.window); + WriteParam(m, p.window_rect); + WriteParam(m, p.clip_rect); + WriteParam(m, p.cutout_rects); + WriteParam(m, p.rects_valid); + WriteParam(m, p.visible); +} + +bool ParamTraits<webkit_glue::WebPluginGeometry>::Read( + const Message* m, void** iter, param_type* p) { + return + ReadParam(m, iter, &p->window) && + ReadParam(m, iter, &p->window_rect) && + ReadParam(m, iter, &p->clip_rect) && + ReadParam(m, iter, &p->cutout_rects) && + ReadParam(m, iter, &p->rects_valid) && + ReadParam(m, iter, &p->visible); +} + +void ParamTraits<webkit_glue::WebPluginGeometry>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + LogParam(p.window, l); + l->append(L", "); + LogParam(p.window_rect, l); + l->append(L", "); + LogParam(p.clip_rect, l); + l->append(L", "); + LogParam(p.cutout_rects, l); + l->append(L", "); + LogParam(p.rects_valid, l); + l->append(L", "); + LogParam(p.visible, l); + l->append(L")"); +} + +void ParamTraits<WebPluginMimeType>::Write(Message* m, const param_type& p) { + WriteParam(m, p.mime_type); + WriteParam(m, p.file_extensions); + WriteParam(m, p.description); +} + +bool ParamTraits<WebPluginMimeType>::Read(const Message* m, void** iter, + param_type* r) { + return + ReadParam(m, iter, &r->mime_type) && + ReadParam(m, iter, &r->file_extensions) && + ReadParam(m, iter, &r->description); +} + +void ParamTraits<WebPluginMimeType>::Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.mime_type, l); + l->append(L", "); + LogParam(p.file_extensions, l); + l->append(L", "); + LogParam(p.description, l); + l->append(L")"); +} + +void ParamTraits<WebPluginInfo>::Write(Message* m, const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.path); + WriteParam(m, p.version); + WriteParam(m, p.desc); + WriteParam(m, p.mime_types); + WriteParam(m, p.enabled); +} + +bool ParamTraits<WebPluginInfo>::Read(const Message* m, void** iter, + param_type* r) { + return + ReadParam(m, iter, &r->name) && + ReadParam(m, iter, &r->path) && + ReadParam(m, iter, &r->version) && + ReadParam(m, iter, &r->desc) && + ReadParam(m, iter, &r->mime_types) && + ReadParam(m, iter, &r->enabled); +} + +void ParamTraits<WebPluginInfo>::Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.name, l); + l->append(L", "); + l->append(L", "); + LogParam(p.path, l); + l->append(L", "); + LogParam(p.version, l); + l->append(L", "); + LogParam(p.desc, l); + l->append(L", "); + LogParam(p.mime_types, l); + l->append(L", "); + LogParam(p.enabled, l); + l->append(L")"); +} + +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::wstring* l) { + l->append(L"<PasswordFormFillData>"); +} + +void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Write( + Message* m, const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p) { + // Do not disclose Set-Cookie headers over IPC. + p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); + } +} + +bool ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Read( + const Message* m, void** iter, param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (has_object) + *r = new net::HttpResponseHeaders(*m, iter); + return true; +} + +void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( + const param_type& p, std::wstring* l) { + l->append(L"<HttpResponseHeaders>"); +} + +void ParamTraits<SerializedScriptValue>::Write(Message* m, const param_type& p) { + WriteParam(m, p.is_null()); + WriteParam(m, p.is_invalid()); + WriteParam(m, p.data()); +} + +bool ParamTraits<SerializedScriptValue>::Read(const Message* m, void** iter, + param_type* r) { + bool is_null; + bool is_invalid; + string16 data; + bool ok = + ReadParam(m, iter, &is_null) && + ReadParam(m, iter, &is_invalid) && + ReadParam(m, iter, &data); + if (!ok) + return false; + r->set_is_null(is_null); + r->set_is_invalid(is_invalid); + r->set_data(data); + return true; +} + +void ParamTraits<SerializedScriptValue>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<SerializedScriptValue>("); + LogParam(p.is_null(), l); + l->append(L", "); + LogParam(p.is_invalid(), l); + l->append(L", "); + LogParam(p.data(), l); + l->append(L")"); +} + +void ParamTraits<IndexedDBKey>::Write(Message* m, const param_type& p) { + WriteParam(m, int(p.type())); + // TODO(jorlow): Technically, we only need to pack the type being used. + WriteParam(m, p.string()); + WriteParam(m, p.number()); +} + +bool ParamTraits<IndexedDBKey>::Read(const Message* m, void** iter, + param_type* r) { + int type; + string16 string; + int32 number; + bool ok = + ReadParam(m, iter, &type) && + ReadParam(m, iter, &string) && + ReadParam(m, iter, &number); + if (!ok) + return false; + switch (type) { + case WebKit::WebIDBKey::NullType: + r->SetNull(); + return true; + case WebKit::WebIDBKey::StringType: + r->Set(string); + return true; + case WebKit::WebIDBKey::NumberType: + r->Set(number); + return true; + case WebKit::WebIDBKey::InvalidType: + r->SetInvalid(); + return true; + } + NOTREACHED(); + return false; +} + +void ParamTraits<IndexedDBKey>::Log(const param_type& p, std::wstring* l) { + l->append(L"<IndexedDBKey>("); + LogParam(int(p.type()), l); + l->append(L", "); + LogParam(p.string(), l); + l->append(L", "); + LogParam(p.number(), l); + l->append(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); +} + +void ParamTraits<webkit_glue::FormData>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<FormData>"); +} + +void ParamTraits<RendererPreferences>::Write(Message* m, const param_type& p) { + WriteParam(m, p.can_accept_load_drops); + WriteParam(m, p.should_antialias_text); + WriteParam(m, static_cast<int>(p.hinting)); + WriteParam(m, static_cast<int>(p.subpixel_rendering)); + WriteParam(m, p.focus_ring_color); + WriteParam(m, p.thumb_active_color); + WriteParam(m, p.thumb_inactive_color); + WriteParam(m, p.track_color); + WriteParam(m, p.active_selection_bg_color); + WriteParam(m, p.active_selection_fg_color); + WriteParam(m, p.inactive_selection_bg_color); + WriteParam(m, p.inactive_selection_fg_color); + WriteParam(m, p.browser_handles_top_level_requests); + WriteParam(m, p.caret_blink_interval); +} + +bool ParamTraits<RendererPreferences>::Read(const Message* m, void** iter, + param_type* p) { + if (!ReadParam(m, iter, &p->can_accept_load_drops)) + return false; + if (!ReadParam(m, iter, &p->should_antialias_text)) + return false; + + int hinting = 0; + if (!ReadParam(m, iter, &hinting)) + return false; + p->hinting = static_cast<RendererPreferencesHintingEnum>(hinting); + + int subpixel_rendering = 0; + if (!ReadParam(m, iter, &subpixel_rendering)) + return false; + p->subpixel_rendering = + static_cast<RendererPreferencesSubpixelRenderingEnum>( + subpixel_rendering); + + int focus_ring_color; + if (!ReadParam(m, iter, &focus_ring_color)) + return false; + p->focus_ring_color = focus_ring_color; + + int thumb_active_color, thumb_inactive_color, track_color; + int active_selection_bg_color, active_selection_fg_color; + int inactive_selection_bg_color, inactive_selection_fg_color; + if (!ReadParam(m, iter, &thumb_active_color) || + !ReadParam(m, iter, &thumb_inactive_color) || + !ReadParam(m, iter, &track_color) || + !ReadParam(m, iter, &active_selection_bg_color) || + !ReadParam(m, iter, &active_selection_fg_color) || + !ReadParam(m, iter, &inactive_selection_bg_color) || + !ReadParam(m, iter, &inactive_selection_fg_color)) + return false; + p->thumb_active_color = thumb_active_color; + p->thumb_inactive_color = thumb_inactive_color; + p->track_color = track_color; + p->active_selection_bg_color = active_selection_bg_color; + p->active_selection_fg_color = active_selection_fg_color; + p->inactive_selection_bg_color = inactive_selection_bg_color; + p->inactive_selection_fg_color = inactive_selection_fg_color; + + if (!ReadParam(m, iter, &p->browser_handles_top_level_requests)) + return false; + + if (!ReadParam(m, iter, &p->caret_blink_interval)) + return false; + + return true; +} + +void ParamTraits<RendererPreferences>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<RendererPreferences>"); +} + +void ParamTraits<WebPreferences>::Write(Message* m, const param_type& p) { + WriteParam(m, p.standard_font_family); + WriteParam(m, p.fixed_font_family); + WriteParam(m, p.serif_font_family); + WriteParam(m, p.sans_serif_font_family); + WriteParam(m, p.cursive_font_family); + WriteParam(m, p.fantasy_font_family); + WriteParam(m, p.default_font_size); + WriteParam(m, p.default_fixed_font_size); + WriteParam(m, p.minimum_font_size); + WriteParam(m, p.minimum_logical_font_size); + WriteParam(m, p.default_encoding); + WriteParam(m, p.javascript_enabled); + WriteParam(m, p.web_security_enabled); + WriteParam(m, p.javascript_can_open_windows_automatically); + WriteParam(m, p.loads_images_automatically); + WriteParam(m, p.plugins_enabled); + WriteParam(m, p.dom_paste_enabled); + WriteParam(m, p.developer_extras_enabled); + WriteParam(m, p.inspector_settings); + WriteParam(m, p.site_specific_quirks_enabled); + WriteParam(m, p.shrinks_standalone_images_to_fit); + WriteParam(m, p.uses_universal_detector); + WriteParam(m, p.text_areas_are_resizable); + WriteParam(m, p.java_enabled); + WriteParam(m, p.allow_scripts_to_close_windows); + WriteParam(m, p.uses_page_cache); + WriteParam(m, p.remote_fonts_enabled); + WriteParam(m, p.javascript_can_access_clipboard); + WriteParam(m, p.xss_auditor_enabled); + WriteParam(m, p.local_storage_enabled); + WriteParam(m, p.databases_enabled); + WriteParam(m, p.application_cache_enabled); + WriteParam(m, p.tabs_to_links); + WriteParam(m, p.user_style_sheet_enabled); + WriteParam(m, p.user_style_sheet_location); + WriteParam(m, p.author_and_user_styles_enabled); + WriteParam(m, p.allow_universal_access_from_file_urls); + WriteParam(m, p.allow_file_access_from_file_urls); + WriteParam(m, p.experimental_webgl_enabled); + WriteParam(m, p.show_composited_layer_borders); + WriteParam(m, p.accelerated_compositing_enabled); + WriteParam(m, p.accelerated_2d_canvas_enabled); + WriteParam(m, p.memory_info_enabled); +} + +bool ParamTraits<WebPreferences>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->standard_font_family) && + ReadParam(m, iter, &p->fixed_font_family) && + ReadParam(m, iter, &p->serif_font_family) && + ReadParam(m, iter, &p->sans_serif_font_family) && + ReadParam(m, iter, &p->cursive_font_family) && + ReadParam(m, iter, &p->fantasy_font_family) && + ReadParam(m, iter, &p->default_font_size) && + ReadParam(m, iter, &p->default_fixed_font_size) && + ReadParam(m, iter, &p->minimum_font_size) && + ReadParam(m, iter, &p->minimum_logical_font_size) && + ReadParam(m, iter, &p->default_encoding) && + ReadParam(m, iter, &p->javascript_enabled) && + ReadParam(m, iter, &p->web_security_enabled) && + ReadParam(m, iter, &p->javascript_can_open_windows_automatically) && + ReadParam(m, iter, &p->loads_images_automatically) && + ReadParam(m, iter, &p->plugins_enabled) && + ReadParam(m, iter, &p->dom_paste_enabled) && + ReadParam(m, iter, &p->developer_extras_enabled) && + ReadParam(m, iter, &p->inspector_settings) && + ReadParam(m, iter, &p->site_specific_quirks_enabled) && + ReadParam(m, iter, &p->shrinks_standalone_images_to_fit) && + ReadParam(m, iter, &p->uses_universal_detector) && + ReadParam(m, iter, &p->text_areas_are_resizable) && + ReadParam(m, iter, &p->java_enabled) && + ReadParam(m, iter, &p->allow_scripts_to_close_windows) && + ReadParam(m, iter, &p->uses_page_cache) && + ReadParam(m, iter, &p->remote_fonts_enabled) && + ReadParam(m, iter, &p->javascript_can_access_clipboard) && + ReadParam(m, iter, &p->xss_auditor_enabled) && + ReadParam(m, iter, &p->local_storage_enabled) && + ReadParam(m, iter, &p->databases_enabled) && + ReadParam(m, iter, &p->application_cache_enabled) && + ReadParam(m, iter, &p->tabs_to_links) && + ReadParam(m, iter, &p->user_style_sheet_enabled) && + ReadParam(m, iter, &p->user_style_sheet_location) && + ReadParam(m, iter, &p->author_and_user_styles_enabled) && + ReadParam(m, iter, &p->allow_universal_access_from_file_urls) && + ReadParam(m, iter, &p->allow_file_access_from_file_urls) && + ReadParam(m, iter, &p->experimental_webgl_enabled) && + ReadParam(m, iter, &p->show_composited_layer_borders) && + ReadParam(m, iter, &p->accelerated_compositing_enabled) && + ReadParam(m, iter, &p->accelerated_2d_canvas_enabled) && + ReadParam(m, iter, &p->memory_info_enabled); +} + +void ParamTraits<WebPreferences>::Log(const param_type& p, std::wstring* l) { + l->append(L"<WebPreferences>"); +} + +void ParamTraits<WebDropData>::Write(Message* m, const param_type& p) { + WriteParam(m, p.identity); + WriteParam(m, p.url); + WriteParam(m, p.url_title); + WriteParam(m, p.download_metadata); + WriteParam(m, p.file_extension); + WriteParam(m, p.filenames); + WriteParam(m, p.plain_text); + WriteParam(m, p.text_html); + WriteParam(m, p.html_base_url); + WriteParam(m, p.file_description_filename); + WriteParam(m, p.file_contents); +} + +bool ParamTraits<WebDropData>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->identity) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->url_title) && + ReadParam(m, iter, &p->download_metadata) && + ReadParam(m, iter, &p->file_extension) && + ReadParam(m, iter, &p->filenames) && + ReadParam(m, iter, &p->plain_text) && + ReadParam(m, iter, &p->text_html) && + ReadParam(m, iter, &p->html_base_url) && + ReadParam(m, iter, &p->file_description_filename) && + ReadParam(m, iter, &p->file_contents); +} + +void ParamTraits<WebDropData>::Log(const param_type& p, std::wstring* l) { + l->append(L"<WebDropData>"); +} + +void ParamTraits<URLPattern>::Write(Message* m, const param_type& p) { + WriteParam(m, p.valid_schemes()); + WriteParam(m, p.GetAsString()); +} + +bool ParamTraits<URLPattern>::Read(const Message* m, void** iter, + param_type* p) { + int valid_schemes; + std::string spec; + if (!ReadParam(m, iter, &valid_schemes) || + !ReadParam(m, iter, &spec)) + return false; + + p->set_valid_schemes(valid_schemes); + return p->Parse(spec); +} + +void ParamTraits<URLPattern>::Log(const param_type& p, std::wstring* l) { + LogParam(p.GetAsString(), l); +} + +void ParamTraits<EditCommand>::Write(Message* m, const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.value); +} + +bool ParamTraits<EditCommand>::Read(const Message* m, void** iter, + param_type* p) { + return ReadParam(m, iter, &p->name) && ReadParam(m, iter, &p->value); +} + +void ParamTraits<EditCommand>::Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.name, l); + l->append(L":"); + LogParam(p.value, l); + l->append(L")"); +} + +void ParamTraits<webkit_glue::WebCookie>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.value); + WriteParam(m, p.domain); + WriteParam(m, p.path); + WriteParam(m, p.expires); + WriteParam(m, p.http_only); + WriteParam(m, p.secure); + WriteParam(m, p.session); +} + +bool ParamTraits<webkit_glue::WebCookie>::Read(const Message* m, void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->value) && + ReadParam(m, iter, &p->domain) && + ReadParam(m, iter, &p->path) && + ReadParam(m, iter, &p->expires) && + ReadParam(m, iter, &p->http_only) && + ReadParam(m, iter, &p->secure) && + ReadParam(m, iter, &p->session); +} + +void ParamTraits<webkit_glue::WebCookie>::Log(const param_type& p, + std::wstring* l) { + l->append(L"<WebCookie>"); +} + +void ParamTraits<ExtensionExtent>::Write(Message* m, const param_type& p) { + WriteParam(m, p.patterns()); +} + +bool ParamTraits<ExtensionExtent>::Read(const Message* m, void** iter, + param_type* p) { + std::vector<URLPattern> patterns; + bool success = + ReadParam(m, iter, &patterns); + if (!success) + return false; + + for (size_t i = 0; i < patterns.size(); ++i) + p->AddPattern(patterns[i]); + return true; +} + +void ParamTraits<ExtensionExtent>::Log(const param_type& p, std::wstring* l) { + LogParam(p.patterns(), l); +} + +void ParamTraits<appcache::AppCacheResourceInfo>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.url); + WriteParam(m, p.size); + WriteParam(m, p.is_manifest); + WriteParam(m, p.is_master); + WriteParam(m, p.is_fallback); + WriteParam(m, p.is_foreign); + WriteParam(m, p.is_explicit); +} + +bool ParamTraits<appcache::AppCacheResourceInfo>::Read( + const Message* m, void** iter, param_type* p) { + return ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->size) && + ReadParam(m, iter, &p->is_manifest) && + ReadParam(m, iter, &p->is_master) && + ReadParam(m, iter, &p->is_fallback) && + ReadParam(m, iter, &p->is_foreign) && + ReadParam(m, iter, &p->is_explicit); +} + +void ParamTraits<appcache::AppCacheResourceInfo>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + LogParam(p.url, l); + l->append(L", "); + LogParam(p.size, l); + l->append(L", "); + LogParam(p.is_manifest, l); + l->append(L", "); + LogParam(p.is_master, l); + l->append(L", "); + LogParam(p.is_fallback, l); + l->append(L", "); + LogParam(p.is_foreign, l); + l->append(L", "); + LogParam(p.is_explicit, l); + l->append(L")"); +} + +void ParamTraits<appcache::AppCacheInfo>::Write(Message* m, + const param_type& p) { + WriteParam(m, p.manifest_url); + WriteParam(m, p.creation_time); + WriteParam(m, p.last_update_time); + WriteParam(m, p.last_access_time); + WriteParam(m, p.cache_id); + WriteParam(m, p.status); + WriteParam(m, p.size); + WriteParam(m, p.is_complete); +} + +bool ParamTraits<appcache::AppCacheInfo>::Read(const Message* m, void** iter, + param_type* p) { + return ReadParam(m, iter, &p->manifest_url) && + ReadParam(m, iter, &p->creation_time) && + ReadParam(m, iter, &p->last_update_time) && + ReadParam(m, iter, &p->last_access_time) && + ReadParam(m, iter, &p->cache_id) && + ReadParam(m, iter, &p->status) && + ReadParam(m, iter, &p->size) && + ReadParam(m, iter, &p->is_complete); +} + +void ParamTraits<appcache::AppCacheInfo>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + LogParam(p.manifest_url, l); + l->append(L", "); + LogParam(p.creation_time, l); + l->append(L", "); + LogParam(p.last_update_time, l); + l->append(L", "); + LogParam(p.last_access_time, l); + l->append(L", "); + LogParam(p.cache_id, l); + l->append(L", "); + LogParam(p.status, l); + l->append(L", "); + LogParam(p.size, l); + l->append(L")"); + LogParam(p.is_complete, l); + l->append(L", "); +} + void ParamTraits<webkit_glue::WebAccessibility>::Write(Message* m, const param_type& p) { WriteParam(m, p.id); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 00db777..537c318 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -10,6 +10,8 @@ #include <string> #include <vector> +// TODO(erg): This list has been temporarily annotated by erg while doing work +// on which headers to pull out. #include "app/clipboard/clipboard.h" #include "app/surface/transport_dib.h" #include "base/basictypes.h" @@ -20,52 +22,69 @@ #include "chrome/common/common_param_traits.h" #include "chrome/common/css_colors.h" #include "chrome/common/dom_storage_common.h" -#include "chrome/common/edit_command.h" -#include "chrome/common/extensions/extension_extent.h" -#include "chrome/common/extensions/url_pattern.h" +#include "chrome/common/extensions/extension_extent.h" // used in struct #include "chrome/common/font_descriptor_mac.h" -#include "chrome/common/indexed_db_key.h" +#include "chrome/common/indexed_db_key.h" // used in struct #include "chrome/common/navigation_gesture.h" #include "chrome/common/page_transition_types.h" -#include "chrome/common/renderer_preferences.h" +#include "chrome/common/renderer_preferences.h" // used in struct #include "chrome/common/resource_response.h" #include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" -#include "chrome/common/serialized_script_value.h" #include "chrome/common/webkit_param_traits.h" #include "chrome/common/window_container_type.h" #include "gfx/native_widget_types.h" +#include "gfx/rect.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_platform_file.h" #include "media/audio/audio_io.h" #include "net/base/upload_data.h" -#include "net/http/http_response_headers.h" #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" -#include "webkit/appcache/appcache_interfaces.h" -#include "webkit/glue/context_menu.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" -#include "webkit/glue/plugins/webplugin.h" -#include "webkit/glue/plugins/webplugininfo.h" +#include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status +#include "webkit/glue/password_form.h" // used in struct #include "webkit/glue/resource_loader_bridge.h" -#include "webkit/glue/webcookie.h" -#include "webkit/glue/webdropdata.h" #include "webkit/glue/webmenuitem.h" -#include "webkit/glue/webpreferences.h" +#include "webkit/glue/webpreferences.h" // used in struct + +namespace appcache { +struct AppCacheInfo; +struct AppCacheResourceInfo; +} namespace base { class Time; } +namespace net { +class HttpResponseHeaders; +} + +namespace webkit_glue { +struct FormData; +class FormField; +struct PasswordFormFillData; +struct WebAccessibility; +struct WebCookie; +struct WebPluginGeometry; +} + namespace webkit_glue { struct WebAccessibility; } +struct EditCommand; +class ExtensionExtent; +class IndexedDBKey; +class SerializedScriptValue; + class SkBitmap; +class URLPattern; +struct ContextMenuParams; +struct WebDropData; +struct WebPluginInfo; +struct WebPluginMimeType; // Parameters structure for ViewMsg_Navigate, which has too many data // parameters to be reasonably put in a predefined IPC message. @@ -897,46 +916,9 @@ struct ParamTraits<ResourceType::Type> { template <> struct ParamTraits<ViewMsg_Navigate_Params> { typedef ViewMsg_Navigate_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.page_id); - WriteParam(m, p.pending_history_list_offset); - WriteParam(m, p.current_history_list_offset); - WriteParam(m, p.current_history_list_length); - WriteParam(m, p.url); - WriteParam(m, p.referrer); - WriteParam(m, p.transition); - WriteParam(m, p.state); - WriteParam(m, p.navigation_type); - WriteParam(m, p.request_time); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->page_id) && - ReadParam(m, iter, &p->pending_history_list_offset) && - ReadParam(m, iter, &p->current_history_list_offset) && - ReadParam(m, iter, &p->current_history_list_length) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->transition) && - ReadParam(m, iter, &p->state) && - ReadParam(m, iter, &p->navigation_type) && - ReadParam(m, iter, &p->request_time); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.page_id, l); - l->append(L", "); - LogParam(p.url, l); - l->append(L", "); - LogParam(p.transition, l); - l->append(L", "); - LogParam(p.state, l); - l->append(L", "); - LogParam(p.navigation_type, l); - l->append(L", "); - LogParam(p.request_time, l); - l->append(L")"); - } + 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::wstring* l); }; template<> @@ -959,7 +941,7 @@ struct ParamTraits<ViewMsg_Navigate_Params::NavigationType> { event = L"NavigationType_RELOAD"; break; - case ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE: + case ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE: event = L"NavigationType_RELOAD_IGNORING_CACHE"; break; @@ -983,38 +965,9 @@ struct ParamTraits<ViewMsg_Navigate_Params::NavigationType> { template <> struct ParamTraits<webkit_glue::FormField> { typedef webkit_glue::FormField param_type; - static void 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.size()); - WriteParam(m, p.option_strings()); - } - static bool Read(const Message* m, void** iter, param_type* p) { - string16 label, name, value, form_control_type; - int size = 0; - 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, &size); - 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_size(size); - p->set_option_strings(options); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<FormField>"); - } + 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::wstring* l); }; // Traits for FontDescriptor structure to pack/unpack. @@ -1155,234 +1108,52 @@ struct ParamTraits<ViewHostMsg_FrameNavigate_Params> { template <> struct ParamTraits<ContextMenuParams> { typedef ContextMenuParams param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.media_type); - WriteParam(m, p.x); - WriteParam(m, p.y); - WriteParam(m, p.link_url); - WriteParam(m, p.unfiltered_link_url); - WriteParam(m, p.src_url); - WriteParam(m, p.is_image_blocked); - WriteParam(m, p.page_url); - WriteParam(m, p.frame_url); - WriteParam(m, p.media_flags); - WriteParam(m, p.selection_text); - WriteParam(m, p.misspelled_word); - WriteParam(m, p.dictionary_suggestions); - WriteParam(m, p.spellcheck_enabled); - WriteParam(m, p.is_editable); -#if defined(OS_MACOSX) - WriteParam(m, p.writing_direction_default); - WriteParam(m, p.writing_direction_left_to_right); - WriteParam(m, p.writing_direction_right_to_left); -#endif // OS_MACOSX - WriteParam(m, p.edit_flags); - WriteParam(m, p.security_info); - WriteParam(m, p.frame_charset); - WriteParam(m, p.custom_items); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->media_type) && - ReadParam(m, iter, &p->x) && - ReadParam(m, iter, &p->y) && - ReadParam(m, iter, &p->link_url) && - ReadParam(m, iter, &p->unfiltered_link_url) && - ReadParam(m, iter, &p->src_url) && - ReadParam(m, iter, &p->is_image_blocked) && - ReadParam(m, iter, &p->page_url) && - ReadParam(m, iter, &p->frame_url) && - ReadParam(m, iter, &p->media_flags) && - ReadParam(m, iter, &p->selection_text) && - ReadParam(m, iter, &p->misspelled_word) && - ReadParam(m, iter, &p->dictionary_suggestions) && - ReadParam(m, iter, &p->spellcheck_enabled) && - ReadParam(m, iter, &p->is_editable) && -#if defined(OS_MACOSX) - ReadParam(m, iter, &p->writing_direction_default) && - ReadParam(m, iter, &p->writing_direction_left_to_right) && - ReadParam(m, iter, &p->writing_direction_right_to_left) && -#endif // OS_MACOSX - ReadParam(m, iter, &p->edit_flags) && - ReadParam(m, iter, &p->security_info) && - ReadParam(m, iter, &p->frame_charset) && - ReadParam(m, iter, &p->custom_items); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<ContextMenuParams>"); - } + 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::wstring* l); }; // Traits for ViewHostMsg_UpdateRect_Params structure to pack/unpack. template <> struct ParamTraits<ViewHostMsg_UpdateRect_Params> { typedef ViewHostMsg_UpdateRect_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.bitmap); - WriteParam(m, p.bitmap_rect); - WriteParam(m, p.dx); - WriteParam(m, p.dy); - WriteParam(m, p.scroll_rect); - WriteParam(m, p.copy_rects); - WriteParam(m, p.view_size); - WriteParam(m, p.plugin_window_moves); - WriteParam(m, p.flags); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->bitmap) && - ReadParam(m, iter, &p->bitmap_rect) && - ReadParam(m, iter, &p->dx) && - ReadParam(m, iter, &p->dy) && - ReadParam(m, iter, &p->scroll_rect) && - ReadParam(m, iter, &p->copy_rects) && - ReadParam(m, iter, &p->view_size) && - ReadParam(m, iter, &p->plugin_window_moves) && - ReadParam(m, iter, &p->flags); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.bitmap, l); - l->append(L", "); - LogParam(p.bitmap_rect, l); - l->append(L", "); - LogParam(p.dx, l); - l->append(L", "); - LogParam(p.dy, l); - l->append(L", "); - LogParam(p.scroll_rect, l); - l->append(L", "); - LogParam(p.copy_rects, l); - l->append(L", "); - LogParam(p.view_size, l); - l->append(L", "); - LogParam(p.plugin_window_moves, l); - l->append(L", "); - LogParam(p.flags, l); - l->append(L")"); - } + 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::wstring* l); }; template <> struct ParamTraits<webkit_glue::WebPluginGeometry> { typedef webkit_glue::WebPluginGeometry param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.window); - WriteParam(m, p.window_rect); - WriteParam(m, p.clip_rect); - WriteParam(m, p.cutout_rects); - WriteParam(m, p.rects_valid); - WriteParam(m, p.visible); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->window) && - ReadParam(m, iter, &p->window_rect) && - ReadParam(m, iter, &p->clip_rect) && - ReadParam(m, iter, &p->cutout_rects) && - ReadParam(m, iter, &p->rects_valid) && - ReadParam(m, iter, &p->visible); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.window, l); - l->append(L", "); - LogParam(p.window_rect, l); - l->append(L", "); - LogParam(p.clip_rect, l); - l->append(L", "); - LogParam(p.cutout_rects, l); - l->append(L", "); - LogParam(p.rects_valid, l); - l->append(L", "); - LogParam(p.visible, l); - l->append(L")"); - } + 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::wstring* l); }; // Traits for ViewMsg_GetPlugins_Reply structure to pack/unpack. template <> struct ParamTraits<WebPluginMimeType> { typedef WebPluginMimeType param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.mime_type); - WriteParam(m, p.file_extensions); - WriteParam(m, p.description); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->mime_type) && - ReadParam(m, iter, &r->file_extensions) && - ReadParam(m, iter, &r->description); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.mime_type, l); - l->append(L", "); - LogParam(p.file_extensions, l); - l->append(L", "); - LogParam(p.description, l); - l->append(L")"); - } + 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::wstring* l); }; - template <> struct ParamTraits<WebPluginInfo> { typedef WebPluginInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.path); - WriteParam(m, p.version); - WriteParam(m, p.desc); - WriteParam(m, p.mime_types); - WriteParam(m, p.enabled); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->name) && - ReadParam(m, iter, &r->path) && - ReadParam(m, iter, &r->version) && - ReadParam(m, iter, &r->desc) && - ReadParam(m, iter, &r->mime_types) && - ReadParam(m, iter, &r->enabled); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.name, l); - l->append(L", "); - l->append(L", "); - LogParam(p.path, l); - l->append(L", "); - LogParam(p.version, l); - l->append(L", "); - LogParam(p.desc, l); - l->append(L", "); - LogParam(p.mime_types, l); - l->append(L", "); - LogParam(p.enabled, l); - l->append(L")"); - } + 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::wstring* 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) { - WriteParam(m, p.basic_data); - WriteParam(m, p.additional_logins); - WriteParam(m, p.wait_for_username); - } - static bool 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); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<PasswordFormFillData>"); - } + 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::wstring* l); }; template<> @@ -1525,24 +1296,9 @@ struct ParamTraits<ViewHostMsg_Resource_Request> { template <> struct ParamTraits<scoped_refptr<net::HttpResponseHeaders> > { typedef scoped_refptr<net::HttpResponseHeaders> param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.get() != NULL); - if (p) { - // Do not disclose Set-Cookie headers over IPC. - p->Persist(m, net::HttpResponseHeaders::PERSIST_SANS_COOKIES); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool has_object; - if (!ReadParam(m, iter, &has_object)) - return false; - if (has_object) - *r = new net::HttpResponseHeaders(*m, iter); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<HttpResponseHeaders>"); - } + 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::wstring* l); }; // Traits for webkit_glue::ResourceLoaderBridge::LoadTimingInfo @@ -1745,108 +1501,26 @@ struct ParamTraits<SyncLoadResult> { template <> struct ParamTraits<SerializedScriptValue> { typedef SerializedScriptValue param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.is_null()); - WriteParam(m, p.is_invalid()); - WriteParam(m, p.data()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool is_null; - bool is_invalid; - string16 data; - bool ok = - ReadParam(m, iter, &is_null) && - ReadParam(m, iter, &is_invalid) && - ReadParam(m, iter, &data); - if (!ok) - return false; - r->set_is_null(is_null); - r->set_is_invalid(is_invalid); - r->set_data(data); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<SerializedScriptValue>("); - LogParam(p.is_null(), l); - l->append(L", "); - LogParam(p.is_invalid(), l); - l->append(L", "); - LogParam(p.data(), l); - l->append(L")"); - } + 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::wstring* l); }; template <> struct ParamTraits<IndexedDBKey> { typedef IndexedDBKey param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, int(p.type())); - // TODO(jorlow): Technically, we only need to pack the type being used. - WriteParam(m, p.string()); - WriteParam(m, p.number()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - int type; - string16 string; - int32 number; - bool ok = - ReadParam(m, iter, &type) && - ReadParam(m, iter, &string) && - ReadParam(m, iter, &number); - if (!ok) - return false; - switch (type) { - case WebKit::WebIDBKey::NullType: - r->SetNull(); - return true; - case WebKit::WebIDBKey::StringType: - r->Set(string); - return true; - case WebKit::WebIDBKey::NumberType: - r->Set(number); - return true; - case WebKit::WebIDBKey::InvalidType: - r->SetInvalid(); - return true; - } - NOTREACHED(); - return false; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<IndexedDBKey>("); - LogParam(int(p.type()), l); - l->append(L", "); - LogParam(p.string(), l); - l->append(L", "); - LogParam(p.number(), l); - l->append(L")"); - } + 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::wstring* 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) { - 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); - } - static bool 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); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<FormData>"); - } + 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::wstring* l); }; // Traits for ViewMsg_Print_Params @@ -1965,211 +1639,27 @@ struct ParamTraits<CSSColors::CSSColorName> { template <> struct ParamTraits<RendererPreferences> { typedef RendererPreferences param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.can_accept_load_drops); - WriteParam(m, p.should_antialias_text); - WriteParam(m, static_cast<int>(p.hinting)); - WriteParam(m, static_cast<int>(p.subpixel_rendering)); - WriteParam(m, p.focus_ring_color); - WriteParam(m, p.thumb_active_color); - WriteParam(m, p.thumb_inactive_color); - WriteParam(m, p.track_color); - WriteParam(m, p.active_selection_bg_color); - WriteParam(m, p.active_selection_fg_color); - WriteParam(m, p.inactive_selection_bg_color); - WriteParam(m, p.inactive_selection_fg_color); - WriteParam(m, p.browser_handles_top_level_requests); - WriteParam(m, p.caret_blink_interval); - } - static bool Read(const Message* m, void** iter, param_type* p) { - if (!ReadParam(m, iter, &p->can_accept_load_drops)) - return false; - if (!ReadParam(m, iter, &p->should_antialias_text)) - return false; - - int hinting = 0; - if (!ReadParam(m, iter, &hinting)) - return false; - p->hinting = static_cast<RendererPreferencesHintingEnum>(hinting); - - int subpixel_rendering = 0; - if (!ReadParam(m, iter, &subpixel_rendering)) - return false; - p->subpixel_rendering = - static_cast<RendererPreferencesSubpixelRenderingEnum>( - subpixel_rendering); - - int focus_ring_color; - if (!ReadParam(m, iter, &focus_ring_color)) - return false; - p->focus_ring_color = focus_ring_color; - - int thumb_active_color, thumb_inactive_color, track_color; - int active_selection_bg_color, active_selection_fg_color; - int inactive_selection_bg_color, inactive_selection_fg_color; - if (!ReadParam(m, iter, &thumb_active_color) || - !ReadParam(m, iter, &thumb_inactive_color) || - !ReadParam(m, iter, &track_color) || - !ReadParam(m, iter, &active_selection_bg_color) || - !ReadParam(m, iter, &active_selection_fg_color) || - !ReadParam(m, iter, &inactive_selection_bg_color) || - !ReadParam(m, iter, &inactive_selection_fg_color)) - return false; - p->thumb_active_color = thumb_active_color; - p->thumb_inactive_color = thumb_inactive_color; - p->track_color = track_color; - p->active_selection_bg_color = active_selection_bg_color; - p->active_selection_fg_color = active_selection_fg_color; - p->inactive_selection_bg_color = inactive_selection_bg_color; - p->inactive_selection_fg_color = inactive_selection_fg_color; - - if (!ReadParam(m, iter, &p->browser_handles_top_level_requests)) - return false; - - if (!ReadParam(m, iter, &p->caret_blink_interval)) - return false; - - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<RendererPreferences>"); - } + 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::wstring* l); }; // Traits for WebPreferences structure to pack/unpack. template <> struct ParamTraits<WebPreferences> { typedef WebPreferences param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.standard_font_family); - WriteParam(m, p.fixed_font_family); - WriteParam(m, p.serif_font_family); - WriteParam(m, p.sans_serif_font_family); - WriteParam(m, p.cursive_font_family); - WriteParam(m, p.fantasy_font_family); - WriteParam(m, p.default_font_size); - WriteParam(m, p.default_fixed_font_size); - WriteParam(m, p.minimum_font_size); - WriteParam(m, p.minimum_logical_font_size); - WriteParam(m, p.default_encoding); - WriteParam(m, p.javascript_enabled); - WriteParam(m, p.web_security_enabled); - WriteParam(m, p.javascript_can_open_windows_automatically); - WriteParam(m, p.loads_images_automatically); - WriteParam(m, p.plugins_enabled); - WriteParam(m, p.dom_paste_enabled); - WriteParam(m, p.developer_extras_enabled); - WriteParam(m, p.inspector_settings); - WriteParam(m, p.site_specific_quirks_enabled); - WriteParam(m, p.shrinks_standalone_images_to_fit); - WriteParam(m, p.uses_universal_detector); - WriteParam(m, p.text_areas_are_resizable); - WriteParam(m, p.java_enabled); - WriteParam(m, p.allow_scripts_to_close_windows); - WriteParam(m, p.uses_page_cache); - WriteParam(m, p.remote_fonts_enabled); - WriteParam(m, p.javascript_can_access_clipboard); - WriteParam(m, p.xss_auditor_enabled); - WriteParam(m, p.local_storage_enabled); - WriteParam(m, p.databases_enabled); - WriteParam(m, p.application_cache_enabled); - WriteParam(m, p.tabs_to_links); - WriteParam(m, p.user_style_sheet_enabled); - WriteParam(m, p.user_style_sheet_location); - WriteParam(m, p.author_and_user_styles_enabled); - WriteParam(m, p.allow_universal_access_from_file_urls); - WriteParam(m, p.allow_file_access_from_file_urls); - WriteParam(m, p.experimental_webgl_enabled); - WriteParam(m, p.show_composited_layer_borders); - WriteParam(m, p.accelerated_compositing_enabled); - WriteParam(m, p.accelerated_2d_canvas_enabled); - WriteParam(m, p.memory_info_enabled); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->standard_font_family) && - ReadParam(m, iter, &p->fixed_font_family) && - ReadParam(m, iter, &p->serif_font_family) && - ReadParam(m, iter, &p->sans_serif_font_family) && - ReadParam(m, iter, &p->cursive_font_family) && - ReadParam(m, iter, &p->fantasy_font_family) && - ReadParam(m, iter, &p->default_font_size) && - ReadParam(m, iter, &p->default_fixed_font_size) && - ReadParam(m, iter, &p->minimum_font_size) && - ReadParam(m, iter, &p->minimum_logical_font_size) && - ReadParam(m, iter, &p->default_encoding) && - ReadParam(m, iter, &p->javascript_enabled) && - ReadParam(m, iter, &p->web_security_enabled) && - ReadParam(m, iter, &p->javascript_can_open_windows_automatically) && - ReadParam(m, iter, &p->loads_images_automatically) && - ReadParam(m, iter, &p->plugins_enabled) && - ReadParam(m, iter, &p->dom_paste_enabled) && - ReadParam(m, iter, &p->developer_extras_enabled) && - ReadParam(m, iter, &p->inspector_settings) && - ReadParam(m, iter, &p->site_specific_quirks_enabled) && - ReadParam(m, iter, &p->shrinks_standalone_images_to_fit) && - ReadParam(m, iter, &p->uses_universal_detector) && - ReadParam(m, iter, &p->text_areas_are_resizable) && - ReadParam(m, iter, &p->java_enabled) && - ReadParam(m, iter, &p->allow_scripts_to_close_windows) && - ReadParam(m, iter, &p->uses_page_cache) && - ReadParam(m, iter, &p->remote_fonts_enabled) && - ReadParam(m, iter, &p->javascript_can_access_clipboard) && - ReadParam(m, iter, &p->xss_auditor_enabled) && - ReadParam(m, iter, &p->local_storage_enabled) && - ReadParam(m, iter, &p->databases_enabled) && - ReadParam(m, iter, &p->application_cache_enabled) && - ReadParam(m, iter, &p->tabs_to_links) && - ReadParam(m, iter, &p->user_style_sheet_enabled) && - ReadParam(m, iter, &p->user_style_sheet_location) && - ReadParam(m, iter, &p->author_and_user_styles_enabled) && - ReadParam(m, iter, &p->allow_universal_access_from_file_urls) && - ReadParam(m, iter, &p->allow_file_access_from_file_urls) && - ReadParam(m, iter, &p->experimental_webgl_enabled) && - ReadParam(m, iter, &p->show_composited_layer_borders) && - ReadParam(m, iter, &p->accelerated_compositing_enabled) && - ReadParam(m, iter, &p->accelerated_2d_canvas_enabled) && - ReadParam(m, iter, &p->memory_info_enabled); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<WebPreferences>"); - } + 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::wstring* l); }; // Traits for WebDropData template <> struct ParamTraits<WebDropData> { typedef WebDropData param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.identity); - WriteParam(m, p.url); - WriteParam(m, p.url_title); - WriteParam(m, p.download_metadata); - WriteParam(m, p.file_extension); - WriteParam(m, p.filenames); - WriteParam(m, p.plain_text); - WriteParam(m, p.text_html); - WriteParam(m, p.html_base_url); - WriteParam(m, p.file_description_filename); - WriteParam(m, p.file_contents); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->identity) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->url_title) && - ReadParam(m, iter, &p->download_metadata) && - ReadParam(m, iter, &p->file_extension) && - ReadParam(m, iter, &p->filenames) && - ReadParam(m, iter, &p->plain_text) && - ReadParam(m, iter, &p->text_html) && - ReadParam(m, iter, &p->html_base_url) && - ReadParam(m, iter, &p->file_description_filename) && - ReadParam(m, iter, &p->file_contents); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<WebDropData>"); - } + 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::wstring* l); }; // Traits for AudioManager::Format. @@ -2575,23 +2065,9 @@ struct SimilarTypeTraits<ViewType::Type> { template <> struct ParamTraits<URLPattern> { typedef URLPattern param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.valid_schemes()); - WriteParam(m, p.GetAsString()); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int valid_schemes; - std::string spec; - if (!ReadParam(m, iter, &valid_schemes) || - !ReadParam(m, iter, &spec)) - return false; - - p->set_valid_schemes(valid_schemes); - return p->Parse(spec); - } - static void Log(const param_type& p, std::wstring* l) { - LogParam(p.GetAsString(), l); - } + 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::wstring* l); }; template <> @@ -2634,20 +2110,9 @@ struct ParamTraits<Clipboard::Buffer> { template <> struct ParamTraits<EditCommand> { typedef EditCommand param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.value); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->name) && ReadParam(m, iter, &p->value); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.name, l); - l->append(L":"); - LogParam(p.value, l); - l->append(L")"); - } + 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::wstring* l); }; // Traits for DOMStorageType enum. @@ -2995,30 +2460,9 @@ struct ParamTraits<ViewHostMsg_ShowNotification_Params> { template <> struct ParamTraits<webkit_glue::WebCookie> { typedef webkit_glue::WebCookie param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.value); - WriteParam(m, p.domain); - WriteParam(m, p.path); - WriteParam(m, p.expires); - WriteParam(m, p.http_only); - WriteParam(m, p.secure); - WriteParam(m, p.session); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->value) && - ReadParam(m, iter, &p->domain) && - ReadParam(m, iter, &p->path) && - ReadParam(m, iter, &p->expires) && - ReadParam(m, iter, &p->http_only) && - ReadParam(m, iter, &p->secure) && - ReadParam(m, iter, &p->session); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"<WebCookie>"); - } + 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::wstring* l); }; template<> @@ -3166,23 +2610,9 @@ struct ParamTraits<ViewHostMsg_CreateWindow_Params> { template <> struct ParamTraits<ExtensionExtent> { typedef ExtensionExtent param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.patterns()); - } - static bool Read(const Message* m, void** iter, param_type* p) { - std::vector<URLPattern> patterns; - bool success = - ReadParam(m, iter, &patterns); - if (!success) - return false; - - for (size_t i = 0; i < patterns.size(); ++i) - p->AddPattern(patterns[i]); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - LogParam(p.patterns(), l); - } + 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::wstring* l); }; template <> @@ -3220,86 +2650,18 @@ struct ParamTraits<ViewMsg_ExtensionExtentsUpdated_Params> { template<> struct ParamTraits<appcache::AppCacheResourceInfo> { typedef appcache::AppCacheResourceInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.size); - WriteParam(m, p.is_manifest); - WriteParam(m, p.is_master); - WriteParam(m, p.is_fallback); - WriteParam(m, p.is_foreign); - WriteParam(m, p.is_explicit); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->size) && - ReadParam(m, iter, &p->is_manifest) && - ReadParam(m, iter, &p->is_master) && - ReadParam(m, iter, &p->is_fallback) && - ReadParam(m, iter, &p->is_foreign) && - ReadParam(m, iter, &p->is_explicit); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.url, l); - l->append(L", "); - LogParam(p.size, l); - l->append(L", "); - LogParam(p.is_manifest, l); - l->append(L", "); - LogParam(p.is_master, l); - l->append(L", "); - LogParam(p.is_fallback, l); - l->append(L", "); - LogParam(p.is_foreign, l); - l->append(L", "); - LogParam(p.is_explicit, l); - l->append(L")"); - } + 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::wstring* l); }; template <> - struct ParamTraits<appcache::AppCacheInfo> { - typedef appcache::AppCacheInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.manifest_url); - WriteParam(m, p.creation_time); - WriteParam(m, p.last_update_time); - WriteParam(m, p.last_access_time); - WriteParam(m, p.cache_id); - WriteParam(m, p.status); - WriteParam(m, p.size); - WriteParam(m, p.is_complete); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->manifest_url) && - ReadParam(m, iter, &p->creation_time) && - ReadParam(m, iter, &p->last_update_time) && - ReadParam(m, iter, &p->last_access_time) && - ReadParam(m, iter, &p->cache_id) && - ReadParam(m, iter, &p->status) && - ReadParam(m, iter, &p->size) && - ReadParam(m, iter, &p->is_complete); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.manifest_url, l); - l->append(L", "); - LogParam(p.creation_time, l); - l->append(L", "); - LogParam(p.last_update_time, l); - l->append(L", "); - LogParam(p.last_access_time, l); - l->append(L", "); - LogParam(p.cache_id, l); - l->append(L", "); - LogParam(p.status, l); - l->append(L", "); - LogParam(p.size, l); - l->append(L")"); - LogParam(p.is_complete, l); - l->append(L", "); - } - }; +struct ParamTraits<appcache::AppCacheInfo> { + typedef appcache::AppCacheInfo 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::wstring* l); +}; template <> struct ParamTraits<WindowContainerType> { diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index 7eb594d..4fa01b8 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -16,23 +16,14 @@ #include "base/nullable_string16.h" #include "base/platform_file.h" #include "base/sync_socket.h" -#include "base/time.h" -#include "base/values.h" #include "chrome/common/content_settings.h" -#include "chrome/common/extensions/update_manifest.h" #include "chrome/common/geoposition.h" #include "chrome/common/nacl_types.h" #include "chrome/common/notification_type.h" #include "chrome/common/page_zoom.h" #include "chrome/common/translate_errors.h" #include "chrome/common/window_container_type.h" -#include "gfx/rect.h" -#include "ipc/ipc_channel_handle.h" -#include "ipc/ipc_message.h" #include "ipc/ipc_message_macros.h" -#include "third_party/skia/include/core/SkBitmap.h" -#include "webkit/glue/dom_operations.h" -#include "webkit/glue/form_field.h" #if defined(OS_POSIX) #include "base/file_descriptor_posix.h" @@ -50,9 +41,15 @@ // Substitution map for l10n messages. typedef std::map<std::string, std::string> SubstitutionMap; +class SkBitmap; struct ThumbnailScore; class WebCursor; +namespace IPC { +struct ChannelHandle; +class Message; +} + //----------------------------------------------------------------------------- // RenderView messages // These are messages sent from the browser to the renderer process. @@ -191,7 +188,7 @@ IPC_BEGIN_MESSAGES(View) // // This message must be sent just before sending a key event. IPC_MESSAGE_ROUTED1(ViewMsg_SetEditCommandsForNextKeyEvent, - EditCommands /* edit_commands */) + std::vector<EditCommand> /* edit_commands */) // Message payload is the name/value of a WebCore edit command to execute. IPC_MESSAGE_ROUTED2(ViewMsg_ExecuteEditCommand, diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index f97f4ef..6e672dd 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -17,6 +17,7 @@ #include "chrome/common/security_filter_peer.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" +#include "net/http/http_response_headers.h" #include "webkit/glue/resource_type.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc index 3e76678..177fea9 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -11,6 +11,7 @@ #include "base/scoped_ptr.h" #include "chrome/common/render_messages.h" #include "chrome/common/resource_dispatcher.h" +#include "net/http/http_response_headers.h" #include "testing/gtest/include/gtest/gtest.h" #include "webkit/appcache/appcache_interfaces.h" diff --git a/chrome/common/webkit_param_traits.cc b/chrome/common/webkit_param_traits.cc index 06ee1e2..4a81d46 100644 --- a/chrome/common/webkit_param_traits.cc +++ b/chrome/common/webkit_param_traits.cc @@ -6,6 +6,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" #include "third_party/WebKit/WebKit/chromium/public/WebFindOptions.h" +#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" namespace IPC { @@ -97,6 +98,44 @@ void ParamTraits<WebKit::WebFindOptions>::Log(const param_type& p, l->append(L")"); } +void ParamTraits<WebKit::WebMediaPlayerAction>::Write(Message* m, + const param_type& p) { + WriteParam(m, static_cast<int>(p.type)); + WriteParam(m, p.enable); +} + +bool ParamTraits<WebKit::WebMediaPlayerAction>::Read(const Message* m, + void** iter, + param_type* r) { + int temp; + if (!ReadParam(m, iter, &temp)) + return false; + r->type = static_cast<param_type::Type>(temp); + return ReadParam(m, iter, &r->enable); +} + +void ParamTraits<WebKit::WebMediaPlayerAction>::Log(const param_type& p, + std::wstring* l) { + l->append(L"("); + switch (p.type) { + case WebKit::WebMediaPlayerAction::Play: + l->append(L"Play"); + break; + case WebKit::WebMediaPlayerAction::Mute: + l->append(L"Mute"); + break; + case WebKit::WebMediaPlayerAction::Loop: + l->append(L"Loop"); + break; + default: + l->append(L"Unknown"); + break; + } + l->append(L", "); + LogParam(p.enable, l); + l->append(L")"); +} + void ParamTraits<WebKit::WebCompositionUnderline>::Write(Message* m, const param_type& p) { WriteParam(m, p.startOffset); diff --git a/chrome/common/webkit_param_traits.h b/chrome/common/webkit_param_traits.h index 4b0433a..63cb10b 100644 --- a/chrome/common/webkit_param_traits.h +++ b/chrome/common/webkit_param_traits.h @@ -30,7 +30,6 @@ #include "third_party/WebKit/WebKit/chromium/public/WebContextMenuData.h" #include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h" #include "third_party/WebKit/WebKit/chromium/public/WebInputEvent.h" -#include "third_party/WebKit/WebKit/chromium/public/WebMediaPlayerAction.h" #include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h" #include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" #include "third_party/WebKit/WebKit/chromium/public/WebTextInputType.h" @@ -38,6 +37,7 @@ namespace WebKit { struct WebCompositionUnderline; struct WebFindOptions; +struct WebMediaPlayerAction; struct WebRect; struct WebScreenInfo; } @@ -269,37 +269,9 @@ struct ParamTraits<WebKit::WebDragOperation> { template <> struct ParamTraits<WebKit::WebMediaPlayerAction> { typedef WebKit::WebMediaPlayerAction param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, static_cast<int>(p.type)); - WriteParam(m, p.enable); - } - static bool Read(const Message* m, void** iter, param_type* r) { - int temp; - if (!ReadParam(m, iter, &temp)) - return false; - r->type = static_cast<param_type::Type>(temp); - return ReadParam(m, iter, &r->enable); - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - switch (p.type) { - case WebKit::WebMediaPlayerAction::Play: - l->append(L"Play"); - break; - case WebKit::WebMediaPlayerAction::Mute: - l->append(L"Mute"); - break; - case WebKit::WebMediaPlayerAction::Loop: - l->append(L"Loop"); - break; - default: - l->append(L"Unknown"); - break; - } - l->append(L", "); - LogParam(p.enable, l); - l->append(L")"); - } + 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::wstring* l); }; template <> diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 1ae410e..1bd9903 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -27,6 +27,7 @@ #include "chrome/plugin/chrome_plugin_host.h" #include "chrome/plugin/npobject_util.h" #include "chrome/renderer/render_thread.h" +#include "ipc/ipc_channel_handle.h" #include "net/base/net_errors.h" #include "webkit/glue/plugins/plugin_lib.h" #include "webkit/glue/webkit_glue.h" diff --git a/chrome/renderer/blocked_plugin.cc b/chrome/renderer/blocked_plugin.cc index b3c0973..76c7fe9 100644 --- a/chrome/renderer/blocked_plugin.cc +++ b/chrome/renderer/blocked_plugin.cc @@ -8,6 +8,7 @@ #include "app/resource_bundle.h" #include "base/file_path.h" #include "base/string_piece.h" +#include "base/values.h" #include "chrome/common/jstemplate_builder.h" #include "chrome/common/notification_service.h" #include "chrome/common/plugin_group.h" diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 83f7f49..1087eec 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -4,6 +4,7 @@ #include "chrome/renderer/indexed_db_dispatcher.h" +#include "chrome/common/indexed_db_key.h" #include "chrome/common/render_messages.h" #include "chrome/common/serialized_script_value.h" #include "chrome/renderer/render_thread.h" diff --git a/chrome/renderer/pepper_devices.cc b/chrome/renderer/pepper_devices.cc index e140727..8d0e403 100644 --- a/chrome/renderer/pepper_devices.cc +++ b/chrome/renderer/pepper_devices.cc @@ -6,9 +6,9 @@ #include "chrome/renderer/render_thread.h" #include "chrome/renderer/webplugin_delegate_pepper.h" #include "skia/ext/platform_canvas.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "webkit/glue/plugins/plugin_instance.h" #include "webkit/glue/plugins/webplugin.h" -#include "third_party/skia/include/core/SkBitmap.h" namespace { diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index b49d99e..1405fcc 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -21,6 +21,7 @@ #include "base/thread_local.h" #include "base/trace_event.h" #include "base/utf_string_conversions.h" +#include "base/values.h" #include "chrome/common/appcache/appcache_dispatcher.h" #include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_switches.h" diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index 07595ea..919ee4c 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -127,6 +127,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebView.h" #include "third_party/WebKit/WebKit/chromium/public/WebWindowFeatures.h" #include "webkit/appcache/web_application_cache_host_impl.h" +#include "webkit/glue/context_menu.h" #include "webkit/glue/dom_operations.h" #include "webkit/glue/form_data.h" #include "webkit/glue/form_field.h" diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 0ca11f1..e91efe1 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -7,6 +7,7 @@ #include "app/surface/transport_dib.h" #include "base/command_line.h" #include "base/logging.h" +#include "base/histogram.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "build/build_config.h" @@ -24,6 +25,7 @@ #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" #include "third_party/WebKit/WebKit/chromium/public/WebScreenInfo.h" #include "third_party/WebKit/WebKit/chromium/public/WebSize.h" +#include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/webkit_glue.h" #if defined(OS_POSIX) diff --git a/chrome/renderer/renderer_webcookiejar_impl.cc b/chrome/renderer/renderer_webcookiejar_impl.cc index 53a7794..711338b 100644 --- a/chrome/renderer/renderer_webcookiejar_impl.cc +++ b/chrome/renderer/renderer_webcookiejar_impl.cc @@ -7,6 +7,7 @@ #include "chrome/common/render_messages.h" #include "chrome/renderer/render_thread.h" #include "third_party/WebKit/WebKit/chromium/public/WebCookie.h" +#include "webkit/glue/webcookie.h" using WebKit::WebCookie; using WebKit::WebString; diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc index a841963..c90af60 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_unittest.cc @@ -24,6 +24,7 @@ #include "chrome/renderer/safe_browsing/features.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_channel.h" +#include "net/http/http_response_headers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 3670aec..e085750 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -15,6 +15,7 @@ #include "base/file_path.h" #include "base/file_util.h" +#include "base/histogram.h" #if defined(OS_MACOSX) #include "base/mac_util.h" #endif diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h index a0103a0..bc6be53 100644 --- a/chrome/renderer/webplugin_delegate_pepper.h +++ b/chrome/renderer/webplugin_delegate_pepper.h @@ -20,6 +20,7 @@ #include "gfx/native_widget_types.h" #include "gfx/rect.h" #include "third_party/npapi/bindings/npapi.h" +#include "third_party/skia/include/core/SkBitmap.h" #include "third_party/WebKit/WebKit/chromium/public/WebFileChooserCompletion.h" #include "webkit/glue/plugins/webplugin_delegate.h" diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 04103a1..f1019cb 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -36,6 +36,7 @@ #include "gfx/size.h" #include "grit/generated_resources.h" #include "grit/renderer_resources.h" +#include "ipc/ipc_channel_handle.h" #include "net/base/mime_util.h" #include "printing/native_metafile.h" #include "skia/ext/platform_canvas.h" diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc index 7975faa..93f192ed 100644 --- a/ipc/ipc_message_utils.cc +++ b/ipc/ipc_message_utils.cc @@ -4,10 +4,16 @@ #include "ipc/ipc_message_utils.h" +#include "base/file_path.h" #include "base/json/json_writer.h" +#include "base/nullable_string16.h" #include "base/scoped_ptr.h" #include "base/time.h" #include "base/values.h" +#if defined(OS_POSIX) +#include "ipc/file_descriptor_set_posix.h" +#endif +#include "ipc/ipc_channel_handle.h" namespace IPC { @@ -256,4 +262,107 @@ void ParamTraits<ListValue>::Log(const param_type& p, std::wstring* l) { base::JSONWriter::Write(&p, false, &json); l->append(UTF8ToWide(json)); } + +void ParamTraits<NullableString16>::Write(Message* m, const param_type& p) { + WriteParam(m, p.string()); + WriteParam(m, p.is_null()); +} + +bool ParamTraits<NullableString16>::Read(const Message* m, void** iter, + param_type* r) { + string16 string; + if (!ReadParam(m, iter, &string)) + return false; + bool is_null; + if (!ReadParam(m, iter, &is_null)) + return false; + *r = NullableString16(string, is_null); + return true; +} + +void ParamTraits<NullableString16>::Log(const param_type& p, std::wstring* l) { + l->append(L"("); + LogParam(p.string(), l); + l->append(L", "); + LogParam(p.is_null(), l); + l->append(L")"); +} + +void ParamTraits<FilePath>::Write(Message* m, const param_type& p) { + ParamTraits<FilePath::StringType>::Write(m, p.value()); +} + +bool ParamTraits<FilePath>::Read(const Message* m, void** iter, param_type* r) { + FilePath::StringType value; + if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value)) + return false; + *r = FilePath(value); + return true; +} + +void ParamTraits<FilePath>::Log(const param_type& p, std::wstring* l) { + ParamTraits<FilePath::StringType>::Log(p.value(), l); +} + +#if defined(OS_POSIX) +void ParamTraits<base::FileDescriptor>::Write(Message* m, const param_type& p) { + const bool valid = p.fd >= 0; + WriteParam(m, valid); + + if (valid) { + if (!m->WriteFileDescriptor(p)) + NOTREACHED(); + } +} + +bool ParamTraits<base::FileDescriptor>::Read(const Message* m, void** iter, + param_type* r) { + bool valid; + if (!ReadParam(m, iter, &valid)) + return false; + + if (!valid) { + r->fd = -1; + r->auto_close = false; + return true; + } + + return m->ReadFileDescriptor(iter, r); +} + +void ParamTraits<base::FileDescriptor>::Log(const param_type& p, + std::wstring* l) { + if (p.auto_close) { + l->append(StringPrintf(L"FD(%d auto-close)", p.fd)); + } else { + l->append(StringPrintf(L"FD(%d)", p.fd)); + } +} +#endif // defined(OS_POSIX) + +void ParamTraits<IPC::ChannelHandle>::Write(Message* m, const param_type& p) { + WriteParam(m, p.name); +#if defined(OS_POSIX) + WriteParam(m, p.socket); +#endif +} + +bool ParamTraits<IPC::ChannelHandle>::Read(const Message* m, void** iter, + param_type* r) { + return ReadParam(m, iter, &r->name) +#if defined(OS_POSIX) + && ReadParam(m, iter, &r->socket) +#endif + ; +} + +void ParamTraits<IPC::ChannelHandle>::Log(const param_type& p, + std::wstring* l) { + l->append(ASCIIToWide(StringPrintf("ChannelHandle(%s", p.name.c_str()))); +#if defined(OS_POSIX) + ParamTraits<base::FileDescriptor>::Log(p.socket, l); +#endif + l->append(L")"); +} + } // namespace IPC diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 4882688..12eb02f 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -12,20 +12,12 @@ #include <map> #include <set> -#include "base/file_path.h" #include "base/format_macros.h" -#include "base/nullable_string16.h" #include "base/string16.h" #include "base/string_number_conversions.h" #include "base/string_util.h" -#include "base/utf_string_conversions.h" #include "base/tuple.h" #include "base/utf_string_conversions.h" -#include "base/values.h" -#if defined(OS_POSIX) -#include "ipc/file_descriptor_set_posix.h" -#endif -#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_sync_message.h" // Used by IPC_BEGIN_MESSAGES so that each message class starts from a unique @@ -68,14 +60,19 @@ enum IPCMessageStart { }; class DictionaryValue; +class FilePath; class ListValue; +class NullableString16; namespace base { class Time; +struct FileDescriptor; } namespace IPC { +struct ChannelHandle; + //----------------------------------------------------------------------------- // An iterator class for reading the fields contained within a Message. @@ -598,27 +595,9 @@ struct ParamTraits<std::pair<A, B> > { template <> struct ParamTraits<NullableString16> { typedef NullableString16 param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.string()); - WriteParam(m, p.is_null()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - string16 string; - if (!ReadParam(m, iter, &string)) - return false; - bool is_null; - if (!ReadParam(m, iter, &is_null)) - return false; - *r = NullableString16(string, is_null); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(L"("); - LogParam(p.string(), l); - l->append(L", "); - LogParam(p.is_null(), l); - l->append(L")"); - } + 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::wstring* l); }; // If WCHAR_T_IS_UTF16 is defined, then string16 is a std::wstring so we don't @@ -709,19 +688,9 @@ struct ParamTraits<POINT> { template <> struct ParamTraits<FilePath> { typedef FilePath param_type; - static void Write(Message* m, const param_type& p) { - ParamTraits<FilePath::StringType>::Write(m, p.value()); - } - static bool Read(const Message* m, void** iter, param_type* r) { - FilePath::StringType value; - if (!ParamTraits<FilePath::StringType>::Read(m, iter, &value)) - return false; - *r = FilePath(value); - return true; - } - static void Log(const param_type& p, std::wstring* l) { - ParamTraits<FilePath::StringType>::Log(p.value(), l); - } + 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::wstring* l); }; #if defined(OS_POSIX) @@ -743,35 +712,9 @@ struct ParamTraits<FilePath> { template<> struct ParamTraits<base::FileDescriptor> { typedef base::FileDescriptor param_type; - static void Write(Message* m, const param_type& p) { - const bool valid = p.fd >= 0; - WriteParam(m, valid); - - if (valid) { - if (!m->WriteFileDescriptor(p)) - NOTREACHED(); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - bool valid; - if (!ReadParam(m, iter, &valid)) - return false; - - if (!valid) { - r->fd = -1; - r->auto_close = false; - return true; - } - - return m->ReadFileDescriptor(iter, r); - } - static void Log(const param_type& p, std::wstring* l) { - if (p.auto_close) { - l->append(StringPrintf(L"FD(%d auto-close)", p.fd)); - } else { - l->append(StringPrintf(L"FD(%d)", p.fd)); - } - } + 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::wstring* l); }; #endif // defined(OS_POSIX) @@ -781,26 +724,9 @@ struct ParamTraits<base::FileDescriptor> { template<> struct ParamTraits<IPC::ChannelHandle> { typedef ChannelHandle param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); -#if defined(OS_POSIX) - WriteParam(m, p.socket); -#endif - } - static bool Read(const Message* m, void** iter, param_type* r) { - return ReadParam(m, iter, &r->name) -#if defined(OS_POSIX) - && ReadParam(m, iter, &r->socket) -#endif - ; - } - static void Log(const param_type& p, std::wstring* l) { - l->append(ASCIIToWide(StringPrintf("ChannelHandle(%s", p.name.c_str()))); -#if defined(OS_POSIX) - ParamTraits<base::FileDescriptor>::Log(p.socket, l); -#endif - l->append(L")"); - } + 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::wstring* l); }; #if defined(OS_WIN) diff --git a/ipc/ipc_send_fds_test.cc b/ipc/ipc_send_fds_test.cc index 5f399da..f6d315f 100644 --- a/ipc/ipc_send_fds_test.cc +++ b/ipc/ipc_send_fds_test.cc @@ -20,6 +20,7 @@ extern "C" { #include "ipc/ipc_message_utils.h" #if defined(OS_POSIX) +#include "base/file_descriptor_posix.h" namespace { |