From 939856a0f55cefee7a8dfb0746b1eb4455730d65 Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Tue, 24 Aug 2010 20:29:02 +0000 Subject: FBTF: Move individual XXXMsg_Params structs to a new file. The new file, render_messages_params.h, is included in 57 files, while render_messages.h is included in 176 files. Moving the Params structs to their own file allow pruning the included headers. (Part 2 of this cleanup will be sorting the individual structs into themes to further minimize header inclusion.) BUG=51411 TEST=compiles Review URL: http://codereview.chromium.org/3119035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57229 0039d316-1c4b-4281-b951-d872f2087c98 --- .../chromeos/notifications/balloon_view_host.cc | 1 + .../desktop_notifications_unittest.cc | 4 +- .../chromeos/offline/offline_load_page_unittest.cc | 1 + chrome/browser/debugger/debugger_remote_service.cc | 1 + .../debugger/extension_ports_remote_service.cc | 1 + .../browser/device_orientation/dispatcher_host.cc | 1 + chrome/browser/dom_ui/dom_ui.cc | 1 + .../extensions/extension_function_dispatcher.cc | 2 + chrome/browser/extensions/extension_host.cc | 1 + chrome/browser/external_tab_container_win.cc | 1 + .../file_system/file_system_dispatcher_host.cc | 1 + chrome/browser/gpu_process_host.cc | 1 + .../dom_storage_dispatcher_host.cc | 1 + .../indexed_db_dispatcher_host.cc | 1 + .../notifications/desktop_notification_service.cc | 1 + .../desktop_notifications_unittest.cc | 1 + chrome/browser/printing/print_dialog_cloud.cc | 4 +- chrome/browser/printing/print_view_manager.cc | 2 +- .../browser/renderer_host/audio_renderer_host.cc | 1 + .../renderer_host/audio_renderer_host_unittest.cc | 1 + .../renderer_host/browser_render_process_host.cc | 1 + chrome/browser/renderer_host/render_view_host.cc | 1 + .../renderer_host/render_view_host_delegate.cc | 1 + .../browser/renderer_host/render_widget_helper.cc | 2 +- chrome/browser/renderer_host/render_widget_host.cc | 1 + .../renderer_host/render_widget_host_unittest.cc | 1 + .../renderer_host/resource_dispatcher_host.cc | 2 + .../resource_dispatcher_host_unittest.cc | 2 + .../renderer_host/resource_message_filter.cc | 1 + .../renderer_host/test/test_render_view_host.cc | 2 + .../safe_browsing_blocking_page_unittest.cc | 1 + ...earch_provider_install_state_dispatcher_host.cc | 1 + chrome/browser/tab_contents/background_contents.cc | 2 +- .../browser/tab_contents/navigation_controller.cc | 2 +- .../tab_contents/navigation_controller_unittest.cc | 1 + .../tab_contents/render_view_host_manager.cc | 1 + chrome/browser/tab_contents/tab_contents.cc | 1 + .../tab_contents_file_select_helper.cc | 2 +- .../browser/tab_contents/web_contents_unittest.cc | 1 + chrome/browser/utility_process_host.cc | 1 + chrome/browser/worker_host/worker_process_host.cc | 1 + chrome/chrome_common.gypi | 2 + chrome/common/common_param_traits.cc | 123 +- chrome/common/common_param_traits.h | 95 +- chrome/common/common_param_traits_unittest.cc | 1 + .../extensions/extension_localization_peer.cc | 1 + chrome/common/gpu_messages.cc | 44 + chrome/common/gpu_messages.h | 38 +- chrome/common/gpu_messages_internal.h | 13 +- chrome/common/indexed_db_param_traits.h | 1 + chrome/common/render_messages.cc | 184 +- chrome/common/render_messages.h | 2241 +------------------- chrome/common/render_messages_params.cc | 1420 +++++++++++++ chrome/common/render_messages_params.h | 1097 ++++++++++ chrome/common/resource_dispatcher.cc | 2 + chrome/common/resource_dispatcher_unittest.cc | 2 + chrome/common/utility_messages.cc | 4 + chrome/common/utility_messages_internal.h | 4 +- chrome/gpu/gpu_backing_store_glx.cc | 1 + chrome/gpu/gpu_thread.cc | 1 + chrome/gpu/gpu_video_decoder.cc | 4 +- chrome/gpu/gpu_view_win.cc | 1 + chrome/renderer/audio_message_filter.cc | 1 + chrome/renderer/audio_message_filter_unittest.cc | 1 + chrome/renderer/device_orientation_dispatcher.cc | 1 + chrome/renderer/device_orientation_dispatcher.h | 4 +- .../extensions/extension_process_bindings.cc | 1 + chrome/renderer/external_extension.cc | 1 + chrome/renderer/indexed_db_dispatcher.cc | 1 + chrome/renderer/media/audio_renderer_impl.cc | 2 +- .../renderer/media/audio_renderer_impl_unittest.cc | 1 + chrome/renderer/mock_printer.cc | 1 + chrome/renderer/mock_render_thread.cc | 1 + chrome/renderer/notification_provider.cc | 1 + chrome/renderer/pepper_devices.cc | 2 + chrome/renderer/pepper_plugin_delegate_impl.cc | 1 + chrome/renderer/print_web_view_helper.cc | 1 + chrome/renderer/print_web_view_helper_linux.cc | 1 + chrome/renderer/print_web_view_helper_mac.mm | 1 + chrome/renderer/print_web_view_helper_win.cc | 1 + chrome/renderer/render_thread.cc | 1 + chrome/renderer/render_view.cc | 1 + chrome/renderer/render_view_unittest.cc | 1 + chrome/renderer/render_widget.cc | 1 + .../phishing_dom_feature_extractor_browsertest.cc | 2 + chrome/renderer/webplugin_delegate_pepper.cc | 1 + chrome/renderer/webworker_base.cc | 1 + chrome/test/render_view_test.cc | 1 + chrome/worker/worker_webkitclient_impl.cc | 1 + ipc/ipc.gypi | 1 + ipc/ipc_message_utils.h | 9 +- ipc/ipc_param_traits.h | 24 + 92 files changed, 2982 insertions(+), 2420 deletions(-) create mode 100644 chrome/common/render_messages_params.cc create mode 100644 chrome/common/render_messages_params.h create mode 100644 ipc/ipc_param_traits.h diff --git a/chrome/browser/chromeos/notifications/balloon_view_host.cc b/chrome/browser/chromeos/notifications/balloon_view_host.cc index 4efb44f..c51966b 100644 --- a/chrome/browser/chromeos/notifications/balloon_view_host.cc +++ b/chrome/browser/chromeos/notifications/balloon_view_host.cc @@ -7,6 +7,7 @@ #include "base/stl_util-inl.h" #include "base/values.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" namespace chromeos { diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc index 7872e67..7af3528 100644 --- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/utf_string_conversions.h" #include "chrome/browser/chromeos/notifications/desktop_notifications_unittest.h" +#include "base/utf_string_conversions.h" +#include "chrome/common/render_messages_params.h" + namespace chromeos { // static diff --git a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc index a619243..b2702c1 100644 --- a/chrome/browser/chromeos/offline/offline_load_page_unittest.cc +++ b/chrome/browser/chromeos/offline/offline_load_page_unittest.cc @@ -8,6 +8,7 @@ #include "chrome/browser/chromeos/offline/offline_load_page.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" static const char* kURL1 = "http://www.google.com/"; static const char* kURL2 = "http://www.gmail.com/"; diff --git a/chrome/browser/debugger/debugger_remote_service.cc b/chrome/browser/debugger/debugger_remote_service.cc index ba77fb9..4c3341b 100644 --- a/chrome/browser/debugger/debugger_remote_service.cc +++ b/chrome/browser/debugger/debugger_remote_service.cc @@ -21,6 +21,7 @@ #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/devtools_messages.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" namespace { diff --git a/chrome/browser/debugger/extension_ports_remote_service.cc b/chrome/browser/debugger/extension_ports_remote_service.cc index d92a043..29cc11f 100644 --- a/chrome/browser/debugger/extension_ports_remote_service.cc +++ b/chrome/browser/debugger/extension_ports_remote_service.cc @@ -25,6 +25,7 @@ #include "chrome/common/devtools_messages.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" namespace { diff --git a/chrome/browser/device_orientation/dispatcher_host.cc b/chrome/browser/device_orientation/dispatcher_host.cc index c7d85db..825f8d8 100644 --- a/chrome/browser/device_orientation/dispatcher_host.cc +++ b/chrome/browser/device_orientation/dispatcher_host.cc @@ -11,6 +11,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/render_view_host_notification_task.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_message.h" namespace device_orientation { diff --git a/chrome/browser/dom_ui/dom_ui.cc b/chrome/browser/dom_ui/dom_ui.cc index 5fb2fb8..c9e9c88 100644 --- a/chrome/browser/dom_ui/dom_ui.cc +++ b/chrome/browser/dom_ui/dom_ui.cc @@ -17,6 +17,7 @@ #include "chrome/browser/tab_contents/tab_contents_view.h" #include "chrome/common/bindings_policy.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" namespace { diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc index 4eb02c0..836c46c 100644 --- a/chrome/browser/extensions/extension_function_dispatcher.cc +++ b/chrome/browser/extensions/extension_function_dispatcher.cc @@ -54,8 +54,10 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/result_codes.h" #include "chrome/common/url_constants.h" +#include "third_party/skia/include/core/SkBitmap.h" // FactoryRegistry ------------------------------------------------------------- diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc index 0b3cc5a..c7964b6 100644 --- a/chrome/browser/extensions/extension_host.cc +++ b/chrome/browser/extensions/extension_host.cc @@ -44,6 +44,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/view_types.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "grit/browser_resources.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc index 8e374c8..ba7202b 100644 --- a/chrome/browser/external_tab_container_win.cc +++ b/chrome/browser/external_tab_container_win.cc @@ -29,6 +29,7 @@ #include "chrome/common/bindings_policy.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/notification_service.h" #include "chrome/common/page_transition_types.h" diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc index 496a623..8b4b42c 100644 --- a/chrome/browser/file_system/file_system_dispatcher_host.cc +++ b/chrome/browser/file_system/file_system_dispatcher_host.cc @@ -11,6 +11,7 @@ #include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/renderer_host/browser_render_process_host.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "googleurl/src/gurl.h" FileSystemDispatcherHost::FileSystemDispatcherHost( diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index fe8e5f8..8fb0bea 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -16,6 +16,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_messages.h" #include "chrome/common/render_messages.h" +#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_switches.h" #if defined(OS_LINUX) diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc index 0bd53ac..17e99c4 100644 --- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc @@ -14,6 +14,7 @@ #include "chrome/browser/renderer_host/render_view_host_notification_task.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "googleurl/src/gurl.h" using WebKit::WebStorageArea; diff --git a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc index 78d0580..9967548 100644 --- a/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc +++ b/chrome/browser/in_process_webkit/indexed_db_dispatcher_host.cc @@ -11,6 +11,7 @@ #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/serialized_script_value.h" #include "third_party/WebKit/WebKit/chromium/public/WebDOMStringList.h" #include "third_party/WebKit/WebKit/chromium/public/WebIDBCursor.h" diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc index 8059e1e..53e5d00 100644 --- a/chrome/browser/notifications/desktop_notification_service.cc +++ b/chrome/browser/notifications/desktop_notification_service.cc @@ -27,6 +27,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "grit/browser_resources.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index 34746d1..a03de2e9 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -6,6 +6,7 @@ #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "chrome/common/render_messages_params.h" // static const int MockBalloonCollection::kMockBalloonSpace = 5; diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index b084456..9e30850 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -27,8 +27,10 @@ #include "chrome/common/notification_observer.h" #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_source.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/notification_type.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" +#include "webkit/glue/webpreferences.h" #include "grit/generated_resources.h" diff --git a/chrome/browser/printing/print_view_manager.cc b/chrome/browser/printing/print_view_manager.cc index a3bd281..bfbcd43 100644 --- a/chrome/browser/printing/print_view_manager.cc +++ b/chrome/browser/printing/print_view_manager.cc @@ -15,7 +15,7 @@ #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/common/notification_service.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "grit/generated_resources.h" #include "printing/native_metafile.h" #include "printing/printed_document.h" diff --git a/chrome/browser/renderer_host/audio_renderer_host.cc b/chrome/browser/renderer_host/audio_renderer_host.cc index 231b9c6..fcfd0bf 100644 --- a/chrome/browser/renderer_host/audio_renderer_host.cc +++ b/chrome/browser/renderer_host/audio_renderer_host.cc @@ -11,6 +11,7 @@ #include "base/sys_info.h" #include "chrome/browser/renderer_host/audio_sync_reader.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_logging.h" // The minimum number of samples in a hardware packet. diff --git a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc index 08a7b4e..7020d04 100644 --- a/chrome/browser/renderer_host/audio_renderer_host_unittest.cc +++ b/chrome/browser/renderer_host/audio_renderer_host_unittest.cc @@ -10,6 +10,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/renderer_host/audio_renderer_host.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_message_utils.h" #include "media/audio/fake_audio_output_stream.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 148fa6b..4352f1d 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -53,6 +53,7 @@ #include "chrome/common/pref_names.h" #include "chrome/common/process_watcher.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/result_codes.h" #include "chrome/renderer/render_process_impl.h" #include "chrome/renderer/render_thread.h" diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc index 511e0df..78f5bae 100644 --- a/chrome/browser/renderer_host/render_view_host.cc +++ b/chrome/browser/renderer_host/render_view_host.cc @@ -34,6 +34,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/result_codes.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/net/url_request_context_getter.h" diff --git a/chrome/browser/renderer_host/render_view_host_delegate.cc b/chrome/browser/renderer_host/render_view_host_delegate.cc index 570dfd3..523fd8f 100644 --- a/chrome/browser/renderer_host/render_view_host_delegate.cc +++ b/chrome/browser/renderer_host/render_view_host_delegate.cc @@ -6,6 +6,7 @@ #include "base/singleton.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/renderer_preferences.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc index c4a2542..718a723 100644 --- a/chrome/browser/renderer_host/render_widget_helper.cc +++ b/chrome/browser/renderer_host/render_widget_helper.cc @@ -10,7 +10,7 @@ #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_dispatcher_host.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" // A Task used with InvokeLater that we hold a pointer to in pending_paints_. // Instances are deleted by MessageLoop after it calls their Run method. diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc index e64e871..a1f6af2 100644 --- a/chrome/browser/renderer_host/render_widget_host.cc +++ b/chrome/browser/renderer_host/render_widget_host.cc @@ -21,6 +21,7 @@ #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" #include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/webcursor.h" diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc index e462fec..35f35f8 100644 --- a/chrome/browser/renderer_host/render_widget_host_unittest.cc +++ b/chrome/browser/renderer_host/render_widget_host_unittest.cc @@ -12,6 +12,7 @@ #include "chrome/browser/renderer_host/render_widget_host_painting_observer.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "gfx/canvas_skia.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index b5b8288..f9b2bb2 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -53,6 +53,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "net/base/auth.h" #include "net/base/cert_status_flags.h" @@ -61,6 +62,7 @@ #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/base/ssl_cert_request_info.h" +#include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_context.h" diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc index 4cbee1a..f05d1114 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc @@ -14,7 +14,9 @@ #include "chrome/browser/renderer_host/resource_handler.h" #include "chrome/common/chrome_plugin_lib.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "net/base/net_errors.h" +#include "net/base/upload_data.h" #include "net/http/http_util.h" #include "net/url_request/url_request.h" #include "net/url_request/url_request_job.h" diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 6f00e94..b61d488 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -74,6 +74,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "chrome/common/worker_messages.h" #include "gfx/native_widget_types.h" diff --git a/chrome/browser/renderer_host/test/test_render_view_host.cc b/chrome/browser/renderer_host/test/test_render_view_host.cc index 19352ce..bc6a65b 100644 --- a/chrome/browser/renderer_host/test/test_render_view_host.cc +++ b/chrome/browser/renderer_host/test/test_render_view_host.cc @@ -9,8 +9,10 @@ #include "chrome/browser/tab_contents/test_tab_contents.h" #include "chrome/common/dom_storage_common.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "gfx/rect.h" #include "webkit/glue/webpreferences.h" +#include "webkit/glue/password_form.h" using webkit_glue::PasswordForm; diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc index 660e8dd..eef2a80a 100644 --- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc @@ -7,6 +7,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/browser/safe_browsing/safe_browsing_blocking_page.h" #include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/common/render_messages_params.h" static const char* kGoogleURL = "http://www.google.com/"; static const char* kGoodURL = "http://www.goodguys.com/"; diff --git a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc b/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc index 87803ba..7dd06fa 100644 --- a/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc +++ b/chrome/browser/search_engines/search_provider_install_state_dispatcher_host.cc @@ -10,6 +10,7 @@ #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/browser/renderer_host/resource_message_filter.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_message.h" #include "googleurl/src/gurl.h" diff --git a/chrome/browser/tab_contents/background_contents.cc b/chrome/browser/tab_contents/background_contents.cc index 1f4d78b..7b35bdc 100644 --- a/chrome/browser/tab_contents/background_contents.cc +++ b/chrome/browser/tab_contents/background_contents.cc @@ -15,7 +15,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/url_constants.h" #include "chrome/common/view_types.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "gfx/rect.h" //////////////// diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index fe49825..10c3da4 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -26,7 +26,7 @@ #include "chrome/common/navigation_types.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "grit/app_resources.h" #include "net/base/escape.h" diff --git a/chrome/browser/tab_contents/navigation_controller_unittest.cc b/chrome/browser/tab_contents/navigation_controller_unittest.cc index 9d6543a..ccb47d3 100644 --- a/chrome/browser/tab_contents/navigation_controller_unittest.cc +++ b/chrome/browser/tab_contents/navigation_controller_unittest.cc @@ -21,6 +21,7 @@ #include "chrome/common/notification_registrar.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/test/test_notification_tracker.h" #include "chrome/test/testing_profile.h" #include "net/base/net_util.h" diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc index 4754425..e5f7426 100644 --- a/chrome/browser/tab_contents/render_view_host_manager.cc +++ b/chrome/browser/tab_contents/render_view_host_manager.cc @@ -21,6 +21,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/notification_type.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" namespace base { diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 92c23ff..605b458 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -88,6 +88,7 @@ #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/url_constants.h" #include "grit/chromium_strings.h" diff --git a/chrome/browser/tab_contents/tab_contents_file_select_helper.cc b/chrome/browser/tab_contents/tab_contents_file_select_helper.cc index bbc6f4f..bd042f2 100644 --- a/chrome/browser/tab_contents/tab_contents_file_select_helper.cc +++ b/chrome/browser/tab_contents/tab_contents_file_select_helper.cc @@ -10,7 +10,7 @@ #include "chrome/browser/shell_dialogs.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" TabContentsFileSelectHelper::TabContentsFileSelectHelper( TabContents* tab_contents) diff --git a/chrome/browser/tab_contents/web_contents_unittest.cc b/chrome/browser/tab_contents/web_contents_unittest.cc index 8a74269..2f6f88e 100644 --- a/chrome/browser/tab_contents/web_contents_unittest.cc +++ b/chrome/browser/tab_contents/web_contents_unittest.cc @@ -20,6 +20,7 @@ #include "chrome/common/chrome_paths.h" #include "chrome/common/pref_names.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "chrome/test/testing_pref_service.h" #include "chrome/test/testing_profile.h" diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 6014f22..2d439e4 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -12,6 +12,7 @@ #include "chrome/common/chrome_switches.h" #include "chrome/common/utility_messages.h" #include "ipc/ipc_switches.h" +#include "third_party/skia/include/core/SkBitmap.h" UtilityProcessHost::UtilityProcessHost(ResourceDispatcherHost* rdh, Client* client, diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc index 2c4cf7f..c06465a 100644 --- a/chrome/browser/worker_host/worker_process_host.cc +++ b/chrome/browser/worker_host/worker_process_host.cc @@ -28,6 +28,7 @@ #include "chrome/common/debug_flags.h" #include "chrome/common/notification_service.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/result_codes.h" #include "chrome/common/worker_messages.h" #include "ipc/ipc_switches.h" diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index cf08d07..1f37f86 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -320,6 +320,8 @@ 'common/plugin_messages_internal.h', 'common/render_messages.cc', 'common/render_messages.h', + 'common/render_messages_params.cc', + 'common/render_messages_params.h', 'common/render_messages_internal.h', 'common/renderer_preferences.h', 'common/resource_dispatcher.cc', diff --git a/chrome/common/common_param_traits.cc b/chrome/common/common_param_traits.cc index 0eed189..19ef93b 100644 --- a/chrome/common/common_param_traits.cc +++ b/chrome/common/common_param_traits.cc @@ -6,9 +6,11 @@ #include "chrome/common/chrome_constants.h" #include "chrome/common/content_settings.h" +#include "chrome/common/geoposition.h" #include "chrome/common/thumbnail_score.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" +#include "net/base/upload_data.h" #include "printing/native_metafile.h" #include "printing/page_range.h" @@ -315,6 +317,90 @@ void ParamTraits::Log(const param_type& p, std::string* l) { } } +// Only the net::UploadData ParamTraits<> definition needs this definition, so +// keep this in the implementation file so we can forward declare UploadData in +// the header. +template <> +struct ParamTraits { + typedef net::UploadData::Element param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, static_cast(p.type())); + if (p.type() == net::UploadData::TYPE_BYTES) { + m->WriteData(&p.bytes()[0], static_cast(p.bytes().size())); + } else { + WriteParam(m, p.file_path()); + WriteParam(m, p.file_range_offset()); + WriteParam(m, p.file_range_length()); + WriteParam(m, p.expected_file_modification_time()); + } + } + static bool Read(const Message* m, void** iter, param_type* r) { + int type; + if (!ReadParam(m, iter, &type)) + return false; + if (type == net::UploadData::TYPE_BYTES) { + const char* data; + int len; + if (!m->ReadData(iter, &data, &len)) + return false; + r->SetToBytes(data, len); + } else { + DCHECK(type == net::UploadData::TYPE_FILE); + FilePath file_path; + uint64 offset, length; + base::Time expected_modification_time; + if (!ReadParam(m, iter, &file_path)) + return false; + if (!ReadParam(m, iter, &offset)) + return false; + if (!ReadParam(m, iter, &length)) + return false; + if (!ReadParam(m, iter, &expected_modification_time)) + return false; + r->SetToFilePathRange(file_path, offset, length, + expected_modification_time); + } + return true; + } + static void Log(const param_type& p, std::string* l) { + l->append(""); + } +}; + +void ParamTraits >::Write(Message* m, + const param_type& p) { + WriteParam(m, p.get() != NULL); + if (p) { + WriteParam(m, *p->elements()); + WriteParam(m, p->identifier()); + } +} + +bool ParamTraits >::Read(const Message* m, + void** iter, + param_type* r) { + bool has_object; + if (!ReadParam(m, iter, &has_object)) + return false; + if (!has_object) + return true; + std::vector elements; + if (!ReadParam(m, iter, &elements)) + return false; + int64 identifier; + if (!ReadParam(m, iter, &identifier)) + return false; + *r = new net::UploadData; + (*r)->swap_elements(&elements); + (*r)->set_identifier(identifier); + return true; +} + +void ParamTraits >::Log(const param_type& p, + std::string* l) { + l->append(""); +} + void ParamTraits::Write(Message* m, const param_type& p) { IPC::ParamTraits::Write(m, p.boring_score); IPC::ParamTraits::Write(m, p.good_clipping); @@ -345,25 +431,24 @@ void ParamTraits::Log(const param_type& p, std::string* l) { p.boring_score, p.good_clipping, p.at_top)); } -void ParamTraits::Write( - Message* m, const Geoposition::ErrorCode& p) { - int error_code = p; - WriteParam(m, error_code); -} - -bool ParamTraits::Read( - const Message* m, void** iter, Geoposition::ErrorCode* p) { - int error_code_param = 0; - bool ret = ReadParam(m, iter, &error_code_param); - *p = static_cast(error_code_param); - return ret; -} - -void ParamTraits::Log( - const Geoposition::ErrorCode& p, std::string* l) { - int error_code = p; - l->append(StringPrintf("%d", error_code)); -} +template <> +struct ParamTraits { + typedef Geoposition::ErrorCode param_type; + static void Write(Message* m, const param_type& p) { + int error_code = p; + WriteParam(m, error_code); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int error_code_param = 0; + bool ret = ReadParam(m, iter, &error_code_param); + *p = static_cast(error_code_param); + return ret; + } + static void Log(const param_type& p, std::string* l) { + int error_code = p; + l->append(StringPrintf("%d", error_code)); + } +}; void ParamTraits::Write(Message* m, const Geoposition& p) { WriteParam(m, p.latitude); diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h index 7345487..da04edc 100644 --- a/chrome/common/common_param_traits.h +++ b/chrome/common/common_param_traits.h @@ -15,18 +15,18 @@ #include #include "app/surface/transport_dib.h" +#include "base/ref_counted.h" #include "chrome/common/content_settings.h" -#include "chrome/common/geoposition.h" #include "chrome/common/page_zoom.h" #include "gfx/native_widget_types.h" #include "ipc/ipc_message_utils.h" -#include "net/base/upload_data.h" #include "net/url_request/url_request_status.h" #include "printing/native_metafile.h" #include "webkit/glue/webcursor.h" #include "webkit/glue/window_open_disposition.h" // Forward declarations. +struct Geoposition; class GURL; class SkBitmap; class DictionaryValue; @@ -41,6 +41,10 @@ class Rect; class Size; } // namespace gfx +namespace net { +class UploadData; +} + namespace printing { struct PageRange; } // namespace printing @@ -259,86 +263,13 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; - -// Traits for net::UploadData::Element. -template <> -struct ParamTraits { - typedef net::UploadData::Element param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, static_cast(p.type())); - if (p.type() == net::UploadData::TYPE_BYTES) { - m->WriteData(&p.bytes()[0], static_cast(p.bytes().size())); - } else { - WriteParam(m, p.file_path()); - WriteParam(m, p.file_range_offset()); - WriteParam(m, p.file_range_length()); - WriteParam(m, p.expected_file_modification_time()); - } - } - static bool Read(const Message* m, void** iter, param_type* r) { - int type; - if (!ReadParam(m, iter, &type)) - return false; - if (type == net::UploadData::TYPE_BYTES) { - const char* data; - int len; - if (!m->ReadData(iter, &data, &len)) - return false; - r->SetToBytes(data, len); - } else { - DCHECK(type == net::UploadData::TYPE_FILE); - FilePath file_path; - uint64 offset, length; - base::Time expected_modification_time; - if (!ReadParam(m, iter, &file_path)) - return false; - if (!ReadParam(m, iter, &offset)) - return false; - if (!ReadParam(m, iter, &length)) - return false; - if (!ReadParam(m, iter, &expected_modification_time)) - return false; - r->SetToFilePathRange(file_path, offset, length, - expected_modification_time); - } - return true; - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - // Traits for net::UploadData. template <> struct ParamTraits > { typedef scoped_refptr param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.get() != NULL); - if (p) { - WriteParam(m, *p->elements()); - WriteParam(m, p->identifier()); - } - } - 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) - return true; - std::vector elements; - if (!ReadParam(m, iter, &elements)) - return false; - int64 identifier; - if (!ReadParam(m, iter, &identifier)) - return false; - *r = new net::UploadData; - (*r)->swap_elements(&elements); - (*r)->set_identifier(identifier); - return true; - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); }; template<> @@ -358,14 +289,6 @@ struct ParamTraits { }; template <> -struct ParamTraits { - typedef Geoposition::ErrorCode param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template <> struct ParamTraits { typedef webkit_glue::PasswordForm param_type; static void Write(Message* m, const param_type& p); diff --git a/chrome/common/common_param_traits_unittest.cc b/chrome/common/common_param_traits_unittest.cc index a810991..d97d6d0e 100644 --- a/chrome/common/common_param_traits_unittest.cc +++ b/chrome/common/common_param_traits_unittest.cc @@ -8,6 +8,7 @@ #include "base/scoped_ptr.h" #include "base/values.h" #include "chrome/common/common_param_traits.h" +#include "chrome/common/geoposition.h" #include "gfx/rect.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message.h" diff --git a/chrome/common/extensions/extension_localization_peer.cc b/chrome/common/extensions/extension_localization_peer.cc index c7c8b1b..b3627f0 100644 --- a/chrome/common/extensions/extension_localization_peer.cc +++ b/chrome/common/extensions/extension_localization_peer.cc @@ -4,6 +4,7 @@ #include "chrome/common/extensions/extension_localization_peer.h" +#include "base/scoped_ptr.h" #include "base/string_util.h" #include "chrome/common/extensions/extension_message_bundle.h" #include "chrome/common/render_messages.h" diff --git a/chrome/common/gpu_messages.cc b/chrome/common/gpu_messages.cc index 4ba5776..61920cc 100644 --- a/chrome/common/gpu_messages.cc +++ b/chrome/common/gpu_messages.cc @@ -4,6 +4,50 @@ #include "chrome/common/gpu_messages.h" +#include "chrome/common/gpu_info.h" +#include "gfx/rect.h" +#include "gfx/size.h" +#include "ipc/ipc_channel_handle.h" + #define MESSAGES_INTERNAL_IMPL_FILE \ "chrome/common/gpu_messages_internal.h" #include "ipc/ipc_message_impl_macros.h" + +namespace IPC { + +void ParamTraits::Write(Message* m, const param_type& p) { + m->WriteUInt32(p.vendor_id()); + m->WriteUInt32(p.device_id()); + m->WriteWString(p.driver_version()); + m->WriteUInt32(p.pixel_shader_version()); + m->WriteUInt32(p.vertex_shader_version()); + m->WriteUInt32(p.gl_version()); +} + +bool ParamTraits::Read(const Message* m, void** iter, param_type* p) { + uint32 vendor_id; + uint32 device_id; + std::wstring driver_version; + uint32 pixel_shader_version; + uint32 vertex_shader_version; + uint32 gl_version; + bool ret = m->ReadUInt32(iter, &vendor_id); + ret = ret && m->ReadUInt32(iter, &device_id); + ret = ret && m->ReadWString(iter, &driver_version); + ret = ret && m->ReadUInt32(iter, &pixel_shader_version); + ret = ret && m->ReadUInt32(iter, &vertex_shader_version); + ret = ret && m->ReadUInt32(iter, &gl_version); + p->SetGraphicsInfo(vendor_id, device_id, driver_version, + pixel_shader_version, vertex_shader_version, + gl_version); + return ret; +} + +void ParamTraits::Log(const param_type& p, std::string* l) { + l->append(StringPrintf(" %x %x %ls", + p.vendor_id(), + p.device_id(), + p.driver_version().c_str())); +} + +} // namespace IPC diff --git a/chrome/common/gpu_messages.h b/chrome/common/gpu_messages.h index f044b2f..fd0583c 100644 --- a/chrome/common/gpu_messages.h +++ b/chrome/common/gpu_messages.h @@ -9,13 +9,12 @@ #include "base/basictypes.h" #include "base/process.h" #include "chrome/common/common_param_traits.h" -#include "chrome/common/gpu_info.h" #include "chrome/common/gpu_native_window_handle.h" #include "gfx/native_widget_types.h" -#include "gfx/rect.h" -#include "gfx/size.h" #include "gpu/command_buffer/common/command_buffer.h" +class GPUInfo; + #if defined(OS_MACOSX) // Parameters for the GpuHostMsg_AcceleratedSurfaceSetIOSurface // message, which has too many parameters to be sent with the @@ -81,36 +80,9 @@ struct ParamTraits { template <> struct ParamTraits { typedef GPUInfo param_type; - static void Write(Message* m, const param_type& p) { - m->WriteUInt32(p.vendor_id()); - m->WriteUInt32(p.device_id()); - m->WriteWString(p.driver_version()); - m->WriteUInt32(p.pixel_shader_version()); - m->WriteUInt32(p.vertex_shader_version()); - m->WriteUInt32(p.gl_version()); - } - static bool Read(const Message* m, void** iter, param_type* p) { - uint32 vendor_id; - uint32 device_id; - std::wstring driver_version; - uint32 pixel_shader_version; - uint32 vertex_shader_version; - uint32 gl_version; - bool ret = m->ReadUInt32(iter, &vendor_id); - ret = ret && m->ReadUInt32(iter, &device_id); - ret = ret && m->ReadWString(iter, &driver_version); - ret = ret && m->ReadUInt32(iter, &pixel_shader_version); - ret = ret && m->ReadUInt32(iter, &vertex_shader_version); - ret = ret && m->ReadUInt32(iter, &gl_version); - p->SetGraphicsInfo(vendor_id, device_id, driver_version, - pixel_shader_version, vertex_shader_version, - gl_version); - return ret; - } - static void Log(const param_type& p, std::string* l) { - l->append(StringPrintf(" %x %x %ls", - p.vendor_id(), p.device_id(), p.driver_version().c_str())); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h index 9ada32a..7db08d3 100644 --- a/chrome/common/gpu_messages_internal.h +++ b/chrome/common/gpu_messages_internal.h @@ -9,12 +9,19 @@ // This file needs to be included again, even though we're actually included // from it via utility_messages.h. #include "base/shared_memory.h" -#include "chrome/common/gpu_info.h" #include "chrome/common/gpu_video_common.h" -#include "gfx/size.h" -#include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message_macros.h" +namespace gfx { +class Size; +} + +namespace IPC { +struct ChannelHandle; +} + +class GPUInfo; + //------------------------------------------------------------------------------ // GPU Messages // These are messages from the browser to the GPU process. diff --git a/chrome/common/indexed_db_param_traits.h b/chrome/common/indexed_db_param_traits.h index f7a8f0d..4936944 100644 --- a/chrome/common/indexed_db_param_traits.h +++ b/chrome/common/indexed_db_param_traits.h @@ -8,6 +8,7 @@ #include "chrome/common/indexed_db_key.h" #include "chrome/common/serialized_script_value.h" +#include "ipc/ipc_param_traits.h" namespace IPC { diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc index 1c60413..3e17733 100644 --- a/chrome/common/render_messages.cc +++ b/chrome/common/render_messages.cc @@ -9,9 +9,11 @@ #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/indexed_db_param_traits.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/thumbnail_score.h" #include "gfx/rect.h" #include "ipc/ipc_channel_handle.h" +#include "net/base/upload_data.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" @@ -31,6 +33,11 @@ #include "webkit/glue/plugins/webplugin.h" #include "webkit/glue/plugins/webplugininfo.h" #include "webkit/glue/dom_operations.h" +#include "webkit/glue/webmenuitem.h" + +#if defined(OS_MACOSX) +#include "chrome/common/font_descriptor_mac.h" +#endif #define MESSAGES_INTERNAL_IMPL_FILE \ "chrome/common/render_messages_internal.h" @@ -38,51 +45,40 @@ namespace IPC { -void ParamTraits::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::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); -} +template<> +struct ParamTraits { + typedef WebMenuItem::Type param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + std::string type; + switch (p) { + case WebMenuItem::OPTION: + type = "OPTION"; + break; + case WebMenuItem::GROUP: + type = "GROUP"; + break; + case WebMenuItem::SEPARATOR: + type = "SEPARATOR"; + break; + default: + type = "UNKNOWN"; + break; + } + LogParam(type, l); + } +}; -void ParamTraits::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.page_id, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.transition, l); - l->append(", "); - LogParam(p.state, l); - l->append(", "); - LogParam(p.navigation_type, l); - l->append(", "); - LogParam(p.request_time, l); - l->append(")"); -} void ParamTraits::Write(Message* m, const param_type& p) { @@ -122,6 +118,25 @@ void ParamTraits::Log(const param_type& p, l->append(""); } +#if defined(OS_MACOSX) +void ParamTraits::Write(Message* m, const param_type& p) { + WriteParam(m, p.font_name); + WriteParam(m, p.font_point_size); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return( + ReadParam(m, iter, &p->font_name) && + ReadParam(m, iter, &p->font_point_size)); +} + +void ParamTraits::Log(const param_type& p, std::string* l) { + l->append(""); +} +#endif + void ParamTraits::Write(Message* m, const param_type& p) { WriteParam(m, p.media_type); WriteParam(m, p.x); @@ -183,56 +198,6 @@ void ParamTraits::Log(const param_type& p, l->append(""); } -void ParamTraits::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::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::Log(const param_type& p, - std::string* l) { - l->append("("); - LogParam(p.bitmap, l); - l->append(", "); - LogParam(p.bitmap_rect, l); - l->append(", "); - LogParam(p.dx, l); - l->append(", "); - LogParam(p.dy, l); - l->append(", "); - LogParam(p.scroll_rect, l); - l->append(", "); - LogParam(p.copy_rects, l); - l->append(", "); - LogParam(p.view_size, l); - l->append(", "); - LogParam(p.plugin_window_moves, l); - l->append(", "); - LogParam(p.flags, l); - l->append(")"); -} - void ParamTraits::Write(Message* m, const param_type& p) { WriteParam(m, p.window); @@ -608,6 +573,39 @@ void ParamTraits::Log(const param_type& p, std::string* l) { l->append(""); } +void ParamTraits::Write(Message* m, const param_type& p) { + WriteParam(m, p.label); + WriteParam(m, p.type); + WriteParam(m, p.enabled); + WriteParam(m, p.checked); + WriteParam(m, p.action); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->label) && + ReadParam(m, iter, &p->type) && + ReadParam(m, iter, &p->enabled) && + ReadParam(m, iter, &p->checked) && + ReadParam(m, iter, &p->action); +} + +void ParamTraits::Log(const param_type& p, std::string* l) { + l->append("("); + LogParam(p.label, l); + l->append(", "); + LogParam(p.type, l); + l->append(", "); + LogParam(p.enabled, l); + l->append(", "); + LogParam(p.checked, l); + l->append(", "); + LogParam(p.action, l); + l->append(")"); +} + void ParamTraits::Write(Message* m, const param_type& p) { WriteParam(m, p.valid_schemes()); WriteParam(m, p.GetAsString()); diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index d6c8245..33f98ad 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -11,43 +11,29 @@ // 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 "app/clipboard/clipboard.h" // enum #include "base/basictypes.h" -#include "base/platform_file.h" #include "base/ref_counted.h" -#include "base/shared_memory.h" #include "base/string16.h" -#include "base/values.h" #include "chrome/common/common_param_traits.h" #include "chrome/common/css_colors.h" #include "chrome/common/dom_storage_common.h" -#include "chrome/common/extensions/extension_extent.h" // used in struct -#include "chrome/common/font_descriptor_mac.h" #include "chrome/common/indexed_db_param_traits.h" -#include "chrome/common/navigation_gesture.h" #include "chrome/common/page_transition_types.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/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 "ipc/ipc_platform_file.h" // ifdefed typedef. #include "third_party/WebKit/WebKit/chromium/public/WebStorageArea.h" -#include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" #include "webkit/appcache/appcache_interfaces.h" // enum appcache::Status -#include "webkit/glue/password_form.h" // used in struct -#include "webkit/glue/plugins/webplugin.h" -#include "webkit/glue/resource_loader_bridge.h" -#include "webkit/glue/webmenuitem.h" -#include "webkit/glue/webpreferences.h" // used in struct +#include "webkit/glue/resource_loader_bridge.h" // nested classes + +#if defined(OS_MACOSX) +struct FontDescriptor; +#endif namespace appcache { struct AppCacheInfo; @@ -60,6 +46,7 @@ class Time; namespace net { class HttpResponseHeaders; +class UploadData; } namespace webkit_glue { @@ -68,1094 +55,94 @@ class FormField; struct PasswordFormFillData; struct WebAccessibility; struct WebCookie; +struct WebPluginGeometry; } namespace webkit_glue { struct WebAccessibility; } -struct EditCommand; class ExtensionExtent; - +class GURL; class SkBitmap; class URLPattern; struct ContextMenuParams; +struct EditCommand; +struct RendererPreferences; struct WebDropData; +struct WebMenuItem; struct WebPluginInfo; struct WebPluginMimeType; - -// Parameters structure for ViewMsg_Navigate, which has too many data -// parameters to be reasonably put in a predefined IPC message. -struct ViewMsg_Navigate_Params { - enum NavigationType { - // Reload the page. - RELOAD, - - // Reload the page, ignoring any cache entries. - RELOAD_IGNORING_CACHE, - - // The navigation is the result of session restore and should honor the - // page's cache policy while restoring form state. This is set to true if - // restoring a tab/session from the previous session and the previous - // session did not crash. If this is not set and the page was restored then - // the page's cache policy is ignored and we load from the cache. - RESTORE, - - // Navigation type not categorized by the other types. - NORMAL - }; - - // The page_id for this navigation, or -1 if it is a new navigation. Back, - // Forward, and Reload navigations should have a valid page_id. If the load - // succeeds, then this page_id will be reflected in the resultant - // ViewHostMsg_FrameNavigate message. - int32 page_id; - - // If page_id is -1, then pending_history_list_offset will also be -1. - // Otherwise, it contains the offset into the history list corresponding to - // the current navigation. - int pending_history_list_offset; - - // Informs the RenderView of where its current page contents reside in - // session history and the total size of the session history list. - int current_history_list_offset; - int current_history_list_length; - - // The URL to load. - GURL url; - - // The URL to send in the "Referer" header field. Can be empty if there is - // no referrer. - GURL referrer; - - // The type of transition. - PageTransition::Type transition; - - // Opaque history state (received by ViewHostMsg_UpdateState). - std::string state; - - // Type of navigation. - NavigationType navigation_type; - - // The time the request was created - base::Time request_time; -}; - -// Current status of the audio output stream in the browser process. Browser -// sends information about the current playback state and error to the -// renderer process using this type. -struct ViewMsg_AudioStreamState_Params { - enum State { - kPlaying, - kPaused, - kError - }; - - // Carries the current playback state. - State state; -}; - -// The user has completed a find-in-page; this type defines what actions the -// renderer should take next. -struct ViewMsg_StopFinding_Params { - enum Action { - kClearSelection, - kKeepSelection, - kActivateSelection - }; - - // The action that should be taken when the find is completed. - Action action; -}; - -// The install state of the search provider (not installed, installed, default). -struct ViewHostMsg_GetSearchProviderInstallState_Params { - enum State { - // Equates to an access denied error. - DENIED = -1, - - // DON'T CHANGE THE VALUES BELOW. - // All of the following values are manidated by the - // spec for window.external.IsSearchProviderInstalled. - - // The search provider is not installed. - NOT_INSTALLED = 0, - - // The search provider is in the user's set but is not - INSTALLED_BUT_NOT_DEFAULT = 1, - - // The search provider is set as the user's default. - INSTALLED_AS_DEFAULT = 2 - }; - State state; - - ViewHostMsg_GetSearchProviderInstallState_Params() - : state(DENIED) { - } - - explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s) - : state(s) { - } - - static ViewHostMsg_GetSearchProviderInstallState_Params Denied() { - return ViewHostMsg_GetSearchProviderInstallState_Params(DENIED); - } - - static ViewHostMsg_GetSearchProviderInstallState_Params NotInstalled() { - return ViewHostMsg_GetSearchProviderInstallState_Params(NOT_INSTALLED); - } - - static ViewHostMsg_GetSearchProviderInstallState_Params - InstallButNotDefault() { - return ViewHostMsg_GetSearchProviderInstallState_Params( - INSTALLED_BUT_NOT_DEFAULT); - } - - static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { - return ViewHostMsg_GetSearchProviderInstallState_Params( - INSTALLED_AS_DEFAULT); - } -}; - - -// Parameters structure for ViewHostMsg_FrameNavigate, which has too many data -// parameters to be reasonably put in a predefined IPC message. -struct ViewHostMsg_FrameNavigate_Params { - // Page ID of this navigation. The renderer creates a new unique page ID - // anytime a new session history entry is created. This means you'll get new - // page IDs for user actions, and the old page IDs will be reloaded when - // iframes are loaded automatically. - int32 page_id; - - // URL of the page being loaded. - GURL url; - - // URL of the referrer of this load. WebKit generates this based on the - // source of the event that caused the load. - GURL referrer; - - // The type of transition. - PageTransition::Type transition; - - // Lists the redirects that occurred on the way to the current page. This - // vector has the same format as reported by the WebDataSource in the glue, - // with the current page being the last one in the list (so even when - // there's no redirect, there will be one entry in the list. - std::vector redirects; - - // Set to false if we want to update the session history but not update - // the browser history. E.g., on unreachable urls. - bool should_update_history; - - // See SearchableFormData for a description of these. - GURL searchable_form_url; - std::string searchable_form_encoding; - - // See password_form.h. - webkit_glue::PasswordForm password_form; - - // Information regarding the security of the connection (empty if the - // connection was not secure). - std::string security_info; - - // The gesture that initiated this navigation. - NavigationGesture gesture; - - // Contents MIME type of main frame. - std::string contents_mime_type; - - // True if this was a post request. - bool is_post; - - // Whether the content of the frame was replaced with some alternate content - // (this can happen if the resource was insecure). - bool is_content_filtered; - - // The status code of the HTTP request. - int http_status_code; -}; - -// Values that may be OR'd together to form the 'flags' parameter of a -// ViewHostMsg_UpdateRect_Params structure. -struct ViewHostMsg_UpdateRect_Flags { - enum { - IS_RESIZE_ACK = 1 << 0, - IS_RESTORE_ACK = 1 << 1, - IS_REPAINT_ACK = 1 << 2, - }; - static bool is_resize_ack(int flags) { - return (flags & IS_RESIZE_ACK) != 0; - } - static bool is_restore_ack(int flags) { - return (flags & IS_RESTORE_ACK) != 0; - } - static bool is_repaint_ack(int flags) { - return (flags & IS_REPAINT_ACK) != 0; - } -}; - -struct ViewHostMsg_UpdateRect_Params { - // The bitmap to be painted into the view at the locations specified by - // update_rects. - TransportDIB::Id bitmap; - - // The position and size of the bitmap. - gfx::Rect bitmap_rect; - - // The scroll offset. Only one of these can be non-zero, and if they are - // both zero, then it means there is no scrolling and the scroll_rect is - // ignored. - int dx; - int dy; - - // The rectangular region to scroll. - gfx::Rect scroll_rect; - - // The regions of the bitmap (in view coords) that contain updated pixels. - // In the case of scrolling, this includes the scroll damage rect. - std::vector copy_rects; - - // The size of the RenderView when this message was generated. This is - // included so the host knows how large the view is from the perspective of - // the renderer process. This is necessary in case a resize operation is in - // progress. - gfx::Size view_size; - - // New window locations for plugin child windows. - std::vector plugin_window_moves; - - // The following describes the various bits that may be set in flags: - // - // ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK - // Indicates that this is a response to a ViewMsg_Resize message. - // - // ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK - // Indicates that this is a response to a ViewMsg_WasRestored message. - // - // ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK - // Indicates that this is a response to a ViewMsg_Repaint message. - // - // If flags is zero, then this message corresponds to an unsoliticed paint - // request by the render view. Any of the above bits may be set in flags, - // which would indicate that this paint message is an ACK for multiple - // request messages. - int flags; -}; - -// Information on closing a tab. This is used both for ViewMsg_ClosePage, and -// the corresponding ViewHostMsg_ClosePage_ACK. -struct ViewMsg_ClosePage_Params { - // The identifier of the RenderProcessHost for the currently closing view. - // - // These first two parameters are technically redundant since they are - // needed only when processing the ACK message, and the processor - // theoretically knows both the process and route ID. However, this is - // difficult to figure out with our current implementation, so this - // information is duplicate here. - int closing_process_id; - - // The route identifier for the currently closing RenderView. - int closing_route_id; - - // True when this close is for the first (closing) tab of a cross-site - // transition where we switch processes. False indicates the close is for the - // entire tab. - // - // When true, the new_* variables below must be filled in. Otherwise they must - // both be -1. - bool for_cross_site_transition; - - // The identifier of the RenderProcessHost for the new view attempting to - // replace the closing one above. This must be valid when - // for_cross_site_transition is set, and must be -1 otherwise. - int new_render_process_host_id; - - // The identifier of the *request* the new view made that is causing the - // cross-site transition. This is *not* a route_id, but the request that we - // will resume once the ACK from the closing view has been received. This - // must be valid when for_cross_site_transition is set, and must be -1 - // otherwise. - int new_request_id; -}; - -// Parameters for a resource request. -struct ViewHostMsg_Resource_Request { - // The request method: GET, POST, etc. - std::string method; - - // The requested URL. - GURL url; - - // Usually the URL of the document in the top-level window, which may be - // checked by the third-party cookie blocking policy. Leaving it empty may - // lead to undesired cookie blocking. Third-party cookie blocking can be - // bypassed by setting first_party_for_cookies = url, but this should ideally - // only be done if there really is no way to determine the correct value. - GURL first_party_for_cookies; - - // The referrer to use (may be empty). - GURL referrer; - - // The origin of the frame that is associated with this request. This is used - // to update our insecure content state. - std::string frame_origin; - - // The origin of the main frame (top-level frame) that is associated with this - // request. This is used to update our insecure content state. - std::string main_frame_origin; - - // Additional HTTP request headers. - std::string headers; - - // URLRequest load flags (0 by default). - int load_flags; - - // Unique ID of process that originated this request. For normal renderer - // requests, this will be the ID of the renderer. For plugin requests routed - // through the renderer, this will be the plugin's ID. - int origin_child_id; - - // What this resource load is for (main frame, sub-frame, sub-resource, - // object). - ResourceType::Type resource_type; - - // Used by plugin->browser requests to get the correct URLRequestContext. - uint32 request_context; - - // Indicates which frame (or worker context) the request is being loaded into, - // or kNoHostId. - int appcache_host_id; - - // Optional upload data (may be null). - scoped_refptr upload_data; - - bool download_to_file; - - // The following two members are specified if the request is initiated by - // a plugin like Gears. - - // Contains the id of the host renderer. - int host_renderer_id; - - // Contains the id of the host render view. - int host_render_view_id; -}; - -// Parameters for a render request. -struct ViewMsg_Print_Params { - // Physical size of the page, including non-printable margins, - // in pixels according to dpi. - gfx::Size page_size; - - // In pixels according to dpi_x and dpi_y. - gfx::Size printable_size; - - // The y-offset of the printable area, in pixels according to dpi. - int margin_top; - - // The x-offset of the printable area, in pixels according to dpi. - int margin_left; - - // Specifies dots per inch. - double dpi; - - // Minimum shrink factor. See PrintSettings::min_shrink for more information. - double min_shrink; - - // Maximum shrink factor. See PrintSettings::max_shrink for more information. - double max_shrink; - - // Desired apparent dpi on paper. - int desired_dpi; - - // Cookie for the document to ensure correctness. - int document_cookie; - - // Should only print currently selected text. - bool selection_only; - - // Warning: do not compare document_cookie. - bool Equals(const ViewMsg_Print_Params& rhs) const { - return page_size == rhs.page_size && - printable_size == rhs.printable_size && - margin_top == rhs.margin_top && - margin_left == rhs.margin_left && - dpi == rhs.dpi && - min_shrink == rhs.min_shrink && - max_shrink == rhs.max_shrink && - desired_dpi == rhs.desired_dpi && - selection_only == rhs.selection_only; - } - - // Checking if the current params is empty. Just initialized after a memset. - bool IsEmpty() const { - return !document_cookie && !desired_dpi && !max_shrink && !min_shrink && - !dpi && printable_size.IsEmpty() && !selection_only && - page_size.IsEmpty() && !margin_top && !margin_left; - } -}; - -struct ViewMsg_PrintPage_Params { - // Parameters to render the page as a printed page. It must always be the same - // value for all the document. - ViewMsg_Print_Params params; - - // The page number is the indicator of the square that should be rendered - // according to the layout specified in ViewMsg_Print_Params. - int page_number; -}; - -struct ViewMsg_PrintPages_Params { - // Parameters to render the page as a printed page. It must always be the same - // value for all the document. - ViewMsg_Print_Params params; - - // If empty, this means a request to render all the printed pages. - std::vector pages; -}; - -// Parameters to describe a rendered page. -struct ViewHostMsg_DidPrintPage_Params { - // A shared memory handle to the EMF data. This data can be quite large so a - // memory map needs to be used. - base::SharedMemoryHandle metafile_data_handle; - - // Size of the metafile data. - uint32 data_size; - - // Cookie for the document to ensure correctness. - int document_cookie; - - // Page number. - int page_number; - - // Shrink factor used to render this page. - double actual_shrink; - - // The size of the page the page author specified. - gfx::Size page_size; - - // The printable area the page author specified. - gfx::Rect content_area; - - // True if the page has visible overlays. - bool has_visible_overlays; -}; - -// Parameters for creating an audio output stream. -struct ViewHostMsg_Audio_CreateStream_Params { - // Format request for the stream. - AudioManager::Format format; - - // Number of channels. - int channels; - - // Sampling rate (frequency) of the output stream. - int sample_rate; - - // Number of bits per sample; - int bits_per_sample; - - // Number of bytes per packet. Determines the maximum number of bytes - // transported for each audio packet request. - // A value of 0 means that the audio packet size is selected automatically - // by the browser process. - uint32 packet_size; -}; - -// This message is used for supporting popup menus on Mac OS X using native -// Cocoa controls. The renderer sends us this message which we use to populate -// the popup menu. -struct ViewHostMsg_ShowPopup_Params { - // Position on the screen. - gfx::Rect bounds; - - // The height of each item in the menu. - int item_height; - - // The size of the font to use for those items. - double item_font_size; - - // The currently selected (displayed) item in the menu. - int selected_item; - - // The entire list of items in the popup menu. - std::vector popup_items; - - // Whether items should be right-aligned. - bool right_aligned; -}; - -// Parameters for the IPC message ViewHostMsg_ScriptedPrint -struct ViewHostMsg_ScriptedPrint_Params { - int routing_id; - gfx::NativeViewId host_window_id; - int cookie; - int expected_pages_count; - bool has_selection; - bool use_overlays; -}; - -// Signals a storage event. -struct ViewMsg_DOMStorageEvent_Params { - // The key that generated the storage event. Null if clear() was called. - NullableString16 key_; - - // The old value of this key. Null on clear() or if it didn't have a value. - NullableString16 old_value_; - - // The new value of this key. Null on removeItem() or clear(). - NullableString16 new_value_; - - // The origin this is associated with. - string16 origin_; - - // The URL of the page that caused the storage event. - GURL url_; - - // The storage type of this event. - DOMStorageType storage_type_; -}; - -// Used to open an indexed database. -struct ViewHostMsg_IDBFactoryOpen_Params { - // The routing ID of the view initiating the open. - int32 routing_id_; - - // The response should have this id. - int32 response_id_; - - // The origin doing the initiating. - string16 origin_; - - // The name of the database. - string16 name_; - - // The description of the database. - string16 description_; -}; - -// Used to create an object store. -struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { - // The response should have this id. - int32 response_id_; - - // The name of the object store. - string16 name_; - - // The keyPath of the object store. - NullableString16 key_path_; - - // Whether the object store created should have a key generator. - bool auto_increment_; - - // The database the object store belongs to. - int32 idb_database_id_; -}; - -// Used to create an index. -struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { - // The response should have this id. - int32 response_id_; - - // The name of the index. - string16 name_; - - // The keyPath of the index. - NullableString16 key_path_; - - // Whether the index created has unique keys. - bool unique_; - - // The object store the index belongs to. - int32 idb_object_store_id_; -}; - -// Used to open an IndexedDB cursor. -struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { - // The response should have this id. - int32 response_id_; - // The serialized left key. - IndexedDBKey left_key_; - // The serialized right key. - IndexedDBKey right_key_; - // The key flags. - int32 flags_; - // The direction of this cursor. - int32 direction_; - // The object store the index belongs to. - int32 idb_object_store_id_; -}; - -// Allows an extension to execute code in a tab. -struct ViewMsg_ExecuteCode_Params { - ViewMsg_ExecuteCode_Params() {} - ViewMsg_ExecuteCode_Params(int request_id, const std::string& extension_id, - const std::vector& host_permissions, - bool is_javascript, const std::string& code, - bool all_frames) - : request_id(request_id), extension_id(extension_id), - host_permissions(host_permissions), is_javascript(is_javascript), - code(code), all_frames(all_frames) { - } - - // The extension API request id, for responding. - int request_id; - - // The ID of the requesting extension. To know which isolated world to - // execute the code inside of. - std::string extension_id; - - // The host permissions of the requesting extension. So that we can check them - // right before injecting, to avoid any race conditions. - std::vector host_permissions; - - // Whether the code is JavaScript or CSS. - bool is_javascript; - - // String of code to execute. - std::string code; - - // Whether to inject into all frames, or only the root frame. - bool all_frames; -}; - -// Parameters for the message that creates a worker thread. -struct ViewHostMsg_CreateWorker_Params { - // URL for the worker script. - GURL url; - - // True if this is a SharedWorker, false if it is a dedicated Worker. - bool is_shared; - - // Name for a SharedWorker, otherwise empty string. - string16 name; - - // The ID of the parent document (unique within parent renderer). - unsigned long long document_id; - - // RenderView routing id used to send messages back to the parent. - int render_view_route_id; - - // The route ID to associate with the worker. If MSG_ROUTING_NONE is passed, - // a new unique ID is created and assigned to the worker. - int route_id; - - // The ID of the parent's appcache host, only valid for dedicated workers. - int parent_appcache_host_id; - - // The ID of the appcache the main shared worker script resource was loaded - // from, only valid for shared workers. - int64 script_resource_appcache_id; -}; - -// Parameters for the message that creates a desktop notification. -struct ViewHostMsg_ShowNotification_Params { - // URL which is the origin that created this notification. - GURL origin; - - // True if this is HTML - bool is_html; - - // URL which contains the HTML contents (if is_html is true), otherwise empty. - GURL contents_url; - - // Contents of the notification if is_html is false. - GURL icon_url; - string16 title; - string16 body; - - // Directionality of the notification. - WebKit::WebTextDirection direction; - - // ReplaceID if this notification should replace an existing one; may be - // empty if no replacement is called for. - string16 replace_id; - - // Notification ID for sending events back for this notification. - int notification_id; -}; - -// Creates a new view via a control message since the view doesn't yet exist. -struct ViewMsg_New_Params { - // The parent window's id. - gfx::NativeViewId parent_window; - - // Renderer-wide preferences. - RendererPreferences renderer_preferences; - - // Preferences for this view. - WebPreferences web_preferences; - - // The ID of the view to be created. - int32 view_id; - - // The session storage namespace ID this view should use. - int64 session_storage_namespace_id; - - // The name of the frame associated with this view (or empty if none). - string16 frame_name; -}; - -struct ViewHostMsg_CreateWindow_Params { - // Routing ID of the view initiating the open. - int opener_id; - - // True if this open request came in the context of a user gesture. - bool user_gesture; - - // Type of window requested. - WindowContainerType window_container_type; - - // The session storage namespace ID this view should use. - int64 session_storage_namespace_id; - - // The name of the resulting frame that should be created (empty if none - // has been specified). - string16 frame_name; -}; - -struct ViewHostMsg_RunFileChooser_Params { - enum Mode { - // Requires that the file exists before allowing the user to pick it. - Open, - - // Like Open, but allows picking multiple files to open. - OpenMultiple, - - // Like Open, but selects a folder. - OpenFolder, - - // Allows picking a nonexistent file, and prompts to overwrite if the file - // already exists. - Save, - }; - - Mode mode; - - // Title to be used for the dialog. This may be empty for the default title, - // which will be either "Open" or "Save" depending on the mode. - string16 title; - - // Default file name to select in the dialog. - FilePath default_file_name; -}; - -struct ViewMsg_ExtensionExtentInfo { - std::string extension_id; - ExtensionExtent web_extent; - ExtensionExtent browse_extent; -}; - -struct ViewMsg_ExtensionExtentsUpdated_Params { - // Describes the installed extension apps and the URLs they cover. - std::vector extension_apps; -}; - -struct ViewMsg_DeviceOrientationUpdated_Params { - // These fields have the same meaning as in device_orientation::Orientation. - bool can_provide_alpha; - double alpha; - bool can_provide_beta; - double beta; - bool can_provide_gamma; - double gamma; -}; +struct WebPreferences; + +// Forward declarations of structures used to store data for when we have a lot +// of parameters. +struct ViewMsg_Navigate_Params; +struct ViewMsg_AudioStreamState_Params; +struct ViewMsg_StopFinding_Params; +struct ViewHostMsg_GetSearchProviderInstallState_Params; +struct ViewHostMsg_FrameNavigate_Params; +struct ViewHostMsg_UpdateRect_Params; +struct ViewMsg_ClosePage_Params; +struct ViewHostMsg_Resource_Request; +struct ViewMsg_Print_Params; +struct ViewMsg_PrintPage_Params; +struct ViewMsg_PrintPages_Params; +struct ViewHostMsg_DidPrintPage_Params; +struct ViewHostMsg_Audio_CreateStream_Params; +struct ViewHostMsg_ShowPopup_Params; +struct ViewHostMsg_ScriptedPrint_Params; +struct ViewMsg_DOMStorageEvent_Params; +struct ViewHostMsg_IDBFactoryOpen_Params; +struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params; +struct ViewHostMsg_IDBObjectStoreCreateIndex_Params; +struct ViewHostMsg_IDBObjectStoreOpenCursor_Params; +struct ViewMsg_ExecuteCode_Params; +struct ViewHostMsg_CreateWorker_Params; +struct ViewHostMsg_ShowNotification_Params; +struct ViewMsg_New_Params; +struct ViewHostMsg_CreateWindow_Params; +struct ViewHostMsg_RunFileChooser_Params; +struct ViewMsg_ExtensionExtentInfo; +struct ViewMsg_ExtensionExtentsUpdated_Params; +struct ViewMsg_DeviceOrientationUpdated_Params; +struct ViewHostMsg_DomMessage_Params; +struct ViewHostMsg_OpenFileSystemRequest_Params; // Values that may be OR'd together to form the 'flags' parameter of the // ViewMsg_EnablePreferredSizeChangedMode message. -enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags { - kPreferredSizeNothing, - kPreferredSizeWidth = 1 << 0, - // Requesting the height currently requires a polling loop in render_view.cc. - kPreferredSizeHeightThisIsSlow = 1 << 1, -}; - -// Parameters structure for ViewHostMsg_ExtensionRequest. -struct ViewHostMsg_DomMessage_Params { - // Message name. - std::string name; - - // List of message arguments. - ListValue arguments; - - // URL of the frame request was sent from. - GURL source_url; - - // Unique request id to match requests and responses. - int request_id; - - // True if request has a callback specified. - bool has_callback; - - // True if request is executed in response to an explicit user gesture. - bool user_gesture; -}; - -struct ViewHostMsg_OpenFileSystemRequest_Params { - // The routing ID of the view initiating the request. - int routing_id; - - // The response should have this id. - int request_id; - - // The origin doing the initiating. - GURL origin_url; - - // The requested FileSystem type. - WebKit::WebFileSystem::Type type; - - // Indicates how much storage space (in bytes) the caller expects to need. - int64 requested_size; -}; - -namespace IPC { - -template <> -struct ParamTraits { - typedef ResourceType::Type param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) - return false; - *p = ResourceType::FromInt(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string type; - switch (p) { - case ResourceType::MAIN_FRAME: - type = "MAIN_FRAME"; - break; - case ResourceType::SUB_FRAME: - type = "SUB_FRAME"; - break; - case ResourceType::SUB_RESOURCE: - type = "SUB_RESOURCE"; - break; - case ResourceType::OBJECT: - type = "OBJECT"; - break; - case ResourceType::MEDIA: - type = "MEDIA"; - break; - default: - type = "UNKNOWN"; - break; - } - - LogParam(type, l); - } -}; - -// Traits for ViewMsg_Navigate_Params structure to pack/unpack. -template <> -struct ParamTraits { - typedef ViewMsg_Navigate_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -template<> -struct ParamTraits { - typedef ViewMsg_Navigate_Params::NavigationType param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string event; - switch (p) { - case ViewMsg_Navigate_Params::RELOAD: - event = "NavigationType_RELOAD"; - break; - - case ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE: - event = "NavigationType_RELOAD_IGNORING_CACHE"; - break; - - case ViewMsg_Navigate_Params::RESTORE: - event = "NavigationType_RESTORE"; - break; - - case ViewMsg_Navigate_Params::NORMAL: - event = "NavigationType_NORMA"; - break; - - default: - event = "NavigationType_UNKNOWN"; - break; - } - LogParam(event, l); - } -}; - -// Traits for FormField_Params structure to pack/unpack. -template <> -struct ParamTraits { - typedef webkit_glue::FormField param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* p); - static void Log(const param_type& p, std::string* l); -}; - -// Traits for FontDescriptor structure to pack/unpack. -template <> -struct ParamTraits { - typedef FontDescriptor param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.font_name); - WriteParam(m, p.font_point_size); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return( - ReadParam(m, iter, &p->font_name) && - ReadParam(m, iter, &p->font_point_size)); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - -// Traits for ViewHostMsg_GetSearchProviderInstallState_Params structure to -// pack/unpack. -template <> -struct ParamTraits { - typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p.state); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - p->state = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string state; - switch (p.state) { - case ViewHostMsg_GetSearchProviderInstallState_Params::DENIED: - state = "ViewHostMsg_GetSearchProviderInstallState_Params::DENIED"; - break; - case ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED: - state = - "ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED"; - break; - case ViewHostMsg_GetSearchProviderInstallState_Params:: - INSTALLED_BUT_NOT_DEFAULT: - state = "ViewHostMsg_GetSearchProviderInstallState_Params::" - "INSTALLED_BUT_NOT_DEFAULT"; - break; - case ViewHostMsg_GetSearchProviderInstallState_Params:: - INSTALLED_AS_DEFAULT: - state = "ViewHostMsg_GetSearchProviderInstallState_Params::" - "INSTALLED_AS_DEFAULT"; - break; - default: - state = "UNKNOWN"; - break; - } - LogParam(state, l); - } -}; - -// Traits for ViewHostMsg_FrameNavigate_Params structure to pack/unpack. -template <> -struct ParamTraits { - typedef ViewHostMsg_FrameNavigate_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.page_id); - WriteParam(m, p.url); - WriteParam(m, p.referrer); - WriteParam(m, p.transition); - WriteParam(m, p.redirects); - WriteParam(m, p.should_update_history); - WriteParam(m, p.searchable_form_url); - WriteParam(m, p.searchable_form_encoding); - WriteParam(m, p.password_form); - WriteParam(m, p.security_info); - WriteParam(m, p.gesture); - WriteParam(m, p.contents_mime_type); - WriteParam(m, p.is_post); - WriteParam(m, p.is_content_filtered); - WriteParam(m, p.http_status_code); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->page_id) && - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->referrer) && - ReadParam(m, iter, &p->transition) && - ReadParam(m, iter, &p->redirects) && - ReadParam(m, iter, &p->should_update_history) && - ReadParam(m, iter, &p->searchable_form_url) && - ReadParam(m, iter, &p->searchable_form_encoding) && - ReadParam(m, iter, &p->password_form) && - ReadParam(m, iter, &p->security_info) && - ReadParam(m, iter, &p->gesture) && - ReadParam(m, iter, &p->contents_mime_type) && - ReadParam(m, iter, &p->is_post) && - ReadParam(m, iter, &p->is_content_filtered) && - ReadParam(m, iter, &p->http_status_code); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.page_id, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.transition, l); - l->append(", "); - LogParam(p.redirects, l); - l->append(", "); - LogParam(p.should_update_history, l); - l->append(", "); - LogParam(p.searchable_form_url, l); - l->append(", "); - LogParam(p.searchable_form_encoding, l); - l->append(", "); - LogParam(p.password_form, l); - l->append(", "); - LogParam(p.security_info, l); - l->append(", "); - LogParam(p.gesture, l); - l->append(", "); - LogParam(p.contents_mime_type, l); - l->append(", "); - LogParam(p.is_post, l); - l->append(", "); - LogParam(p.is_content_filtered, l); - l->append(", "); - LogParam(p.http_status_code, l); - l->append(")"); - } +enum ViewHostMsg_EnablePreferredSizeChangedMode_Flags { + kPreferredSizeNothing, + kPreferredSizeWidth = 1 << 0, + // Requesting the height currently requires a polling loop in render_view.cc. + kPreferredSizeHeightThisIsSlow = 1 << 1, }; +namespace IPC { + +// Traits for FormField_Params structure to pack/unpack. template <> -struct ParamTraits { - typedef ContextMenuParams param_type; +struct ParamTraits { + typedef webkit_glue::FormField param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +#if defined(OS_MACOSX) +// Traits for FontDescriptor structure to pack/unpack. +template <> +struct ParamTraits { + typedef FontDescriptor param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* p); static void Log(const param_type& p, std::string* l); }; +#endif -// Traits for ViewHostMsg_UpdateRect_Params structure to pack/unpack. template <> -struct ParamTraits { - typedef ViewHostMsg_UpdateRect_Params param_type; +struct ParamTraits { + typedef ContextMenuParams param_type; static void Write(Message* m, const param_type& p); static bool Read(const Message* m, void** iter, param_type* p); static void Log(const param_type& p, std::string* l); @@ -1195,143 +182,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -template<> -struct ParamTraits { - typedef NavigationGesture param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string event; - switch (p) { - case NavigationGestureUser: - event = "GESTURE_USER"; - break; - case NavigationGestureAuto: - event = "GESTURE_AUTO"; - break; - default: - event = "GESTURE_UNKNOWN"; - break; - } - LogParam(event, l); - } -}; - -// Traits for ViewMsg_Close_Params. -template <> -struct ParamTraits { - typedef ViewMsg_ClosePage_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.closing_process_id); - WriteParam(m, p.closing_route_id); - WriteParam(m, p.for_cross_site_transition); - WriteParam(m, p.new_render_process_host_id); - WriteParam(m, p.new_request_id); - } - - static bool Read(const Message* m, void** iter, param_type* r) { - return ReadParam(m, iter, &r->closing_process_id) && - ReadParam(m, iter, &r->closing_route_id) && - ReadParam(m, iter, &r->for_cross_site_transition) && - ReadParam(m, iter, &r->new_render_process_host_id) && - ReadParam(m, iter, &r->new_request_id); - } - - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.closing_process_id, l); - l->append(", "); - LogParam(p.closing_route_id, l); - l->append(", "); - LogParam(p.for_cross_site_transition, l); - l->append(", "); - LogParam(p.new_render_process_host_id, l); - l->append(", "); - LogParam(p.new_request_id, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_Resource_Request -template <> -struct ParamTraits { - typedef ViewHostMsg_Resource_Request param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.method); - WriteParam(m, p.url); - WriteParam(m, p.first_party_for_cookies); - WriteParam(m, p.referrer); - WriteParam(m, p.frame_origin); - WriteParam(m, p.main_frame_origin); - WriteParam(m, p.headers); - WriteParam(m, p.load_flags); - WriteParam(m, p.origin_child_id); - WriteParam(m, p.resource_type); - WriteParam(m, p.request_context); - WriteParam(m, p.appcache_host_id); - WriteParam(m, p.upload_data); - WriteParam(m, p.download_to_file); - WriteParam(m, p.host_renderer_id); - WriteParam(m, p.host_render_view_id); - } - static bool Read(const Message* m, void** iter, param_type* r) { - return - ReadParam(m, iter, &r->method) && - ReadParam(m, iter, &r->url) && - ReadParam(m, iter, &r->first_party_for_cookies) && - ReadParam(m, iter, &r->referrer) && - ReadParam(m, iter, &r->frame_origin) && - ReadParam(m, iter, &r->main_frame_origin) && - ReadParam(m, iter, &r->headers) && - ReadParam(m, iter, &r->load_flags) && - ReadParam(m, iter, &r->origin_child_id) && - ReadParam(m, iter, &r->resource_type) && - ReadParam(m, iter, &r->request_context) && - ReadParam(m, iter, &r->appcache_host_id) && - ReadParam(m, iter, &r->upload_data) && - ReadParam(m, iter, &r->download_to_file) && - ReadParam(m, iter, &r->host_renderer_id) && - ReadParam(m, iter, &r->host_render_view_id); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.method, l); - l->append(", "); - LogParam(p.url, l); - l->append(", "); - LogParam(p.referrer, l); - l->append(", "); - LogParam(p.frame_origin, l); - l->append(", "); - LogParam(p.main_frame_origin, l); - l->append(", "); - LogParam(p.load_flags, l); - l->append(", "); - LogParam(p.origin_child_id, l); - l->append(", "); - LogParam(p.resource_type, l); - l->append(", "); - LogParam(p.request_context, l); - l->append(", "); - LogParam(p.appcache_host_id, l); - l->append(", "); - LogParam(p.download_to_file, l); - l->append(", "); - LogParam(p.host_renderer_id, l); - l->append(", "); - LogParam(p.host_render_view_id, l); - l->append(")"); - } -}; - template <> struct ParamTraits > { typedef scoped_refptr param_type; @@ -1546,102 +396,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -// Traits for ViewMsg_Print_Params -template <> -struct ParamTraits { - typedef ViewMsg_Print_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.page_size); - WriteParam(m, p.printable_size); - WriteParam(m, p.margin_top); - WriteParam(m, p.margin_left); - WriteParam(m, p.dpi); - WriteParam(m, p.min_shrink); - WriteParam(m, p.max_shrink); - WriteParam(m, p.desired_dpi); - WriteParam(m, p.document_cookie); - WriteParam(m, p.selection_only); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->page_size) && - ReadParam(m, iter, &p->printable_size) && - ReadParam(m, iter, &p->margin_top) && - ReadParam(m, iter, &p->margin_left) && - ReadParam(m, iter, &p->dpi) && - ReadParam(m, iter, &p->min_shrink) && - ReadParam(m, iter, &p->max_shrink) && - ReadParam(m, iter, &p->desired_dpi) && - ReadParam(m, iter, &p->document_cookie) && - ReadParam(m, iter, &p->selection_only); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - -// Traits for ViewMsg_PrintPage_Params -template <> -struct ParamTraits { - typedef ViewMsg_PrintPage_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.params); - WriteParam(m, p.page_number); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->params) && - ReadParam(m, iter, &p->page_number); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - -// Traits for ViewMsg_PrintPages_Params -template <> -struct ParamTraits { - typedef ViewMsg_PrintPages_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.params); - WriteParam(m, p.pages); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->params) && - ReadParam(m, iter, &p->pages); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - -// Traits for ViewHostMsg_DidPrintPage_Params -template <> -struct ParamTraits { - typedef ViewHostMsg_DidPrintPage_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.metafile_data_handle); - WriteParam(m, p.data_size); - WriteParam(m, p.document_cookie); - WriteParam(m, p.page_number); - WriteParam(m, p.actual_shrink); - WriteParam(m, p.page_size); - WriteParam(m, p.content_area); - WriteParam(m, p.has_visible_overlays); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->metafile_data_handle) && - ReadParam(m, iter, &p->data_size) && - ReadParam(m, iter, &p->document_cookie) && - ReadParam(m, iter, &p->page_number) && - ReadParam(m, iter, &p->actual_shrink) && - ReadParam(m, iter, &p->page_size) && - ReadParam(m, iter, &p->content_area) && - ReadParam(m, iter, &p->has_visible_overlays); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - // Traits for reading/writing CSS Colors template <> struct ParamTraits { @@ -1657,7 +411,6 @@ struct ParamTraits { } }; - // Traits for RendererPreferences structure to pack/unpack. template <> struct ParamTraits { @@ -1685,75 +438,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -// Traits for AudioManager::Format. -template <> -struct ParamTraits { - typedef AudioManager::Format param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string format; - switch (p) { - case AudioManager::AUDIO_PCM_LINEAR: - format = "AUDIO_PCM_LINEAR"; - break; - case AudioManager::AUDIO_PCM_LOW_LATENCY: - format = "AUDIO_PCM_LOW_LATENCY"; - break; - case AudioManager::AUDIO_MOCK: - format = "AUDIO_MOCK"; - break; - default: - format = "AUDIO_LAST_FORMAT"; - break; - } - LogParam(format, l); - } -}; - -// Traits for ViewHostMsg_Audio_CreateStream_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_Audio_CreateStream_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.format); - WriteParam(m, p.channels); - WriteParam(m, p.sample_rate); - WriteParam(m, p.bits_per_sample); - WriteParam(m, p.packet_size); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->format) && - ReadParam(m, iter, &p->channels) && - ReadParam(m, iter, &p->sample_rate) && - ReadParam(m, iter, &p->bits_per_sample) && - ReadParam(m, iter, &p->packet_size); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.format, l); - l->append(", "); - LogParam(p.channels, l); - l->append(", "); - LogParam(p.sample_rate, l); - l->append(", "); - LogParam(p.bits_per_sample, l); - l->append(", "); - LogParam(p.packet_size, l); - l->append(")"); - } -}; - - #if defined(OS_POSIX) // TODO(port): this shouldn't exist. However, the plugin stuff is really using @@ -1780,72 +464,6 @@ struct ParamTraits { #endif // defined(OS_POSIX) template <> -struct ParamTraits { - typedef ViewMsg_AudioStreamState_Params param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p.state); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - p->state = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string state; - switch (p.state) { - case ViewMsg_AudioStreamState_Params::kPlaying: - state = "ViewMsg_AudioStreamState_Params::kPlaying"; - break; - case ViewMsg_AudioStreamState_Params::kPaused: - state = "ViewMsg_AudioStreamState_Params::kPaused"; - break; - case ViewMsg_AudioStreamState_Params::kError: - state = "ViewMsg_AudioStreamState_Params::kError"; - break; - default: - state = "UNKNOWN"; - break; - } - LogParam(state, l); - } -}; - -template <> -struct ParamTraits { - typedef ViewMsg_StopFinding_Params param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p.action); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - p->action = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string action; - switch (p.action) { - case ViewMsg_StopFinding_Params::kClearSelection: - action = "ViewMsg_StopFinding_Params::kClearSelection"; - break; - case ViewMsg_StopFinding_Params::kKeepSelection: - action = "ViewMsg_StopFinding_Params::kKeepSelection"; - break; - case ViewMsg_StopFinding_Params::kActivateSelection: - action = "ViewMsg_StopFinding_Params::kActivateSelection"; - break; - default: - action = "UNKNOWN"; - break; - } - LogParam(action, l); - } -}; - -template <> struct ParamTraits { typedef appcache::Status param_type; static void Write(Message* m, const param_type& p) { @@ -1938,145 +556,11 @@ struct ParamTraits { }; template<> -struct ParamTraits { - typedef WebMenuItem::Type param_type; - static void Write(Message* m, const param_type& p) { - m->WriteInt(p); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int type; - if (!m->ReadInt(iter, &type)) - return false; - *p = static_cast(type); - return true; - } - static void Log(const param_type& p, std::string* l) { - std::string type; - switch (p) { - case WebMenuItem::OPTION: - type = "OPTION"; - break; - case WebMenuItem::GROUP: - type = "GROUP"; - break; - case WebMenuItem::SEPARATOR: - type = "SEPARATOR"; - break; - default: - type = "UNKNOWN"; - break; - } - LogParam(type, l); - } -}; - -template<> struct ParamTraits { typedef WebMenuItem param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.label); - WriteParam(m, p.type); - WriteParam(m, p.enabled); - WriteParam(m, p.checked); - WriteParam(m, p.action); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->label) && - ReadParam(m, iter, &p->type) && - ReadParam(m, iter, &p->enabled) && - ReadParam(m, iter, &p->checked) && - ReadParam(m, iter, &p->action); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.label, l); - l->append(", "); - LogParam(p.type, l); - l->append(", "); - LogParam(p.enabled, l); - l->append(", "); - LogParam(p.checked, l); - l->append(", "); - LogParam(p.action, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_ShowPopup_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_ShowPopup_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.bounds); - WriteParam(m, p.item_height); - WriteParam(m, p.item_font_size); - WriteParam(m, p.selected_item); - WriteParam(m, p.popup_items); - WriteParam(m, p.right_aligned); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->bounds) && - ReadParam(m, iter, &p->item_height) && - ReadParam(m, iter, &p->item_font_size) && - ReadParam(m, iter, &p->selected_item) && - ReadParam(m, iter, &p->popup_items) && - ReadParam(m, iter, &p->right_aligned); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.bounds, l); - l->append(", "); - LogParam(p.item_height, l); - l->append(", "); - LogParam(p.item_font_size, l); - l->append(", "); - LogParam(p.selected_item, l); - l->append(", "); - LogParam(p.popup_items, l); - l->append(", "); - LogParam(p.right_aligned, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_ScriptedPrint_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_ScriptedPrint_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.routing_id); - WriteParam(m, p.host_window_id); - WriteParam(m, p.cookie); - WriteParam(m, p.expected_pages_count); - WriteParam(m, p.has_selection); - WriteParam(m, p.use_overlays); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->routing_id) && - ReadParam(m, iter, &p->host_window_id) && - ReadParam(m, iter, &p->cookie) && - ReadParam(m, iter, &p->expected_pages_count) && - ReadParam(m, iter, &p->has_selection) && - ReadParam(m, iter, &p->use_overlays); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.routing_id, l); - l->append(", "); - LogParam(p.host_window_id, l); - l->append(", "); - LogParam(p.cookie, l); - l->append(", "); - LogParam(p.expected_pages_count, l); - l->append(", "); - LogParam(p.has_selection, l); - l->append(","); - LogParam(p.use_overlays, l); - l->append(")"); - } + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); }; template <> @@ -2205,280 +689,6 @@ struct ParamTraits { } }; -// Traits for ViewMsg_DOMStorageEvent_Params. -template <> -struct ParamTraits { - typedef ViewMsg_DOMStorageEvent_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.key_); - WriteParam(m, p.old_value_); - WriteParam(m, p.new_value_); - WriteParam(m, p.origin_); - WriteParam(m, p.url_); - WriteParam(m, p.storage_type_); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->key_) && - ReadParam(m, iter, &p->old_value_) && - ReadParam(m, iter, &p->new_value_) && - ReadParam(m, iter, &p->origin_) && - ReadParam(m, iter, &p->url_) && - ReadParam(m, iter, &p->storage_type_); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.key_, l); - l->append(", "); - LogParam(p.old_value_, l); - l->append(", "); - LogParam(p.new_value_, l); - l->append(", "); - LogParam(p.origin_, l); - l->append(", "); - LogParam(p.url_, l); - l->append(", "); - LogParam(p.storage_type_, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_IDBFactoryOpen_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_IDBFactoryOpen_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.routing_id_); - WriteParam(m, p.response_id_); - WriteParam(m, p.origin_); - WriteParam(m, p.name_); - WriteParam(m, p.description_); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->routing_id_) && - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->origin_) && - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->description_); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.routing_id_, l); - l->append(", "); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.origin_, l); - l->append(", "); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.description_, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_IDBDatabaseCreateObjectStore_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_IDBDatabaseCreateObjectStore_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.auto_increment_); - WriteParam(m, p.idb_database_id_); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->auto_increment_) && - ReadParam(m, iter, &p->idb_database_id_); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.auto_increment_, l); - l->append(", "); - LogParam(p.idb_database_id_, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_IDBObjectStoreCreateIndex_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_IDBObjectStoreCreateIndex_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.name_); - WriteParam(m, p.key_path_); - WriteParam(m, p.unique_); - WriteParam(m, p.idb_object_store_id_); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->name_) && - ReadParam(m, iter, &p->key_path_) && - ReadParam(m, iter, &p->unique_) && - ReadParam(m, iter, &p->idb_object_store_id_); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.name_, l); - l->append(", "); - LogParam(p.key_path_, l); - l->append(", "); - LogParam(p.unique_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_IDBObjectStoreOpenCursor_Params. -template <> -struct ParamTraits { - typedef ViewHostMsg_IDBObjectStoreOpenCursor_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.response_id_); - WriteParam(m, p.left_key_); - WriteParam(m, p.right_key_); - WriteParam(m, p.flags_); - WriteParam(m, p.direction_); - WriteParam(m, p.idb_object_store_id_); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->response_id_) && - ReadParam(m, iter, &p->left_key_) && - ReadParam(m, iter, &p->right_key_) && - ReadParam(m, iter, &p->flags_) && - ReadParam(m, iter, &p->direction_) && - ReadParam(m, iter, &p->idb_object_store_id_); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.response_id_, l); - l->append(", "); - LogParam(p.left_key_, l); - l->append(", "); - LogParam(p.right_key_, l); - l->append(", "); - LogParam(p.flags_, l); - l->append(", "); - LogParam(p.direction_, l); - l->append(", "); - LogParam(p.idb_object_store_id_, l); - l->append(")"); - } -}; - -// Traits for ViewHostMsg_CreateWorker_Params -template <> -struct ParamTraits { - typedef ViewHostMsg_CreateWorker_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.url); - WriteParam(m, p.is_shared); - WriteParam(m, p.name); - WriteParam(m, p.document_id); - WriteParam(m, p.render_view_route_id); - WriteParam(m, p.route_id); - WriteParam(m, p.parent_appcache_host_id); - WriteParam(m, p.script_resource_appcache_id); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->url) && - ReadParam(m, iter, &p->is_shared) && - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->document_id) && - ReadParam(m, iter, &p->render_view_route_id) && - ReadParam(m, iter, &p->route_id) && - ReadParam(m, iter, &p->parent_appcache_host_id) && - ReadParam(m, iter, &p->script_resource_appcache_id); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.url, l); - l->append(", "); - LogParam(p.is_shared, l); - l->append(", "); - LogParam(p.name, l); - l->append(", "); - LogParam(p.document_id, l); - l->append(", "); - LogParam(p.render_view_route_id, l); - l->append(","); - LogParam(p.route_id, l); - l->append(", "); - LogParam(p.parent_appcache_host_id, l); - l->append(","); - LogParam(p.script_resource_appcache_id, l); - l->append(")"); - } -}; - -// Traits for ShowNotification_Params -template <> -struct ParamTraits { - typedef ViewHostMsg_ShowNotification_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.origin); - WriteParam(m, p.is_html); - WriteParam(m, p.contents_url); - WriteParam(m, p.icon_url); - WriteParam(m, p.title); - WriteParam(m, p.body); - WriteParam(m, p.direction); - WriteParam(m, p.replace_id); - WriteParam(m, p.notification_id); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->origin) && - ReadParam(m, iter, &p->is_html) && - ReadParam(m, iter, &p->contents_url) && - ReadParam(m, iter, &p->icon_url) && - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->body) && - ReadParam(m, iter, &p->direction) && - ReadParam(m, iter, &p->replace_id) && - ReadParam(m, iter, &p->notification_id); - } - static void Log(const param_type &p, std::string* l) { - l->append("("); - LogParam(p.origin, l); - l->append(", "); - LogParam(p.is_html, l); - l->append(", "); - LogParam(p.contents_url, l); - l->append(", "); - LogParam(p.icon_url, l); - l->append(", "); - LogParam(p.title, l); - l->append(","); - LogParam(p.body, l); - l->append(","); - LogParam(p.direction, l); - l->append(","); - LogParam(p.replace_id, l); - l->append(","); - LogParam(p.notification_id, l); - l->append(")"); - } -}; - // Traits for WebCookie template <> struct ParamTraits { @@ -2488,152 +698,11 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -template<> -struct ParamTraits { - typedef ViewMsg_ExecuteCode_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.request_id); - WriteParam(m, p.extension_id); - WriteParam(m, p.host_permissions); - WriteParam(m, p.is_javascript); - WriteParam(m, p.code); - WriteParam(m, p.all_frames); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->request_id) && - ReadParam(m, iter, &p->extension_id) && - ReadParam(m, iter, &p->host_permissions) && - ReadParam(m, iter, &p->is_javascript) && - ReadParam(m, iter, &p->code) && - ReadParam(m, iter, &p->all_frames); - } - static void Log(const param_type& p, std::string* l) { - l->append(""); - } -}; - -template<> -struct ParamTraits { - typedef ViewMsg_New_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.parent_window); - WriteParam(m, p.renderer_preferences); - WriteParam(m, p.web_preferences); - WriteParam(m, p.view_id); - WriteParam(m, p.session_storage_namespace_id); - WriteParam(m, p.frame_name); - } - - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->parent_window) && - ReadParam(m, iter, &p->renderer_preferences) && - ReadParam(m, iter, &p->web_preferences) && - ReadParam(m, iter, &p->view_id) && - ReadParam(m, iter, &p->session_storage_namespace_id) && - ReadParam(m, iter, &p->frame_name); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.parent_window, l); - l->append(", "); - LogParam(p.renderer_preferences, l); - l->append(", "); - LogParam(p.web_preferences, l); - l->append(", "); - LogParam(p.view_id, l); - l->append(", "); - LogParam(p.session_storage_namespace_id, l); - l->append(", "); - LogParam(p.frame_name, l); - l->append(")"); - } -}; - template <> struct SimilarTypeTraits { typedef int Type; }; -template<> -struct ParamTraits { - typedef ViewHostMsg_RunFileChooser_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, static_cast(p.mode)); - WriteParam(m, p.title); - WriteParam(m, p.default_file_name); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int mode; - if (!ReadParam(m, iter, &mode)) - return false; - if (mode != param_type::Open && - mode != param_type::OpenMultiple && - mode != param_type::OpenFolder && - mode != param_type::Save) - return false; - p->mode = static_cast(mode); - return - ReadParam(m, iter, &p->title) && - ReadParam(m, iter, &p->default_file_name); - }; - static void Log(const param_type& p, std::string* l) { - switch (p.mode) { - case param_type::Open: - l->append("(Open, "); - break; - case param_type::OpenMultiple: - l->append("(OpenMultiple, "); - break; - case param_type::OpenFolder: - l->append("(OpenFolder, "); - break; - case param_type::Save: - l->append("(Save, "); - break; - default: - l->append("(UNKNOWN, "); - } - LogParam(p.title, l); - l->append(", "); - LogParam(p.default_file_name, l); - } -}; - -template<> -struct ParamTraits { - typedef ViewHostMsg_CreateWindow_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.opener_id); - WriteParam(m, p.user_gesture); - WriteParam(m, p.window_container_type); - WriteParam(m, p.session_storage_namespace_id); - WriteParam(m, p.frame_name); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->opener_id) && - ReadParam(m, iter, &p->user_gesture) && - ReadParam(m, iter, &p->window_container_type) && - ReadParam(m, iter, &p->session_storage_namespace_id) && - ReadParam(m, iter, &p->frame_name); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.opener_id, l); - l->append(", "); - LogParam(p.user_gesture, l); - l->append(", "); - LogParam(p.window_container_type, l); - l->append(", "); - LogParam(p.session_storage_namespace_id, l); - l->append(", "); - LogParam(p.frame_name, l); - l->append(")"); - } -}; - template <> struct ParamTraits { typedef ExtensionExtent param_type; @@ -2642,38 +711,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -template <> -struct ParamTraits { - typedef ViewMsg_ExtensionExtentInfo param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.extension_id); - WriteParam(m, p.web_extent); - WriteParam(m, p.browse_extent); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->extension_id) && - ReadParam(m, iter, &p->web_extent) && - ReadParam(m, iter, &p->browse_extent); - } - static void Log(const param_type& p, std::string* l) { - LogParam(p.extension_id, l); - } -}; - -template <> -struct ParamTraits { - typedef ViewMsg_ExtensionExtentsUpdated_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.extension_apps); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return ReadParam(m, iter, &p->extension_apps); - } - static void Log(const param_type& p, std::string* l) { - LogParam(p.extension_apps, l); - } -}; - template<> struct ParamTraits { typedef appcache::AppCacheResourceInfo param_type; @@ -2691,27 +728,6 @@ struct ParamTraits { }; template <> -struct ParamTraits { - typedef WindowContainerType param_type; - static void Write(Message* m, const param_type& p) { - int val = static_cast(p); - WriteParam(m, val); - } - static bool Read(const Message* m, void** iter, param_type* p) { - int val = 0; - if (!ReadParam(m, iter, &val) || - val < WINDOW_CONTAINER_TYPE_NORMAL || - val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) - return false; - *p = static_cast(val); - return true; - } - static void Log(const param_type& p, std::string* l) { - ParamTraits::Log(static_cast(p), l); - } -}; - -template <> struct ParamTraits { typedef webkit_glue::WebAccessibility param_type; static void Write(Message* m, const param_type& p); @@ -2719,115 +735,6 @@ struct ParamTraits { static void Log(const param_type& p, std::string* l); }; -// Traits for ViewMsg_DeviceOrientationUpdated_Params -// structure to pack/unpack. -template <> -struct ParamTraits { - typedef ViewMsg_DeviceOrientationUpdated_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.can_provide_alpha); - WriteParam(m, p.alpha); - WriteParam(m, p.can_provide_beta); - WriteParam(m, p.beta); - WriteParam(m, p.can_provide_gamma); - WriteParam(m, p.gamma); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->can_provide_alpha) && - ReadParam(m, iter, &p->alpha) && - ReadParam(m, iter, &p->can_provide_beta) && - ReadParam(m, iter, &p->beta) && - ReadParam(m, iter, &p->can_provide_gamma) && - ReadParam(m, iter, &p->gamma); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.can_provide_alpha, l); - l->append(", "); - LogParam(p.alpha, l); - l->append(", "); - LogParam(p.can_provide_beta, l); - l->append(", "); - LogParam(p.beta, l); - l->append(", "); - LogParam(p.can_provide_gamma, l); - l->append(", "); - LogParam(p.gamma, l); - l->append(")"); - } -}; -// Traits for ViewHostMsg_DomMessage_Params structure to pack/unpack. -template <> -struct ParamTraits { - typedef ViewHostMsg_DomMessage_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.name); - WriteParam(m, p.arguments); - WriteParam(m, p.source_url); - WriteParam(m, p.request_id); - WriteParam(m, p.has_callback); - WriteParam(m, p.user_gesture); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->name) && - ReadParam(m, iter, &p->arguments) && - ReadParam(m, iter, &p->source_url) && - ReadParam(m, iter, &p->request_id) && - ReadParam(m, iter, &p->has_callback) && - ReadParam(m, iter, &p->user_gesture); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.name, l); - l->append(", "); - LogParam(p.arguments, l); - l->append(", "); - LogParam(p.source_url, l); - l->append(", "); - LogParam(p.request_id, l); - l->append(", "); - LogParam(p.has_callback, l); - l->append(", "); - LogParam(p.user_gesture, l); - l->append(")"); - } -}; - -template <> -struct ParamTraits { - typedef ViewHostMsg_OpenFileSystemRequest_Params param_type; - static void Write(Message* m, const param_type& p) { - WriteParam(m, p.routing_id); - WriteParam(m, p.request_id); - WriteParam(m, p.origin_url); - WriteParam(m, p.type); - WriteParam(m, p.requested_size); - } - static bool Read(const Message* m, void** iter, param_type* p) { - return - ReadParam(m, iter, &p->routing_id) && - ReadParam(m, iter, &p->request_id) && - ReadParam(m, iter, &p->origin_url) && - ReadParam(m, iter, &p->type) && - ReadParam(m, iter, &p->requested_size); - } - static void Log(const param_type& p, std::string* l) { - l->append("("); - LogParam(p.routing_id, l); - l->append(", "); - LogParam(p.request_id, l); - l->append(", "); - LogParam(p.origin_url, l); - l->append(", "); - LogParam(p.type, l); - l->append(", "); - LogParam(p.requested_size, l); - l->append(")"); - } -}; - } // namespace IPC #define MESSAGES_INTERNAL_FILE "chrome/common/render_messages_internal.h" diff --git a/chrome/common/render_messages_params.cc b/chrome/common/render_messages_params.cc new file mode 100644 index 0000000..edf6378 --- /dev/null +++ b/chrome/common/render_messages_params.cc @@ -0,0 +1,1420 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/render_messages_params.h" + +#include "chrome/common/navigation_gesture.h" +#include "chrome/common/common_param_traits.h" +#include "chrome/common/indexed_db_param_traits.h" +#include "chrome/common/render_messages.h" +#include "net/base/upload_data.h" + +bool ViewMsg_Print_Params::Equals(const ViewMsg_Print_Params& rhs) const { + return page_size == rhs.page_size && + printable_size == rhs.printable_size && + margin_top == rhs.margin_top && + margin_left == rhs.margin_left && + dpi == rhs.dpi && + min_shrink == rhs.min_shrink && + max_shrink == rhs.max_shrink && + desired_dpi == rhs.desired_dpi && + selection_only == rhs.selection_only; +} + +bool ViewMsg_Print_Params::IsEmpty() const { + return !document_cookie && !desired_dpi && !max_shrink && !min_shrink && + !dpi && printable_size.IsEmpty() && !selection_only && + page_size.IsEmpty() && !margin_top && !margin_left; +} + +ViewMsg_ExecuteCode_Params::ViewMsg_ExecuteCode_Params() { +} + +ViewMsg_ExecuteCode_Params::ViewMsg_ExecuteCode_Params( + int request_id, + const std::string& extension_id, + const std::vector& host_permissions, + bool is_javascript, + const std::string& code, + bool all_frames) + : request_id(request_id), extension_id(extension_id), + host_permissions(host_permissions), is_javascript(is_javascript), + code(code), all_frames(all_frames) { +} + +namespace IPC { + +// Self contained templates which are only used inside serializing Params +// structs. +template<> +struct ParamTraits { + typedef ViewMsg_Navigate_Params::NavigationType param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + std::string event; + switch (p) { + case ViewMsg_Navigate_Params::RELOAD: + event = "NavigationType_RELOAD"; + break; + + case ViewMsg_Navigate_Params::RELOAD_IGNORING_CACHE: + event = "NavigationType_RELOAD_IGNORING_CACHE"; + break; + + case ViewMsg_Navigate_Params::RESTORE: + event = "NavigationType_RESTORE"; + break; + + case ViewMsg_Navigate_Params::NORMAL: + event = "NavigationType_NORMA"; + break; + + default: + event = "NavigationType_UNKNOWN"; + break; + } + LogParam(event, l); + } +}; + +template <> +struct ParamTraits { + typedef ResourceType::Type param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type) || !ResourceType::ValidType(type)) + return false; + *p = ResourceType::FromInt(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + std::string type; + switch (p) { + case ResourceType::MAIN_FRAME: + type = "MAIN_FRAME"; + break; + case ResourceType::SUB_FRAME: + type = "SUB_FRAME"; + break; + case ResourceType::SUB_RESOURCE: + type = "SUB_RESOURCE"; + break; + case ResourceType::OBJECT: + type = "OBJECT"; + break; + case ResourceType::MEDIA: + type = "MEDIA"; + break; + default: + type = "UNKNOWN"; + break; + } + + LogParam(type, l); + } +}; + +template<> +struct ParamTraits { + typedef NavigationGesture param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + std::string event; + switch (p) { + case NavigationGestureUser: + event = "GESTURE_USER"; + break; + case NavigationGestureAuto: + event = "GESTURE_AUTO"; + break; + default: + event = "GESTURE_UNKNOWN"; + break; + } + LogParam(event, l); + } +}; + +// Traits for AudioManager::Format. +template <> +struct ParamTraits { + typedef AudioManager::Format param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + std::string format; + switch (p) { + case AudioManager::AUDIO_PCM_LINEAR: + format = "AUDIO_PCM_LINEAR"; + break; + case AudioManager::AUDIO_PCM_LOW_LATENCY: + format = "AUDIO_PCM_LOW_LATENCY"; + break; + case AudioManager::AUDIO_MOCK: + format = "AUDIO_MOCK"; + break; + default: + format = "AUDIO_LAST_FORMAT"; + break; + } + LogParam(format, l); + } +}; + +template <> +struct ParamTraits { + typedef WindowContainerType param_type; + static void Write(Message* m, const param_type& p) { + int val = static_cast(p); + WriteParam(m, val); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int val = 0; + if (!ReadParam(m, iter, &val) || + val < WINDOW_CONTAINER_TYPE_NORMAL || + val >= WINDOW_CONTAINER_TYPE_MAX_VALUE) + return false; + *p = static_cast(val); + return true; + } + static void Log(const param_type& p, std::string* l) { + ParamTraits::Log(static_cast(p), l); + } +}; + +void ParamTraits::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::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::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.page_id, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.transition, l); + l->append(", "); + LogParam(p.state, l); + l->append(", "); + LogParam(p.navigation_type, l); + l->append(", "); + LogParam(p.request_time, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + m->WriteInt(p.state); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + p->state = static_cast(type); + return true; +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + std::string state; + switch (p.state) { + case ViewMsg_AudioStreamState_Params::kPlaying: + state = "ViewMsg_AudioStreamState_Params::kPlaying"; + break; + case ViewMsg_AudioStreamState_Params::kPaused: + state = "ViewMsg_AudioStreamState_Params::kPaused"; + break; + case ViewMsg_AudioStreamState_Params::kError: + state = "ViewMsg_AudioStreamState_Params::kError"; + break; + default: + state = "UNKNOWN"; + break; + } + LogParam(state, l); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + m->WriteInt(p.action); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + p->action = static_cast(type); + return true; +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + std::string action; + switch (p.action) { + case ViewMsg_StopFinding_Params::kClearSelection: + action = "ViewMsg_StopFinding_Params::kClearSelection"; + break; + case ViewMsg_StopFinding_Params::kKeepSelection: + action = "ViewMsg_StopFinding_Params::kKeepSelection"; + break; + case ViewMsg_StopFinding_Params::kActivateSelection: + action = "ViewMsg_StopFinding_Params::kActivateSelection"; + break; + default: + action = "UNKNOWN"; + break; + } + LogParam(action, l); +} + +void ParamTraits::Write( + Message* m, const param_type& p) { + m->WriteInt(p.state); +} + +bool ParamTraits::Read( + const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + p->state = static_cast(type); + return true; +} + +void ParamTraits::Log( + const param_type& p, std::string* l) { + std::string state; + switch (p.state) { + case ViewHostMsg_GetSearchProviderInstallState_Params::DENIED: + state = "ViewHostMsg_GetSearchProviderInstallState_Params::DENIED"; + break; + case ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED: + state = + "ViewHostMsg_GetSearchProviderInstallState_Params::NOT_INSTALLED"; + break; + case ViewHostMsg_GetSearchProviderInstallState_Params:: + INSTALLED_BUT_NOT_DEFAULT: + state = "ViewHostMsg_GetSearchProviderInstallState_Params::" + "INSTALLED_BUT_NOT_DEFAULT"; + break; + case ViewHostMsg_GetSearchProviderInstallState_Params:: + INSTALLED_AS_DEFAULT: + state = "ViewHostMsg_GetSearchProviderInstallState_Params::" + "INSTALLED_AS_DEFAULT"; + break; + default: + state = "UNKNOWN"; + break; + } + LogParam(state, l); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.page_id); + WriteParam(m, p.url); + WriteParam(m, p.referrer); + WriteParam(m, p.transition); + WriteParam(m, p.redirects); + WriteParam(m, p.should_update_history); + WriteParam(m, p.searchable_form_url); + WriteParam(m, p.searchable_form_encoding); + WriteParam(m, p.password_form); + WriteParam(m, p.security_info); + WriteParam(m, p.gesture); + WriteParam(m, p.contents_mime_type); + WriteParam(m, p.is_post); + WriteParam(m, p.is_content_filtered); + WriteParam(m, p.http_status_code); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->page_id) && + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->referrer) && + ReadParam(m, iter, &p->transition) && + ReadParam(m, iter, &p->redirects) && + ReadParam(m, iter, &p->should_update_history) && + ReadParam(m, iter, &p->searchable_form_url) && + ReadParam(m, iter, &p->searchable_form_encoding) && + ReadParam(m, iter, &p->password_form) && + ReadParam(m, iter, &p->security_info) && + ReadParam(m, iter, &p->gesture) && + ReadParam(m, iter, &p->contents_mime_type) && + ReadParam(m, iter, &p->is_post) && + ReadParam(m, iter, &p->is_content_filtered) && + ReadParam(m, iter, &p->http_status_code); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.page_id, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.transition, l); + l->append(", "); + LogParam(p.redirects, l); + l->append(", "); + LogParam(p.should_update_history, l); + l->append(", "); + LogParam(p.searchable_form_url, l); + l->append(", "); + LogParam(p.searchable_form_encoding, l); + l->append(", "); + LogParam(p.password_form, l); + l->append(", "); + LogParam(p.security_info, l); + l->append(", "); + LogParam(p.gesture, l); + l->append(", "); + LogParam(p.contents_mime_type, l); + l->append(", "); + LogParam(p.is_post, l); + l->append(", "); + LogParam(p.is_content_filtered, l); + l->append(", "); + LogParam(p.http_status_code, l); + l->append(")"); +} + +void ParamTraits::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::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::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.bitmap, l); + l->append(", "); + LogParam(p.bitmap_rect, l); + l->append(", "); + LogParam(p.dx, l); + l->append(", "); + LogParam(p.dy, l); + l->append(", "); + LogParam(p.scroll_rect, l); + l->append(", "); + LogParam(p.copy_rects, l); + l->append(", "); + LogParam(p.view_size, l); + l->append(", "); + LogParam(p.plugin_window_moves, l); + l->append(", "); + LogParam(p.flags, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.closing_process_id); + WriteParam(m, p.closing_route_id); + WriteParam(m, p.for_cross_site_transition); + WriteParam(m, p.new_render_process_host_id); + WriteParam(m, p.new_request_id); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* r) { + return ReadParam(m, iter, &r->closing_process_id) && + ReadParam(m, iter, &r->closing_route_id) && + ReadParam(m, iter, &r->for_cross_site_transition) && + ReadParam(m, iter, &r->new_render_process_host_id) && + ReadParam(m, iter, &r->new_request_id); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.closing_process_id, l); + l->append(", "); + LogParam(p.closing_route_id, l); + l->append(", "); + LogParam(p.for_cross_site_transition, l); + l->append(", "); + LogParam(p.new_render_process_host_id, l); + l->append(", "); + LogParam(p.new_request_id, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.method); + WriteParam(m, p.url); + WriteParam(m, p.first_party_for_cookies); + WriteParam(m, p.referrer); + WriteParam(m, p.frame_origin); + WriteParam(m, p.main_frame_origin); + WriteParam(m, p.headers); + WriteParam(m, p.load_flags); + WriteParam(m, p.origin_child_id); + WriteParam(m, p.resource_type); + WriteParam(m, p.request_context); + WriteParam(m, p.appcache_host_id); + WriteParam(m, p.upload_data); + WriteParam(m, p.download_to_file); + WriteParam(m, p.host_renderer_id); + WriteParam(m, p.host_render_view_id); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* r) { + return + ReadParam(m, iter, &r->method) && + ReadParam(m, iter, &r->url) && + ReadParam(m, iter, &r->first_party_for_cookies) && + ReadParam(m, iter, &r->referrer) && + ReadParam(m, iter, &r->frame_origin) && + ReadParam(m, iter, &r->main_frame_origin) && + ReadParam(m, iter, &r->headers) && + ReadParam(m, iter, &r->load_flags) && + ReadParam(m, iter, &r->origin_child_id) && + ReadParam(m, iter, &r->resource_type) && + ReadParam(m, iter, &r->request_context) && + ReadParam(m, iter, &r->appcache_host_id) && + ReadParam(m, iter, &r->upload_data) && + ReadParam(m, iter, &r->download_to_file) && + ReadParam(m, iter, &r->host_renderer_id) && + ReadParam(m, iter, &r->host_render_view_id); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.method, l); + l->append(", "); + LogParam(p.url, l); + l->append(", "); + LogParam(p.referrer, l); + l->append(", "); + LogParam(p.frame_origin, l); + l->append(", "); + LogParam(p.main_frame_origin, l); + l->append(", "); + LogParam(p.load_flags, l); + l->append(", "); + LogParam(p.origin_child_id, l); + l->append(", "); + LogParam(p.resource_type, l); + l->append(", "); + LogParam(p.request_context, l); + l->append(", "); + LogParam(p.appcache_host_id, l); + l->append(", "); + LogParam(p.download_to_file, l); + l->append(", "); + LogParam(p.host_renderer_id, l); + l->append(", "); + LogParam(p.host_render_view_id, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, const param_type& p) { + WriteParam(m, p.page_size); + WriteParam(m, p.printable_size); + WriteParam(m, p.margin_top); + WriteParam(m, p.margin_left); + WriteParam(m, p.dpi); + WriteParam(m, p.min_shrink); + WriteParam(m, p.max_shrink); + WriteParam(m, p.desired_dpi); + WriteParam(m, p.document_cookie); + WriteParam(m, p.selection_only); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->page_size) && + ReadParam(m, iter, &p->printable_size) && + ReadParam(m, iter, &p->margin_top) && + ReadParam(m, iter, &p->margin_left) && + ReadParam(m, iter, &p->dpi) && + ReadParam(m, iter, &p->min_shrink) && + ReadParam(m, iter, &p->max_shrink) && + ReadParam(m, iter, &p->desired_dpi) && + ReadParam(m, iter, &p->document_cookie) && + ReadParam(m, iter, &p->selection_only); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append(""); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.params); + WriteParam(m, p.page_number); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->params) && + ReadParam(m, iter, &p->page_number); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append(""); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.params); + WriteParam(m, p.pages); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->params) && + ReadParam(m, iter, &p->pages); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append(""); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.metafile_data_handle); + WriteParam(m, p.data_size); + WriteParam(m, p.document_cookie); + WriteParam(m, p.page_number); + WriteParam(m, p.actual_shrink); + WriteParam(m, p.page_size); + WriteParam(m, p.content_area); + WriteParam(m, p.has_visible_overlays); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->metafile_data_handle) && + ReadParam(m, iter, &p->data_size) && + ReadParam(m, iter, &p->document_cookie) && + ReadParam(m, iter, &p->page_number) && + ReadParam(m, iter, &p->actual_shrink) && + ReadParam(m, iter, &p->page_size) && + ReadParam(m, iter, &p->content_area) && + ReadParam(m, iter, &p->has_visible_overlays); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append(""); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.format); + WriteParam(m, p.channels); + WriteParam(m, p.sample_rate); + WriteParam(m, p.bits_per_sample); + WriteParam(m, p.packet_size); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->format) && + ReadParam(m, iter, &p->channels) && + ReadParam(m, iter, &p->sample_rate) && + ReadParam(m, iter, &p->bits_per_sample) && + ReadParam(m, iter, &p->packet_size); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.format, l); + l->append(", "); + LogParam(p.channels, l); + l->append(", "); + LogParam(p.sample_rate, l); + l->append(", "); + LogParam(p.bits_per_sample, l); + l->append(", "); + LogParam(p.packet_size, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.bounds); + WriteParam(m, p.item_height); + WriteParam(m, p.item_font_size); + WriteParam(m, p.selected_item); + WriteParam(m, p.popup_items); + WriteParam(m, p.right_aligned); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->bounds) && + ReadParam(m, iter, &p->item_height) && + ReadParam(m, iter, &p->item_font_size) && + ReadParam(m, iter, &p->selected_item) && + ReadParam(m, iter, &p->popup_items) && + ReadParam(m, iter, &p->right_aligned); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.bounds, l); + l->append(", "); + LogParam(p.item_height, l); + l->append(", "); + LogParam(p.item_font_size, l); + l->append(", "); + LogParam(p.selected_item, l); + l->append(", "); + LogParam(p.popup_items, l); + l->append(", "); + LogParam(p.right_aligned, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.routing_id); + WriteParam(m, p.host_window_id); + WriteParam(m, p.cookie); + WriteParam(m, p.expected_pages_count); + WriteParam(m, p.has_selection); + WriteParam(m, p.use_overlays); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->routing_id) && + ReadParam(m, iter, &p->host_window_id) && + ReadParam(m, iter, &p->cookie) && + ReadParam(m, iter, &p->expected_pages_count) && + ReadParam(m, iter, &p->has_selection) && + ReadParam(m, iter, &p->use_overlays); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.routing_id, l); + l->append(", "); + LogParam(p.host_window_id, l); + l->append(", "); + LogParam(p.cookie, l); + l->append(", "); + LogParam(p.expected_pages_count, l); + l->append(", "); + LogParam(p.has_selection, l); + l->append(","); + LogParam(p.use_overlays, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.key_); + WriteParam(m, p.old_value_); + WriteParam(m, p.new_value_); + WriteParam(m, p.origin_); + WriteParam(m, p.url_); + WriteParam(m, p.storage_type_); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->key_) && + ReadParam(m, iter, &p->old_value_) && + ReadParam(m, iter, &p->new_value_) && + ReadParam(m, iter, &p->origin_) && + ReadParam(m, iter, &p->url_) && + ReadParam(m, iter, &p->storage_type_); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.key_, l); + l->append(", "); + LogParam(p.old_value_, l); + l->append(", "); + LogParam(p.new_value_, l); + l->append(", "); + LogParam(p.origin_, l); + l->append(", "); + LogParam(p.url_, l); + l->append(", "); + LogParam(p.storage_type_, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.routing_id_); + WriteParam(m, p.response_id_); + WriteParam(m, p.origin_); + WriteParam(m, p.name_); + WriteParam(m, p.description_); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->routing_id_) && + ReadParam(m, iter, &p->response_id_) && + ReadParam(m, iter, &p->origin_) && + ReadParam(m, iter, &p->name_) && + ReadParam(m, iter, &p->description_); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.routing_id_, l); + l->append(", "); + LogParam(p.response_id_, l); + l->append(", "); + LogParam(p.origin_, l); + l->append(", "); + LogParam(p.name_, l); + l->append(", "); + LogParam(p.description_, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id_); + WriteParam(m, p.name_); + WriteParam(m, p.key_path_); + WriteParam(m, p.auto_increment_); + WriteParam(m, p.idb_database_id_); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id_) && + ReadParam(m, iter, &p->name_) && + ReadParam(m, iter, &p->key_path_) && + ReadParam(m, iter, &p->auto_increment_) && + ReadParam(m, iter, &p->idb_database_id_); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id_, l); + l->append(", "); + LogParam(p.name_, l); + l->append(", "); + LogParam(p.key_path_, l); + l->append(", "); + LogParam(p.auto_increment_, l); + l->append(", "); + LogParam(p.idb_database_id_, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id_); + WriteParam(m, p.name_); + WriteParam(m, p.key_path_); + WriteParam(m, p.unique_); + WriteParam(m, p.idb_object_store_id_); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id_) && + ReadParam(m, iter, &p->name_) && + ReadParam(m, iter, &p->key_path_) && + ReadParam(m, iter, &p->unique_) && + ReadParam(m, iter, &p->idb_object_store_id_); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id_, l); + l->append(", "); + LogParam(p.name_, l); + l->append(", "); + LogParam(p.key_path_, l); + l->append(", "); + LogParam(p.unique_, l); + l->append(", "); + LogParam(p.idb_object_store_id_, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.response_id_); + WriteParam(m, p.left_key_); + WriteParam(m, p.right_key_); + WriteParam(m, p.flags_); + WriteParam(m, p.direction_); + WriteParam(m, p.idb_object_store_id_); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->response_id_) && + ReadParam(m, iter, &p->left_key_) && + ReadParam(m, iter, &p->right_key_) && + ReadParam(m, iter, &p->flags_) && + ReadParam(m, iter, &p->direction_) && + ReadParam(m, iter, &p->idb_object_store_id_); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.response_id_, l); + l->append(", "); + LogParam(p.left_key_, l); + l->append(", "); + LogParam(p.right_key_, l); + l->append(", "); + LogParam(p.flags_, l); + l->append(", "); + LogParam(p.direction_, l); + l->append(", "); + LogParam(p.idb_object_store_id_, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.request_id); + WriteParam(m, p.extension_id); + WriteParam(m, p.host_permissions); + WriteParam(m, p.is_javascript); + WriteParam(m, p.code); + WriteParam(m, p.all_frames); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->request_id) && + ReadParam(m, iter, &p->extension_id) && + ReadParam(m, iter, &p->host_permissions) && + ReadParam(m, iter, &p->is_javascript) && + ReadParam(m, iter, &p->code) && + ReadParam(m, iter, &p->all_frames); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append(""); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.url); + WriteParam(m, p.is_shared); + WriteParam(m, p.name); + WriteParam(m, p.document_id); + WriteParam(m, p.render_view_route_id); + WriteParam(m, p.route_id); + WriteParam(m, p.parent_appcache_host_id); + WriteParam(m, p.script_resource_appcache_id); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->url) && + ReadParam(m, iter, &p->is_shared) && + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->document_id) && + ReadParam(m, iter, &p->render_view_route_id) && + ReadParam(m, iter, &p->route_id) && + ReadParam(m, iter, &p->parent_appcache_host_id) && + ReadParam(m, iter, &p->script_resource_appcache_id); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.url, l); + l->append(", "); + LogParam(p.is_shared, l); + l->append(", "); + LogParam(p.name, l); + l->append(", "); + LogParam(p.document_id, l); + l->append(", "); + LogParam(p.render_view_route_id, l); + l->append(","); + LogParam(p.route_id, l); + l->append(", "); + LogParam(p.parent_appcache_host_id, l); + l->append(","); + LogParam(p.script_resource_appcache_id, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.origin); + WriteParam(m, p.is_html); + WriteParam(m, p.contents_url); + WriteParam(m, p.icon_url); + WriteParam(m, p.title); + WriteParam(m, p.body); + WriteParam(m, p.direction); + WriteParam(m, p.replace_id); + WriteParam(m, p.notification_id); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->origin) && + ReadParam(m, iter, &p->is_html) && + ReadParam(m, iter, &p->contents_url) && + ReadParam(m, iter, &p->icon_url) && + ReadParam(m, iter, &p->title) && + ReadParam(m, iter, &p->body) && + ReadParam(m, iter, &p->direction) && + ReadParam(m, iter, &p->replace_id) && + ReadParam(m, iter, &p->notification_id); +} + +void ParamTraits::Log( + const param_type &p, + std::string* l) { + l->append("("); + LogParam(p.origin, l); + l->append(", "); + LogParam(p.is_html, l); + l->append(", "); + LogParam(p.contents_url, l); + l->append(", "); + LogParam(p.icon_url, l); + l->append(", "); + LogParam(p.title, l); + l->append(","); + LogParam(p.body, l); + l->append(","); + LogParam(p.direction, l); + l->append(","); + LogParam(p.replace_id, l); + l->append(","); + LogParam(p.notification_id, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, const param_type& p) { + WriteParam(m, p.parent_window); + WriteParam(m, p.renderer_preferences); + WriteParam(m, p.web_preferences); + WriteParam(m, p.view_id); + WriteParam(m, p.session_storage_namespace_id); + WriteParam(m, p.frame_name); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->parent_window) && + ReadParam(m, iter, &p->renderer_preferences) && + ReadParam(m, iter, &p->web_preferences) && + ReadParam(m, iter, &p->view_id) && + ReadParam(m, iter, &p->session_storage_namespace_id) && + ReadParam(m, iter, &p->frame_name); +} + +void ParamTraits::Log(const param_type& p, std::string* l) { + l->append("("); + LogParam(p.parent_window, l); + l->append(", "); + LogParam(p.renderer_preferences, l); + l->append(", "); + LogParam(p.web_preferences, l); + l->append(", "); + LogParam(p.view_id, l); + l->append(", "); + LogParam(p.session_storage_namespace_id, l); + l->append(", "); + LogParam(p.frame_name, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.opener_id); + WriteParam(m, p.user_gesture); + WriteParam(m, p.window_container_type); + WriteParam(m, p.session_storage_namespace_id); + WriteParam(m, p.frame_name); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->opener_id) && + ReadParam(m, iter, &p->user_gesture) && + ReadParam(m, iter, &p->window_container_type) && + ReadParam(m, iter, &p->session_storage_namespace_id) && + ReadParam(m, iter, &p->frame_name); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.opener_id, l); + l->append(", "); + LogParam(p.user_gesture, l); + l->append(", "); + LogParam(p.window_container_type, l); + l->append(", "); + LogParam(p.session_storage_namespace_id, l); + l->append(", "); + LogParam(p.frame_name, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, static_cast(p.mode)); + WriteParam(m, p.title); + WriteParam(m, p.default_file_name); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + int mode; + if (!ReadParam(m, iter, &mode)) + return false; + if (mode != param_type::Open && + mode != param_type::OpenMultiple && + mode != param_type::OpenFolder && + mode != param_type::Save) + return false; + p->mode = static_cast(mode); + return + ReadParam(m, iter, &p->title) && + ReadParam(m, iter, &p->default_file_name); +}; + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + switch (p.mode) { + case param_type::Open: + l->append("(Open, "); + break; + case param_type::OpenMultiple: + l->append("(OpenMultiple, "); + break; + case param_type::OpenFolder: + l->append("(OpenFolder, "); + break; + case param_type::Save: + l->append("(Save, "); + break; + default: + l->append("(UNKNOWN, "); + } + LogParam(p.title, l); + l->append(", "); + LogParam(p.default_file_name, l); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.extension_id); + WriteParam(m, p.web_extent); + WriteParam(m, p.browse_extent); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->extension_id) && + ReadParam(m, iter, &p->web_extent) && + ReadParam(m, iter, &p->browse_extent); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + LogParam(p.extension_id, l); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.extension_apps); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return ReadParam(m, iter, &p->extension_apps); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + LogParam(p.extension_apps, l); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.can_provide_alpha); + WriteParam(m, p.alpha); + WriteParam(m, p.can_provide_beta); + WriteParam(m, p.beta); + WriteParam(m, p.can_provide_gamma); + WriteParam(m, p.gamma); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->can_provide_alpha) && + ReadParam(m, iter, &p->alpha) && + ReadParam(m, iter, &p->can_provide_beta) && + ReadParam(m, iter, &p->beta) && + ReadParam(m, iter, &p->can_provide_gamma) && + ReadParam(m, iter, &p->gamma); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.can_provide_alpha, l); + l->append(", "); + LogParam(p.alpha, l); + l->append(", "); + LogParam(p.can_provide_beta, l); + l->append(", "); + LogParam(p.beta, l); + l->append(", "); + LogParam(p.can_provide_gamma, l); + l->append(", "); + LogParam(p.gamma, l); + l->append(")"); +} + +void ParamTraits::Write(Message* m, + const param_type& p) { + WriteParam(m, p.name); + WriteParam(m, p.arguments); + WriteParam(m, p.source_url); + WriteParam(m, p.request_id); + WriteParam(m, p.has_callback); + WriteParam(m, p.user_gesture); +} + +bool ParamTraits::Read(const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->name) && + ReadParam(m, iter, &p->arguments) && + ReadParam(m, iter, &p->source_url) && + ReadParam(m, iter, &p->request_id) && + ReadParam(m, iter, &p->has_callback) && + ReadParam(m, iter, &p->user_gesture); +} + +void ParamTraits::Log(const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.name, l); + l->append(", "); + LogParam(p.arguments, l); + l->append(", "); + LogParam(p.source_url, l); + l->append(", "); + LogParam(p.request_id, l); + l->append(", "); + LogParam(p.has_callback, l); + l->append(", "); + LogParam(p.user_gesture, l); + l->append(")"); +} + +void ParamTraits::Write( + Message* m, + const param_type& p) { + WriteParam(m, p.routing_id); + WriteParam(m, p.request_id); + WriteParam(m, p.origin_url); + WriteParam(m, p.type); + WriteParam(m, p.requested_size); +} + +bool ParamTraits::Read( + const Message* m, + void** iter, + param_type* p) { + return + ReadParam(m, iter, &p->routing_id) && + ReadParam(m, iter, &p->request_id) && + ReadParam(m, iter, &p->origin_url) && + ReadParam(m, iter, &p->type) && + ReadParam(m, iter, &p->requested_size); +} + +void ParamTraits::Log( + const param_type& p, + std::string* l) { + l->append("("); + LogParam(p.routing_id, l); + l->append(", "); + LogParam(p.request_id, l); + l->append(", "); + LogParam(p.origin_url, l); + l->append(", "); + LogParam(p.type, l); + l->append(", "); + LogParam(p.requested_size, l); + l->append(")"); +} + +} // namespace IPC diff --git a/chrome/common/render_messages_params.h b/chrome/common/render_messages_params.h new file mode 100644 index 0000000..abf2b028 --- /dev/null +++ b/chrome/common/render_messages_params.h @@ -0,0 +1,1097 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ +#define CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ +#pragma once + +#include +#include + +#include "app/surface/transport_dib.h" +#include "base/file_path.h" +#include "base/ref_counted.h" +#include "base/shared_memory.h" +#include "base/time.h" +#include "base/values.h" +#include "chrome/common/dom_storage_common.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/navigation_gesture.h" +#include "chrome/common/navigation_types.h" +#include "chrome/common/page_transition_types.h" +#include "chrome/common/renderer_preferences.h" +#include "chrome/common/window_container_type.h" +#include "googleurl/src/gurl.h" +#include "ipc/ipc_param_traits.h" +#include "media/audio/audio_io.h" +#include "third_party/WebKit/WebKit/chromium/public/WebFileSystem.h" +#include "third_party/WebKit/WebKit/chromium/public/WebTextDirection.h" +#include "webkit/glue/password_form.h" +#include "webkit/glue/plugins/webplugin.h" +#include "webkit/glue/resource_type.h" +#include "webkit/glue/webmenuitem.h" +#include "webkit/glue/webpreferences.h" + +// TODO(erg): Split this file into $1_db_params.h, $1_audio_params.h, +// $1_print_params.h and $1_render_params.h. + +namespace net { +class UploadData; +} + +// Parameters structure for ViewMsg_Navigate, which has too many data +// parameters to be reasonably put in a predefined IPC message. +struct ViewMsg_Navigate_Params { + enum NavigationType { + // Reload the page. + RELOAD, + + // Reload the page, ignoring any cache entries. + RELOAD_IGNORING_CACHE, + + // The navigation is the result of session restore and should honor the + // page's cache policy while restoring form state. This is set to true if + // restoring a tab/session from the previous session and the previous + // session did not crash. If this is not set and the page was restored then + // the page's cache policy is ignored and we load from the cache. + RESTORE, + + // Navigation type not categorized by the other types. + NORMAL + }; + + // The page_id for this navigation, or -1 if it is a new navigation. Back, + // Forward, and Reload navigations should have a valid page_id. If the load + // succeeds, then this page_id will be reflected in the resultant + // ViewHostMsg_FrameNavigate message. + int32 page_id; + + // If page_id is -1, then pending_history_list_offset will also be -1. + // Otherwise, it contains the offset into the history list corresponding to + // the current navigation. + int pending_history_list_offset; + + // Informs the RenderView of where its current page contents reside in + // session history and the total size of the session history list. + int current_history_list_offset; + int current_history_list_length; + + // The URL to load. + GURL url; + + // The URL to send in the "Referer" header field. Can be empty if there is + // no referrer. + GURL referrer; + + // The type of transition. + PageTransition::Type transition; + + // Opaque history state (received by ViewHostMsg_UpdateState). + std::string state; + + // Type of navigation. + NavigationType navigation_type; + + // The time the request was created + base::Time request_time; +}; + +// Current status of the audio output stream in the browser process. Browser +// sends information about the current playback state and error to the +// renderer process using this type. +struct ViewMsg_AudioStreamState_Params { + enum State { + kPlaying, + kPaused, + kError + }; + + // Carries the current playback state. + State state; +}; + +// The user has completed a find-in-page; this type defines what actions the +// renderer should take next. +struct ViewMsg_StopFinding_Params { + enum Action { + kClearSelection, + kKeepSelection, + kActivateSelection + }; + + // The action that should be taken when the find is completed. + Action action; +}; + +// The install state of the search provider (not installed, installed, default). +struct ViewHostMsg_GetSearchProviderInstallState_Params { + enum State { + // Equates to an access denied error. + DENIED = -1, + + // DON'T CHANGE THE VALUES BELOW. + // All of the following values are manidated by the + // spec for window.external.IsSearchProviderInstalled. + + // The search provider is not installed. + NOT_INSTALLED = 0, + + // The search provider is in the user's set but is not + INSTALLED_BUT_NOT_DEFAULT = 1, + + // The search provider is set as the user's default. + INSTALLED_AS_DEFAULT = 2 + }; + State state; + + ViewHostMsg_GetSearchProviderInstallState_Params() + : state(DENIED) { + } + + explicit ViewHostMsg_GetSearchProviderInstallState_Params(State s) + : state(s) { + } + + static ViewHostMsg_GetSearchProviderInstallState_Params Denied() { + return ViewHostMsg_GetSearchProviderInstallState_Params(DENIED); + } + + static ViewHostMsg_GetSearchProviderInstallState_Params NotInstalled() { + return ViewHostMsg_GetSearchProviderInstallState_Params(NOT_INSTALLED); + } + + static ViewHostMsg_GetSearchProviderInstallState_Params + InstallButNotDefault() { + return ViewHostMsg_GetSearchProviderInstallState_Params( + INSTALLED_BUT_NOT_DEFAULT); + } + + static ViewHostMsg_GetSearchProviderInstallState_Params InstalledAsDefault() { + return ViewHostMsg_GetSearchProviderInstallState_Params( + INSTALLED_AS_DEFAULT); + } +}; + +// Parameters structure for ViewHostMsg_FrameNavigate, which has too many data +// parameters to be reasonably put in a predefined IPC message. +struct ViewHostMsg_FrameNavigate_Params { + // Page ID of this navigation. The renderer creates a new unique page ID + // anytime a new session history entry is created. This means you'll get new + // page IDs for user actions, and the old page IDs will be reloaded when + // iframes are loaded automatically. + int32 page_id; + + // URL of the page being loaded. + GURL url; + + // URL of the referrer of this load. WebKit generates this based on the + // source of the event that caused the load. + GURL referrer; + + // The type of transition. + PageTransition::Type transition; + + // Lists the redirects that occurred on the way to the current page. This + // vector has the same format as reported by the WebDataSource in the glue, + // with the current page being the last one in the list (so even when + // there's no redirect, there will be one entry in the list. + std::vector redirects; + + // Set to false if we want to update the session history but not update + // the browser history. E.g., on unreachable urls. + bool should_update_history; + + // See SearchableFormData for a description of these. + GURL searchable_form_url; + std::string searchable_form_encoding; + + // See password_form.h. + webkit_glue::PasswordForm password_form; + + // Information regarding the security of the connection (empty if the + // connection was not secure). + std::string security_info; + + // The gesture that initiated this navigation. + NavigationGesture gesture; + + // Contents MIME type of main frame. + std::string contents_mime_type; + + // True if this was a post request. + bool is_post; + + // Whether the content of the frame was replaced with some alternate content + // (this can happen if the resource was insecure). + bool is_content_filtered; + + // The status code of the HTTP request. + int http_status_code; +}; + +// Values that may be OR'd together to form the 'flags' parameter of a +// ViewHostMsg_UpdateRect_Params structure. +struct ViewHostMsg_UpdateRect_Flags { + enum { + IS_RESIZE_ACK = 1 << 0, + IS_RESTORE_ACK = 1 << 1, + IS_REPAINT_ACK = 1 << 2, + }; + static bool is_resize_ack(int flags) { + return (flags & IS_RESIZE_ACK) != 0; + } + static bool is_restore_ack(int flags) { + return (flags & IS_RESTORE_ACK) != 0; + } + static bool is_repaint_ack(int flags) { + return (flags & IS_REPAINT_ACK) != 0; + } +}; + +struct ViewHostMsg_UpdateRect_Params { + // The bitmap to be painted into the view at the locations specified by + // update_rects. + TransportDIB::Id bitmap; + + // The position and size of the bitmap. + gfx::Rect bitmap_rect; + + // The scroll offset. Only one of these can be non-zero, and if they are + // both zero, then it means there is no scrolling and the scroll_rect is + // ignored. + int dx; + int dy; + + // The rectangular region to scroll. + gfx::Rect scroll_rect; + + // The regions of the bitmap (in view coords) that contain updated pixels. + // In the case of scrolling, this includes the scroll damage rect. + std::vector copy_rects; + + // The size of the RenderView when this message was generated. This is + // included so the host knows how large the view is from the perspective of + // the renderer process. This is necessary in case a resize operation is in + // progress. + gfx::Size view_size; + + // New window locations for plugin child windows. + std::vector plugin_window_moves; + + // The following describes the various bits that may be set in flags: + // + // ViewHostMsg_UpdateRect_Flags::IS_RESIZE_ACK + // Indicates that this is a response to a ViewMsg_Resize message. + // + // ViewHostMsg_UpdateRect_Flags::IS_RESTORE_ACK + // Indicates that this is a response to a ViewMsg_WasRestored message. + // + // ViewHostMsg_UpdateRect_Flags::IS_REPAINT_ACK + // Indicates that this is a response to a ViewMsg_Repaint message. + // + // If flags is zero, then this message corresponds to an unsoliticed paint + // request by the render view. Any of the above bits may be set in flags, + // which would indicate that this paint message is an ACK for multiple + // request messages. + int flags; +}; + +// Information on closing a tab. This is used both for ViewMsg_ClosePage, and +// the corresponding ViewHostMsg_ClosePage_ACK. +struct ViewMsg_ClosePage_Params { + // The identifier of the RenderProcessHost for the currently closing view. + // + // These first two parameters are technically redundant since they are + // needed only when processing the ACK message, and the processor + // theoretically knows both the process and route ID. However, this is + // difficult to figure out with our current implementation, so this + // information is duplicate here. + int closing_process_id; + + // The route identifier for the currently closing RenderView. + int closing_route_id; + + // True when this close is for the first (closing) tab of a cross-site + // transition where we switch processes. False indicates the close is for the + // entire tab. + // + // When true, the new_* variables below must be filled in. Otherwise they must + // both be -1. + bool for_cross_site_transition; + + // The identifier of the RenderProcessHost for the new view attempting to + // replace the closing one above. This must be valid when + // for_cross_site_transition is set, and must be -1 otherwise. + int new_render_process_host_id; + + // The identifier of the *request* the new view made that is causing the + // cross-site transition. This is *not* a route_id, but the request that we + // will resume once the ACK from the closing view has been received. This + // must be valid when for_cross_site_transition is set, and must be -1 + // otherwise. + int new_request_id; +}; + +// Parameters for a resource request. +struct ViewHostMsg_Resource_Request { + // The request method: GET, POST, etc. + std::string method; + + // The requested URL. + GURL url; + + // Usually the URL of the document in the top-level window, which may be + // checked by the third-party cookie blocking policy. Leaving it empty may + // lead to undesired cookie blocking. Third-party cookie blocking can be + // bypassed by setting first_party_for_cookies = url, but this should ideally + // only be done if there really is no way to determine the correct value. + GURL first_party_for_cookies; + + // The referrer to use (may be empty). + GURL referrer; + + // The origin of the frame that is associated with this request. This is used + // to update our insecure content state. + std::string frame_origin; + + // The origin of the main frame (top-level frame) that is associated with this + // request. This is used to update our insecure content state. + std::string main_frame_origin; + + // Additional HTTP request headers. + std::string headers; + + // URLRequest load flags (0 by default). + int load_flags; + + // Unique ID of process that originated this request. For normal renderer + // requests, this will be the ID of the renderer. For plugin requests routed + // through the renderer, this will be the plugin's ID. + int origin_child_id; + + // What this resource load is for (main frame, sub-frame, sub-resource, + // object). + ResourceType::Type resource_type; + + // Used by plugin->browser requests to get the correct URLRequestContext. + uint32 request_context; + + // Indicates which frame (or worker context) the request is being loaded into, + // or kNoHostId. + int appcache_host_id; + + // Optional upload data (may be null). + scoped_refptr upload_data; + + bool download_to_file; + + // The following two members are specified if the request is initiated by + // a plugin like Gears. + + // Contains the id of the host renderer. + int host_renderer_id; + + // Contains the id of the host render view. + int host_render_view_id; +}; + +// Parameters for a render request. +struct ViewMsg_Print_Params { + // Physical size of the page, including non-printable margins, + // in pixels according to dpi. + gfx::Size page_size; + + // In pixels according to dpi_x and dpi_y. + gfx::Size printable_size; + + // The y-offset of the printable area, in pixels according to dpi. + int margin_top; + + // The x-offset of the printable area, in pixels according to dpi. + int margin_left; + + // Specifies dots per inch. + double dpi; + + // Minimum shrink factor. See PrintSettings::min_shrink for more information. + double min_shrink; + + // Maximum shrink factor. See PrintSettings::max_shrink for more information. + double max_shrink; + + // Desired apparent dpi on paper. + int desired_dpi; + + // Cookie for the document to ensure correctness. + int document_cookie; + + // Should only print currently selected text. + bool selection_only; + + // Warning: do not compare document_cookie. + bool Equals(const ViewMsg_Print_Params& rhs) const; + + // Checking if the current params is empty. Just initialized after a memset. + bool IsEmpty() const; +}; + +struct ViewMsg_PrintPage_Params { + // Parameters to render the page as a printed page. It must always be the same + // value for all the document. + ViewMsg_Print_Params params; + + // The page number is the indicator of the square that should be rendered + // according to the layout specified in ViewMsg_Print_Params. + int page_number; +}; + +struct ViewMsg_PrintPages_Params { + // Parameters to render the page as a printed page. It must always be the same + // value for all the document. + ViewMsg_Print_Params params; + + // If empty, this means a request to render all the printed pages. + std::vector pages; +}; + +// Parameters to describe a rendered page. +struct ViewHostMsg_DidPrintPage_Params { + // A shared memory handle to the EMF data. This data can be quite large so a + // memory map needs to be used. + base::SharedMemoryHandle metafile_data_handle; + + // Size of the metafile data. + uint32 data_size; + + // Cookie for the document to ensure correctness. + int document_cookie; + + // Page number. + int page_number; + + // Shrink factor used to render this page. + double actual_shrink; + + // The size of the page the page author specified. + gfx::Size page_size; + + // The printable area the page author specified. + gfx::Rect content_area; + + // True if the page has visible overlays. + bool has_visible_overlays; +}; + +// Parameters for creating an audio output stream. +struct ViewHostMsg_Audio_CreateStream_Params { + // Format request for the stream. + AudioManager::Format format; + + // Number of channels. + int channels; + + // Sampling rate (frequency) of the output stream. + int sample_rate; + + // Number of bits per sample; + int bits_per_sample; + + // Number of bytes per packet. Determines the maximum number of bytes + // transported for each audio packet request. + // A value of 0 means that the audio packet size is selected automatically + // by the browser process. + uint32 packet_size; +}; + +// This message is used for supporting popup menus on Mac OS X using native +// Cocoa controls. The renderer sends us this message which we use to populate +// the popup menu. +struct ViewHostMsg_ShowPopup_Params { + // Position on the screen. + gfx::Rect bounds; + + // The height of each item in the menu. + int item_height; + + // The size of the font to use for those items. + double item_font_size; + + // The currently selected (displayed) item in the menu. + int selected_item; + + // The entire list of items in the popup menu. + std::vector popup_items; + + // Whether items should be right-aligned. + bool right_aligned; +}; + +// Parameters for the IPC message ViewHostMsg_ScriptedPrint +struct ViewHostMsg_ScriptedPrint_Params { + int routing_id; + gfx::NativeViewId host_window_id; + int cookie; + int expected_pages_count; + bool has_selection; + bool use_overlays; +}; + +// Signals a storage event. +struct ViewMsg_DOMStorageEvent_Params { + // The key that generated the storage event. Null if clear() was called. + NullableString16 key_; + + // The old value of this key. Null on clear() or if it didn't have a value. + NullableString16 old_value_; + + // The new value of this key. Null on removeItem() or clear(). + NullableString16 new_value_; + + // The origin this is associated with. + string16 origin_; + + // The URL of the page that caused the storage event. + GURL url_; + + // The storage type of this event. + DOMStorageType storage_type_; +}; + +// Used to open an indexed database. +struct ViewHostMsg_IDBFactoryOpen_Params { + // The routing ID of the view initiating the open. + int32 routing_id_; + + // The response should have this id. + int32 response_id_; + + // The origin doing the initiating. + string16 origin_; + + // The name of the database. + string16 name_; + + // The description of the database. + string16 description_; +}; + +// Used to create an object store. +struct ViewHostMsg_IDBDatabaseCreateObjectStore_Params { + // The response should have this id. + int32 response_id_; + + // The name of the object store. + string16 name_; + + // The keyPath of the object store. + NullableString16 key_path_; + + // Whether the object store created should have a key generator. + bool auto_increment_; + + // The database the object store belongs to. + int32 idb_database_id_; +}; + +// Used to create an index. +struct ViewHostMsg_IDBObjectStoreCreateIndex_Params { + // The response should have this id. + int32 response_id_; + + // The name of the index. + string16 name_; + + // The keyPath of the index. + NullableString16 key_path_; + + // Whether the index created has unique keys. + bool unique_; + + // The object store the index belongs to. + int32 idb_object_store_id_; +}; + +// Used to open an IndexedDB cursor. +struct ViewHostMsg_IDBObjectStoreOpenCursor_Params { + // The response should have this id. + int32 response_id_; + // The serialized left key. + IndexedDBKey left_key_; + // The serialized right key. + IndexedDBKey right_key_; + // The key flags. + int32 flags_; + // The direction of this cursor. + int32 direction_; + // The object store the index belongs to. + int32 idb_object_store_id_; +}; + +// Allows an extension to execute code in a tab. +struct ViewMsg_ExecuteCode_Params { + ViewMsg_ExecuteCode_Params(); + ViewMsg_ExecuteCode_Params(int request_id, const std::string& extension_id, + const std::vector& host_permissions, + bool is_javascript, const std::string& code, + bool all_frames); + + // The extension API request id, for responding. + int request_id; + + // The ID of the requesting extension. To know which isolated world to + // execute the code inside of. + std::string extension_id; + + // The host permissions of the requesting extension. So that we can check them + // right before injecting, to avoid any race conditions. + std::vector host_permissions; + + // Whether the code is JavaScript or CSS. + bool is_javascript; + + // String of code to execute. + std::string code; + + // Whether to inject into all frames, or only the root frame. + bool all_frames; +}; + +// Parameters for the message that creates a worker thread. +struct ViewHostMsg_CreateWorker_Params { + // URL for the worker script. + GURL url; + + // True if this is a SharedWorker, false if it is a dedicated Worker. + bool is_shared; + + // Name for a SharedWorker, otherwise empty string. + string16 name; + + // The ID of the parent document (unique within parent renderer). + unsigned long long document_id; + + // RenderView routing id used to send messages back to the parent. + int render_view_route_id; + + // The route ID to associate with the worker. If MSG_ROUTING_NONE is passed, + // a new unique ID is created and assigned to the worker. + int route_id; + + // The ID of the parent's appcache host, only valid for dedicated workers. + int parent_appcache_host_id; + + // The ID of the appcache the main shared worker script resource was loaded + // from, only valid for shared workers. + int64 script_resource_appcache_id; +}; + +// Parameters for the message that creates a desktop notification. +struct ViewHostMsg_ShowNotification_Params { + // URL which is the origin that created this notification. + GURL origin; + + // True if this is HTML + bool is_html; + + // URL which contains the HTML contents (if is_html is true), otherwise empty. + GURL contents_url; + + // Contents of the notification if is_html is false. + GURL icon_url; + string16 title; + string16 body; + + // Directionality of the notification. + WebKit::WebTextDirection direction; + + // ReplaceID if this notification should replace an existing one; may be + // empty if no replacement is called for. + string16 replace_id; + + // Notification ID for sending events back for this notification. + int notification_id; +}; + +// Creates a new view via a control message since the view doesn't yet exist. +struct ViewMsg_New_Params { + // The parent window's id. + gfx::NativeViewId parent_window; + + // Renderer-wide preferences. + RendererPreferences renderer_preferences; + + // Preferences for this view. + WebPreferences web_preferences; + + // The ID of the view to be created. + int32 view_id; + + // The session storage namespace ID this view should use. + int64 session_storage_namespace_id; + + // The name of the frame associated with this view (or empty if none). + string16 frame_name; +}; + +struct ViewHostMsg_CreateWindow_Params { + // Routing ID of the view initiating the open. + int opener_id; + + // True if this open request came in the context of a user gesture. + bool user_gesture; + + // Type of window requested. + WindowContainerType window_container_type; + + // The session storage namespace ID this view should use. + int64 session_storage_namespace_id; + + // The name of the resulting frame that should be created (empty if none + // has been specified). + string16 frame_name; +}; + +struct ViewHostMsg_RunFileChooser_Params { + enum Mode { + // Requires that the file exists before allowing the user to pick it. + Open, + + // Like Open, but allows picking multiple files to open. + OpenMultiple, + + // Like Open, but selects a folder. + OpenFolder, + + // Allows picking a nonexistent file, and prompts to overwrite if the file + // already exists. + Save, + }; + + Mode mode; + + // Title to be used for the dialog. This may be empty for the default title, + // which will be either "Open" or "Save" depending on the mode. + string16 title; + + // Default file name to select in the dialog. + FilePath default_file_name; +}; + +struct ViewMsg_ExtensionExtentInfo { + std::string extension_id; + ExtensionExtent web_extent; + ExtensionExtent browse_extent; +}; + +struct ViewMsg_ExtensionExtentsUpdated_Params { + // Describes the installed extension apps and the URLs they cover. + std::vector extension_apps; +}; + +struct ViewMsg_DeviceOrientationUpdated_Params { + // These fields have the same meaning as in device_orientation::Orientation. + bool can_provide_alpha; + double alpha; + bool can_provide_beta; + double beta; + bool can_provide_gamma; + double gamma; +}; + +// Parameters structure for ViewHostMsg_ExtensionRequest. +struct ViewHostMsg_DomMessage_Params { + // Message name. + std::string name; + + // List of message arguments. + ListValue arguments; + + // URL of the frame request was sent from. + GURL source_url; + + // Unique request id to match requests and responses. + int request_id; + + // True if request has a callback specified. + bool has_callback; + + // True if request is executed in response to an explicit user gesture. + bool user_gesture; +}; + +struct ViewHostMsg_OpenFileSystemRequest_Params { + // The routing ID of the view initiating the request. + int routing_id; + + // The response should have this id. + int request_id; + + // The origin doing the initiating. + GURL origin_url; + + // The requested FileSystem type. + WebKit::WebFileSystem::Type type; + + // Indicates how much storage space (in bytes) the caller expects to need. + int64 requested_size; +}; + +namespace IPC { + +class Message; + +// Traits for ViewMsg_Navigate_Params structure to pack/unpack. +template <> +struct ParamTraits { + typedef ViewMsg_Navigate_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_AudioStreamState_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_StopFinding_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_GetSearchProviderInstallState_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_FrameNavigate_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_UpdateRect_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_ClosePage_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_Resource_Request param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_Print_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_PrintPage_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_PrintPages_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_DidPrintPage_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_Audio_CreateStream_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_ShowPopup_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_ScriptedPrint_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_DOMStorageEvent_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_IDBFactoryOpen_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_IDBDatabaseCreateObjectStore_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_IDBObjectStoreCreateIndex_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_IDBObjectStoreOpenCursor_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template<> +struct ParamTraits { + typedef ViewMsg_ExecuteCode_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_CreateWorker_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_ShowNotification_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type &p, std::string* l); +}; + +template<> +struct ParamTraits { + typedef ViewMsg_New_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template<> +struct ParamTraits { + typedef ViewHostMsg_CreateWindow_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template<> +struct ParamTraits { + typedef ViewHostMsg_RunFileChooser_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_ExtensionExtentInfo param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_ExtensionExtentsUpdated_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewMsg_DeviceOrientationUpdated_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_DomMessage_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +template <> +struct ParamTraits { + typedef ViewHostMsg_OpenFileSystemRequest_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* p); + static void Log(const param_type& p, std::string* l); +}; + +} // namespace IPC + +#endif // CHROME_COMMON_RENDER_MESSAGES_PARAMS_H_ diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc index 6e672dd..a8993ed 100644 --- a/chrome/common/resource_dispatcher.cc +++ b/chrome/common/resource_dispatcher.cc @@ -14,9 +14,11 @@ #include "base/string_util.h" #include "chrome/common/extensions/extension_localization_peer.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/security_filter_peer.h" #include "net/base/net_errors.h" #include "net/base/net_util.h" +#include "net/base/upload_data.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 177fea9..3ede586 100644 --- a/chrome/common/resource_dispatcher_unittest.cc +++ b/chrome/common/resource_dispatcher_unittest.cc @@ -10,7 +10,9 @@ #include "base/process_util.h" #include "base/scoped_ptr.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/resource_dispatcher.h" +#include "net/base/upload_data.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/utility_messages.cc b/chrome/common/utility_messages.cc index 90b0a29..4a781c3 100644 --- a/chrome/common/utility_messages.cc +++ b/chrome/common/utility_messages.cc @@ -5,6 +5,10 @@ #include "chrome/common/utility_messages.h" #include "base/values.h" +#include "chrome/common/common_param_traits.h" +#include "base/file_path.h" +#include "third_party/skia/include/core/SkBitmap.h" + #define MESSAGES_INTERNAL_IMPL_FILE \ "chrome/common/utility_messages_internal.h" #include "ipc/ipc_message_impl_macros.h" diff --git a/chrome/common/utility_messages_internal.h b/chrome/common/utility_messages_internal.h index 08dd347..1fb6698 100644 --- a/chrome/common/utility_messages_internal.h +++ b/chrome/common/utility_messages_internal.h @@ -17,7 +17,9 @@ #include "gfx/rect.h" #include "printing/native_metafile.h" #include "printing/page_range.h" -#include "third_party/skia/include/core/SkBitmap.h" + +class FilePath; +class SkBitmap; //------------------------------------------------------------------------------ // Utility process messages: diff --git a/chrome/gpu/gpu_backing_store_glx.cc b/chrome/gpu/gpu_backing_store_glx.cc index 37076cc..916a1db 100644 --- a/chrome/gpu/gpu_backing_store_glx.cc +++ b/chrome/gpu/gpu_backing_store_glx.cc @@ -11,6 +11,7 @@ #include "chrome/gpu/gpu_backing_store_glx_context.h" #include "chrome/gpu/gpu_thread.h" #include "chrome/gpu/gpu_view_x.h" +#include "gfx/rect.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc index c5ac79f..04bd218 100644 --- a/chrome/gpu/gpu_thread.cc +++ b/chrome/gpu/gpu_thread.cc @@ -14,6 +14,7 @@ #include "chrome/common/gpu_info.h" #include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_info_collector.h" +#include "ipc/ipc_channel_handle.h" #if defined(OS_WIN) #include "chrome/gpu/gpu_view_win.h" diff --git a/chrome/gpu/gpu_video_decoder.cc b/chrome/gpu/gpu_video_decoder.cc index 1a4a7f6..5dcb723 100644 --- a/chrome/gpu/gpu_video_decoder.cc +++ b/chrome/gpu/gpu_video_decoder.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "chrome/gpu/gpu_video_decoder.h" + #include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_channel.h" -#include "chrome/gpu/gpu_video_decoder.h" #include "media/base/data_buffer.h" +#include "media/base/video_frame.h" void GpuVideoDecoder::OnChannelConnected(int32 peer_pid) { } diff --git a/chrome/gpu/gpu_view_win.cc b/chrome/gpu/gpu_view_win.cc index 091c1a1..afedbd4 100644 --- a/chrome/gpu/gpu_view_win.cc +++ b/chrome/gpu/gpu_view_win.cc @@ -7,6 +7,7 @@ #include "chrome/common/gpu_messages.h" #include "chrome/gpu/gpu_backing_store_win.h" #include "chrome/gpu/gpu_thread.h" +#include "gfx/rect.h" namespace { diff --git a/chrome/renderer/audio_message_filter.cc b/chrome/renderer/audio_message_filter.cc index 59b82c4..b44bb3b 100644 --- a/chrome/renderer/audio_message_filter.cc +++ b/chrome/renderer/audio_message_filter.cc @@ -7,6 +7,7 @@ #include "base/message_loop.h" #include "base/time.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_logging.h" AudioMessageFilter::AudioMessageFilter(int32 route_id) diff --git a/chrome/renderer/audio_message_filter_unittest.cc b/chrome/renderer/audio_message_filter_unittest.cc index e4be68c..ae3ec20 100644 --- a/chrome/renderer/audio_message_filter_unittest.cc +++ b/chrome/renderer/audio_message_filter_unittest.cc @@ -5,6 +5,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/audio_message_filter.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/device_orientation_dispatcher.cc b/chrome/renderer/device_orientation_dispatcher.cc index 1f7c72e..816cda8 100644 --- a/chrome/renderer/device_orientation_dispatcher.cc +++ b/chrome/renderer/device_orientation_dispatcher.cc @@ -4,6 +4,7 @@ #include "chrome/renderer/device_orientation_dispatcher.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_view.h" #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientation.h" #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationController.h" diff --git a/chrome/renderer/device_orientation_dispatcher.h b/chrome/renderer/device_orientation_dispatcher.h index 2e7c76f..0370f25 100644 --- a/chrome/renderer/device_orientation_dispatcher.h +++ b/chrome/renderer/device_orientation_dispatcher.h @@ -7,11 +7,13 @@ #include "third_party/WebKit/WebKit/chromium/public/WebDeviceOrientationClient.h" -#include "chrome/common/render_messages.h" +#include "base/scoped_ptr.h" class RenderView; namespace IPC { class Message; } +struct ViewMsg_DeviceOrientationUpdated_Params; + class DeviceOrientationDispatcher : public WebKit::WebDeviceOrientationClient { public: explicit DeviceOrientationDispatcher(RenderView* render_view); diff --git a/chrome/renderer/extensions/extension_process_bindings.cc b/chrome/renderer/extensions/extension_process_bindings.cc index ec7e1c0..f0da91d 100644 --- a/chrome/renderer/extensions/extension_process_bindings.cc +++ b/chrome/renderer/extensions/extension_process_bindings.cc @@ -19,6 +19,7 @@ #include "chrome/common/extensions/extension_constants.h" #include "chrome/common/extensions/url_pattern.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/extensions/bindings_utils.h" #include "chrome/renderer/extensions/event_bindings.h" diff --git a/chrome/renderer/external_extension.cc b/chrome/renderer/external_extension.cc index 251a12a..f2c3246 100644 --- a/chrome/renderer/external_extension.cc +++ b/chrome/renderer/external_extension.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "chrome/common/chrome_switches.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_view.h" #include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" #include "v8/include/v8.h" diff --git a/chrome/renderer/indexed_db_dispatcher.cc b/chrome/renderer/indexed_db_dispatcher.cc index 65336da..ac1a3e4 100644 --- a/chrome/renderer/indexed_db_dispatcher.cc +++ b/chrome/renderer/indexed_db_dispatcher.cc @@ -6,6 +6,7 @@ #include "chrome/common/indexed_db_key.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/serialized_script_value.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" diff --git a/chrome/renderer/media/audio_renderer_impl.cc b/chrome/renderer/media/audio_renderer_impl.cc index cb7779b5..06356cc 100644 --- a/chrome/renderer/media/audio_renderer_impl.cc +++ b/chrome/renderer/media/audio_renderer_impl.cc @@ -6,7 +6,7 @@ #include -#include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/audio_message_filter.h" #include "chrome/renderer/render_view.h" #include "chrome/renderer/render_thread.h" diff --git a/chrome/renderer/media/audio_renderer_impl_unittest.cc b/chrome/renderer/media/audio_renderer_impl_unittest.cc index 27584a1..d5785ea 100644 --- a/chrome/renderer/media/audio_renderer_impl_unittest.cc +++ b/chrome/renderer/media/audio_renderer_impl_unittest.cc @@ -5,6 +5,7 @@ #include "base/callback.h" #include "base/process_util.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/media/audio_renderer_impl.h" #include "media/base/data_buffer.h" #include "media/base/media_format.h" diff --git a/chrome/renderer/mock_printer.cc b/chrome/renderer/mock_printer.cc index 78b7a78..6306172 100644 --- a/chrome/renderer/mock_printer.cc +++ b/chrome/renderer/mock_printer.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/shared_memory.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_message_utils.h" #include "printing/units.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index 6644634..636e33f 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -9,6 +9,7 @@ #include "base/file_util.h" #include "base/process_util.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "ipc/ipc_message_utils.h" #include "ipc/ipc_sync_message.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/notification_provider.cc b/chrome/renderer/notification_provider.cc index 77129c7..79c5149 100644 --- a/chrome/renderer/notification_provider.cc +++ b/chrome/renderer/notification_provider.cc @@ -7,6 +7,7 @@ #include "base/string_util.h" #include "base/task.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/url_constants.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" diff --git a/chrome/renderer/pepper_devices.cc b/chrome/renderer/pepper_devices.cc index 8d0e403..0e4f2ac 100644 --- a/chrome/renderer/pepper_devices.cc +++ b/chrome/renderer/pepper_devices.cc @@ -3,6 +3,8 @@ // found in the LICENSE file. #include "chrome/renderer/pepper_devices.h" + +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/webplugin_delegate_pepper.h" #include "skia/ext/platform_canvas.h" diff --git a/chrome/renderer/pepper_plugin_delegate_impl.cc b/chrome/renderer/pepper_plugin_delegate_impl.cc index 5295127..e56e873 100644 --- a/chrome/renderer/pepper_plugin_delegate_impl.cc +++ b/chrome/renderer/pepper_plugin_delegate_impl.cc @@ -9,6 +9,7 @@ #include "base/scoped_ptr.h" #include "base/task.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/audio_message_filter.h" #include "chrome/renderer/command_buffer_proxy.h" #include "chrome/renderer/render_view.h" diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index 82c2753..3a37e9d 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/utf_string_conversions.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_view.h" #include "gfx/codec/jpeg_codec.h" #include "grit/generated_resources.h" diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index c7511e06..a616ee43 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -7,6 +7,7 @@ #include "base/file_descriptor_posix.h" #include "base/logging.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "printing/native_metafile.h" #include "printing/units.h" #include "skia/ext/vector_canvas.h" diff --git a/chrome/renderer/print_web_view_helper_mac.mm b/chrome/renderer/print_web_view_helper_mac.mm index 16311d4..97410dc 100644 --- a/chrome/renderer/print_web_view_helper_mac.mm +++ b/chrome/renderer/print_web_view_helper_mac.mm @@ -11,6 +11,7 @@ #include "base/process_util.h" #include "base/scoped_cftyperef.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_view.h" #include "grit/generated_resources.h" #include "printing/native_metafile.h" diff --git a/chrome/renderer/print_web_view_helper_win.cc b/chrome/renderer/print_web_view_helper_win.cc index 586e081..b018655 100644 --- a/chrome/renderer/print_web_view_helper_win.cc +++ b/chrome/renderer/print_web_view_helper_win.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_view.h" #include "gfx/size.h" #include "grit/generated_resources.h" diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc index 00934cb..ff2e1c1 100644 --- a/chrome/renderer/render_thread.cc +++ b/chrome/renderer/render_thread.cc @@ -31,6 +31,7 @@ #include "chrome/common/extensions/extension_extent.h" #include "chrome/common/plugin_messages.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/url_constants.h" #include "chrome/common/web_database_observer_impl.h" diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index ea313e0..f20fc38 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -37,6 +37,7 @@ #include "chrome/common/pepper_plugin_registry.h" #include "chrome/common/plugin_group.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/thumbnail_score.h" #include "chrome/common/url_constants.h" diff --git a/chrome/renderer/render_view_unittest.cc b/chrome/renderer/render_view_unittest.cc index d21bac9..f2d507a 100644 --- a/chrome/renderer/render_view_unittest.cc +++ b/chrome/renderer/render_view_unittest.cc @@ -11,6 +11,7 @@ #include "chrome/common/content_settings.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/print_web_view_helper.h" #include "chrome/test/render_view_test.h" #include "gfx/codec/jpeg_codec.h" diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 9111391..9387230 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -13,6 +13,7 @@ #include "build/build_config.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/render_process.h" #include "chrome/renderer/render_thread.h" #include "gfx/point.h" diff --git a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc index 965d1b5..9eae2ef 100644 --- a/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc +++ b/chrome/renderer/safe_browsing/phishing_dom_feature_extractor_browsertest.cc @@ -20,6 +20,7 @@ #include "base/string_util.h" #include "chrome/common/main_function_params.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/sandbox_init_wrapper.h" #include "chrome/renderer/mock_render_process.h" #include "chrome/renderer/render_thread.h" @@ -29,6 +30,7 @@ #include "chrome/renderer/safe_browsing/features.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_channel.h" +#include "net/base/upload_data.h" #include "net/http/http_response_headers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index de71d36..292ef48 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -35,6 +35,7 @@ #include "base/utf_string_conversions.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/renderer/pepper_widget.h" #include "chrome/renderer/render_thread.h" #include "chrome/renderer/render_view.h" diff --git a/chrome/renderer/webworker_base.cc b/chrome/renderer/webworker_base.cc index d98a5b6..e1ca20a 100644 --- a/chrome/renderer/webworker_base.cc +++ b/chrome/renderer/webworker_base.cc @@ -6,6 +6,7 @@ #include "chrome/common/child_thread.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/webmessageportchannel_impl.h" #include "chrome/common/worker_messages.h" #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" diff --git a/chrome/test/render_view_test.cc b/chrome/test/render_view_test.cc index 156b838..9094525 100644 --- a/chrome/test/render_view_test.cc +++ b/chrome/test/render_view_test.cc @@ -8,6 +8,7 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/native_web_keyboard_event.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/renderer_preferences.h" #include "chrome/renderer/extensions/event_bindings.h" #include "chrome/renderer/extensions/extension_process_bindings.h" diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc index 24df4d8..43a8e2f 100644 --- a/chrome/worker/worker_webkitclient_impl.cc +++ b/chrome/worker/worker_webkitclient_impl.cc @@ -7,6 +7,7 @@ #include "base/logging.h" #include "chrome/common/database_util.h" #include "chrome/common/render_messages.h" +#include "chrome/common/render_messages_params.h" #include "chrome/common/webmessageportchannel_impl.h" #include "chrome/worker/worker_thread.h" #include "third_party/WebKit/WebKit/chromium/public/WebString.h" diff --git a/ipc/ipc.gypi b/ipc/ipc.gypi index 52b27bf..9118394 100644 --- a/ipc/ipc.gypi +++ b/ipc/ipc.gypi @@ -29,6 +29,7 @@ 'ipc_message_macros.h', 'ipc_message_utils.cc', 'ipc_message_utils.h', + 'ipc_param_traits.h', 'ipc_platform_file.h', 'ipc_switches.cc', 'ipc_switches.h', diff --git a/ipc/ipc_message_utils.h b/ipc/ipc_message_utils.h index 75b80ae3..34e257a 100644 --- a/ipc/ipc_message_utils.h +++ b/ipc/ipc_message_utils.h @@ -16,6 +16,7 @@ #include "base/string16.h" #include "base/string_util.h" #include "base/tuple.h" +#include "ipc/ipc_param_traits.h" #include "ipc/ipc_sync_message.h" #if defined(COMPILER_GCC) @@ -132,14 +133,6 @@ class MessageIterator { //----------------------------------------------------------------------------- // ParamTraits specializations, etc. -template struct ParamTraits { -}; - -template -struct SimilarTypeTraits { - typedef P Type; -}; - template static inline void WriteParam(Message* m, const P& p) { typedef typename SimilarTypeTraits

::Type Type; diff --git a/ipc/ipc_param_traits.h b/ipc/ipc_param_traits.h new file mode 100644 index 0000000..e90be18 --- /dev/null +++ b/ipc/ipc_param_traits.h @@ -0,0 +1,24 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef IPC_IPC_PARAM_TRAITS_H_ +#define IPC_IPC_PARAM_TRAITS_H_ +#pragma once + +// Our IPC system uses the following partially specialized header to define how +// a data type is read, written and logged in the IPC system. + +namespace IPC { + +template struct ParamTraits { +}; + +template +struct SimilarTypeTraits { + typedef P Type; +}; + +} // namespace IPC + +#endif // IPC_IPC_PARAM_TRAITS_H_ -- cgit v1.1