diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 22:16:10 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-14 22:16:10 +0000 |
commit | 105303e5d9bf528bb4163312b2fd318f218dd33b (patch) | |
tree | b3d63276044578d8902df4b5a11bba688deafd20 /content/common | |
parent | 74c2d8475aa9e4b4aa5a574ce9fb80d0a411df4a (diff) | |
download | chromium_src-105303e5d9bf528bb4163312b2fd318f218dd33b.zip chromium_src-105303e5d9bf528bb4163312b2fd318f218dd33b.tar.gz chromium_src-105303e5d9bf528bb4163312b2fd318f218dd33b.tar.bz2 |
Move plugin messages to content.
TBR=tsepez
Review URL: http://codereview.chromium.org/6682033
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@78099 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/common')
-rw-r--r-- | content/common/common_param_traits.cc | 106 | ||||
-rw-r--r-- | content/common/common_param_traits.h | 198 | ||||
-rw-r--r-- | content/common/content_message_generator.h | 1 | ||||
-rw-r--r-- | content/common/plugin_messages.h | 494 |
4 files changed, 787 insertions, 12 deletions
diff --git a/content/common/common_param_traits.cc b/content/common/common_param_traits.cc index ae08752..21c4801 100644 --- a/content/common/common_param_traits.cc +++ b/content/common/common_param_traits.cc @@ -8,9 +8,28 @@ #include "net/base/host_port_pair.h" #include "net/base/upload_data.h" #include "net/http/http_response_headers.h" +#include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" #include "ui/gfx/rect.h" #include "webkit/glue/resource_loader_bridge.h" +NPIdentifier_Param::NPIdentifier_Param() + : identifier() { +} + +NPIdentifier_Param::~NPIdentifier_Param() { +} + +NPVariant_Param::NPVariant_Param() + : type(NPVARIANT_PARAM_VOID), + bool_value(false), + int_value(0), + double_value(0), + npobject_routing_id(-1) { +} + +NPVariant_Param::~NPVariant_Param() { +} + namespace IPC { void ParamTraits<GURL>::Write(Message* m, const GURL& p) { @@ -655,4 +674,91 @@ void ParamTraits<scoped_refptr<webkit_blob::BlobData> >::Log( l->append("<webkit_blob::BlobData>"); } +void ParamTraits<NPVariant_Param>::Write(Message* m, const param_type& p) { + WriteParam(m, static_cast<int>(p.type)); + if (p.type == NPVARIANT_PARAM_BOOL) { + WriteParam(m, p.bool_value); + } else if (p.type == NPVARIANT_PARAM_INT) { + WriteParam(m, p.int_value); + } else if (p.type == NPVARIANT_PARAM_DOUBLE) { + WriteParam(m, p.double_value); + } else if (p.type == NPVARIANT_PARAM_STRING) { + WriteParam(m, p.string_value); + } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || + p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { + // This is the routing id used to connect NPObjectProxy in the other + // process with NPObjectStub in this process or to identify the raw + // npobject pointer to be used in the callee process. + WriteParam(m, p.npobject_routing_id); + } else { + DCHECK(p.type == NPVARIANT_PARAM_VOID || p.type == NPVARIANT_PARAM_NULL); + } +} + +bool ParamTraits<NPVariant_Param>::Read(const Message* m, + void** iter, + param_type* r) { + int type; + if (!ReadParam(m, iter, &type)) + return false; + + bool result = false; + r->type = static_cast<NPVariant_ParamEnum>(type); + if (r->type == NPVARIANT_PARAM_BOOL) { + result = ReadParam(m, iter, &r->bool_value); + } else if (r->type == NPVARIANT_PARAM_INT) { + result = ReadParam(m, iter, &r->int_value); + } else if (r->type == NPVARIANT_PARAM_DOUBLE) { + result = ReadParam(m, iter, &r->double_value); + } else if (r->type == NPVARIANT_PARAM_STRING) { + result = ReadParam(m, iter, &r->string_value); + } else if (r->type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || + r->type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { + result = ReadParam(m, iter, &r->npobject_routing_id); + } else if ((r->type == NPVARIANT_PARAM_VOID) || + (r->type == NPVARIANT_PARAM_NULL)) { + result = true; + } else { + NOTREACHED(); + } + + return result; +} + +void ParamTraits<NPVariant_Param>::Log(const param_type& p, std::string* l) { + if (p.type == NPVARIANT_PARAM_BOOL) { + LogParam(p.bool_value, l); + } else if (p.type == NPVARIANT_PARAM_INT) { + LogParam(p.int_value, l); + } else if (p.type == NPVARIANT_PARAM_DOUBLE) { + LogParam(p.double_value, l); + } else if (p.type == NPVARIANT_PARAM_STRING) { + LogParam(p.string_value, l); + } else if (p.type == NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID || + p.type == NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID) { + LogParam(p.npobject_routing_id, l); + } +} + +void ParamTraits<NPIdentifier_Param>::Write(Message* m, const param_type& p) { + webkit_glue::SerializeNPIdentifier(p.identifier, m); +} + +bool ParamTraits<NPIdentifier_Param>::Read(const Message* m, + void** iter, + param_type* r) { + return webkit_glue::DeserializeNPIdentifier(*m, iter, &r->identifier); +} + +void ParamTraits<NPIdentifier_Param>::Log(const param_type& p, std::string* l) { + if (WebKit::WebBindings::identifierIsString(p.identifier)) { + NPUTF8* str = WebKit::WebBindings::utf8FromIdentifier(p.identifier); + l->append(str); + NPN_MemFree(str); + } else { + l->append(base::IntToString( + WebKit::WebBindings::intFromIdentifier(p.identifier))); + } +} + } // namespace IPC diff --git a/content/common/common_param_traits.h b/content/common/common_param_traits.h index 96b4d0d..6559440 100644 --- a/content/common/common_param_traits.h +++ b/content/common/common_param_traits.h @@ -14,27 +14,20 @@ #define CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ #pragma once +#include "app/surface/transport_dib.h" #include "base/platform_file.h" #include "base/ref_counted.h" +#include "base/string_number_conversions.h" #include "googleurl/src/gurl.h" #include "ipc/ipc_message_utils.h" #include "net/base/ip_endpoint.h" #include "net/url_request/url_request_status.h" -// !!! WARNING: DO NOT ADD NEW WEBKIT DEPENDENCIES !!! - -// -// That means don't add #includes to any file in 'webkit/' or -// 'third_party/WebKit/'. Chrome Frame and NACL build parts of base/ and -// content/common/ for a mini-library that doesn't depend on webkit. - -// TODO(erg): The following headers are historical and only work because -// their definitions are inlined, which also needs to be fixed. +#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" #include "ui/gfx/native_widget_types.h" #include "webkit/blob/blob_data.h" +#include "webkit/glue/npruntime_util.h" #include "webkit/glue/resource_type.h" - -// Forward declarations. -class GURL; +#include "webkit/glue/webcursor.h" namespace gfx { class Point; @@ -53,6 +46,43 @@ struct ResourceDevToolsInfo; struct ResourceLoadTimingInfo; } +// Define the NPVariant_Param struct and its enum here since it needs manual +// serialization code. +enum NPVariant_ParamEnum { + NPVARIANT_PARAM_VOID, + NPVARIANT_PARAM_NULL, + NPVARIANT_PARAM_BOOL, + NPVARIANT_PARAM_INT, + NPVARIANT_PARAM_DOUBLE, + NPVARIANT_PARAM_STRING, + // Used when when the NPObject is running in the caller's process, so we + // create an NPObjectProxy in the other process. + NPVARIANT_PARAM_SENDER_OBJECT_ROUTING_ID, + // Used when the NPObject we're sending is running in the callee's process + // (i.e. we have an NPObjectProxy for it). In that case we want the callee + // to just use the raw pointer. + NPVARIANT_PARAM_RECEIVER_OBJECT_ROUTING_ID, +}; + +struct NPVariant_Param { + NPVariant_Param(); + ~NPVariant_Param(); + + NPVariant_ParamEnum type; + bool bool_value; + int int_value; + double double_value; + std::string string_value; + int npobject_routing_id; +}; + +struct NPIdentifier_Param { + NPIdentifier_Param(); + ~NPIdentifier_Param(); + + NPIdentifier identifier; +}; + namespace IPC { template <> @@ -204,6 +234,150 @@ struct ParamTraits<scoped_refptr<webkit_blob::BlobData > > { static void Log(const param_type& p, std::string* l); }; +template <> +struct ParamTraits<NPVariant_Param> { + typedef NPVariant_Param 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<NPIdentifier_Param> { + typedef NPIdentifier_Param 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<WebCursor> { + typedef WebCursor param_type; + static void Write(Message* m, const param_type& p) { + p.Serialize(m); + } + static bool Read(const Message* m, void** iter, param_type* r) { + return r->Deserialize(m, iter); + } + static void Log(const param_type& p, std::string* l) { + l->append("<WebCursor>"); + } +}; + + +template <> +struct ParamTraits<WebKit::WebInputEvent::Type> { + typedef WebKit::WebInputEvent::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<WebKit::WebInputEvent::Type>(type); + return true; + } + static void Log(const param_type& p, std::string* l) { + const char* type; + switch (p) { + case WebKit::WebInputEvent::MouseDown: + type = "MouseDown"; + break; + case WebKit::WebInputEvent::MouseUp: + type = "MouseUp"; + break; + case WebKit::WebInputEvent::MouseMove: + type = "MouseMove"; + break; + case WebKit::WebInputEvent::MouseLeave: + type = "MouseLeave"; + break; + case WebKit::WebInputEvent::MouseEnter: + type = "MouseEnter"; + break; + case WebKit::WebInputEvent::MouseWheel: + type = "MouseWheel"; + break; + case WebKit::WebInputEvent::RawKeyDown: + type = "RawKeyDown"; + break; + case WebKit::WebInputEvent::KeyDown: + type = "KeyDown"; + break; + case WebKit::WebInputEvent::KeyUp: + type = "KeyUp"; + break; + default: + type = "None"; + break; + } + LogParam(std::string(type), l); + } +}; + +typedef const WebKit::WebInputEvent* WebInputEventPointer; +template <> +struct ParamTraits<WebInputEventPointer> { + typedef WebInputEventPointer param_type; + static void Write(Message* m, const param_type& p) { + m->WriteData(reinterpret_cast<const char*>(p), p->size); + } + // Note: upon read, the event has the lifetime of the message. + static bool Read(const Message* m, void** iter, param_type* r) { + const char* data; + int data_length; + if (!m->ReadData(iter, &data, &data_length)) { + NOTREACHED(); + return false; + } + if (data_length < static_cast<int>(sizeof(WebKit::WebInputEvent))) { + NOTREACHED(); + return false; + } + param_type event = reinterpret_cast<param_type>(data); + // Check that the data size matches that of the event (we check the latter + // in the delegate). + if (data_length != static_cast<int>(event->size)) { + NOTREACHED(); + return false; + } + *r = event; + return true; + } + static void Log(const param_type& p, std::string* l) { + l->append("("); + LogParam(p->size, l); + l->append(", "); + LogParam(p->type, l); + l->append(", "); + LogParam(p->timeStampSeconds, l); + l->append(")"); + } +}; + +#if defined(OS_WIN) +template<> +struct ParamTraits<TransportDIB::Id> { + typedef TransportDIB::Id param_type; + static void Write(Message* m, const param_type& p) { + WriteParam(m, p.handle); + WriteParam(m, p.sequence_num); + } + static bool Read(const Message* m, void** iter, param_type* r) { + return (ReadParam(m, iter, &r->handle) && + ReadParam(m, iter, &r->sequence_num)); + } + static void Log(const param_type& p, std::string* l) { + l->append("TransportDIB("); + LogParam(p.handle, l); + l->append(", "); + LogParam(p.sequence_num, l); + l->append(")"); + } +}; +#endif + } // namespace IPC #endif // CONTENT_COMMON_COMMON_PARAM_TRAITS_H_ diff --git a/content/common/content_message_generator.h b/content/common/content_message_generator.h index 117865f..f068598 100644 --- a/content/common/content_message_generator.h +++ b/content/common/content_message_generator.h @@ -10,6 +10,7 @@ #include "content/common/file_system_messages.h" #include "content/common/file_utilities_messages.h" #include "content/common/p2p_messages.h" +#include "content/common/plugin_messages.h" #include "content/common/gpu_messages.h" #include "content/common/mime_registry_messages.h" #include "content/common/resource_messages.h" diff --git a/content/common/plugin_messages.h b/content/common/plugin_messages.h new file mode 100644 index 0000000..b8bd205 --- /dev/null +++ b/content/common/plugin_messages.h @@ -0,0 +1,494 @@ +// Copyright (c) 2009 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. +// +// Multiply-included message file, hence no include guard. + +#include "base/shared_memory.h" +#include "build/build_config.h" +#include "content/common/common_param_traits.h" +#include "ipc/ipc_channel_handle.h" +#include "ipc/ipc_message_macros.h" +#include "ui/gfx/native_widget_types.h" +#include "ui/gfx/rect.h" +#include "webkit/glue/webcursor.h" + +#if defined(OS_POSIX) +#include "base/file_descriptor_posix.h" +#endif + +#define IPC_MESSAGE_START PluginMsgStart + +IPC_STRUCT_BEGIN(PluginMsg_Init_Params) + IPC_STRUCT_MEMBER(gfx::NativeViewId, containing_window) + IPC_STRUCT_MEMBER(GURL, url) + IPC_STRUCT_MEMBER(GURL, page_url) + IPC_STRUCT_MEMBER(std::vector<std::string>, arg_names) + IPC_STRUCT_MEMBER(std::vector<std::string>, arg_values) + IPC_STRUCT_MEMBER(bool, load_manually) + IPC_STRUCT_MEMBER(int, host_render_view_routing_id) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(PluginHostMsg_URLRequest_Params) + IPC_STRUCT_MEMBER(std::string, url) + IPC_STRUCT_MEMBER(std::string, method) + IPC_STRUCT_MEMBER(std::string, target) + IPC_STRUCT_MEMBER(std::vector<char>, buffer) + IPC_STRUCT_MEMBER(int, notify_id) + IPC_STRUCT_MEMBER(bool, popups_allowed) + IPC_STRUCT_MEMBER(bool, notify_redirects) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(PluginMsg_DidReceiveResponseParams) + IPC_STRUCT_MEMBER(unsigned long, id) + IPC_STRUCT_MEMBER(std::string, mime_type) + IPC_STRUCT_MEMBER(std::string, headers) + IPC_STRUCT_MEMBER(uint32, expected_length) + IPC_STRUCT_MEMBER(uint32, last_modified) + IPC_STRUCT_MEMBER(bool, request_is_seekable) +IPC_STRUCT_END() + +IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param) + IPC_STRUCT_MEMBER(gfx::Rect, window_rect) + IPC_STRUCT_MEMBER(gfx::Rect, clip_rect) + IPC_STRUCT_MEMBER(bool, transparent) + IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer) + IPC_STRUCT_MEMBER(TransportDIB::Handle, background_buffer) + +#if defined(OS_MACOSX) + // This field contains a key that the plug-in process is expected to return + // to the renderer in its ACK message, unless the value is -1, in which case + // no ACK message is required. Other than the special -1 value, the values + // used in ack_key are opaque to the plug-in process. + IPC_STRUCT_MEMBER(int, ack_key) +#endif +IPC_STRUCT_END() + +//----------------------------------------------------------------------------- +// PluginProcess messages +// These are messages sent from the browser to the plugin process. +// Tells the plugin process to create a new channel for communication with a +// given renderer. The channel name is returned in a +// PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so +// that the plugin process reuses an existing channel to that process if it +// exists. This ID is a unique opaque identifier generated by the browser +// process. +IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, + int /* renderer_id */, + bool /* off_the_record */) + +// Tells the plugin process to notify every connected renderer of the pending +// shutdown, so we don't mistake it for a crash. +IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) + + +//----------------------------------------------------------------------------- +// PluginProcessHost messages +// These are messages sent from the plugin process to the browser process. +// Response to a PluginProcessMsg_CreateChannel message. +IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, + IPC::ChannelHandle /* channel_handle */) + +IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, + std::string /* plugin finder URL */) + +IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest) + +// Get the list of proxies to use for |url|, as a semicolon delimited list +// of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy +// which does the same thing. +IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy, + GURL /* url */, + int /* network error */, + std::string /* proxy list */) + +#if defined(OS_WIN) +// Destroys the given window's parent on the UI thread. +IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, + HWND /* window */, + HWND /* parent */) + +IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl, + std::string /* URL */, + int /* process id */, + HWND /* caller window */) +#endif + +#if defined(USE_X11) +// On X11, the mapping between NativeViewId and X window ids +// is known only to the browser. This message lets the plugin process +// ask about a NativeViewId that was provided by the renderer. +// It will get 0 back if it's a bogus input. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId, + gfx::NativeViewId /* input: native view id */, + gfx::PluginWindowHandle /* output: X window id */) +#endif + +#if defined(OS_MACOSX) +// On Mac OS X, we need the browser to keep track of plugin windows so +// that it can add and remove them from stacking groups, hide and show the +// menu bar, etc. We pass the window rect for convenience so that the +// browser can easily tell if the window is fullscreen. + +// Notifies the browser that the plugin has selected a window (i.e., brought +// it to the front and wants it to have keyboard focus). +IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */, + bool /* modal */) + +// Notifies the browser that the plugin has shown a window. +IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */, + bool /* modal */) + +// Notifies the browser that the plugin has hidden a window. +IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow, + uint32 /* window ID */, + gfx::Rect /* window rect */) + +// Notifies the browser that a plugin instance has requested a cursor +// visibility change. +IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility, + bool /* cursor visibility */) +#endif + + +//----------------------------------------------------------------------------- +// Plugin messages +// These are messages sent from the renderer process to the plugin process. +// Tells the plugin process to create a new plugin instance with the given +// id. A corresponding WebPluginDelegateStub is created which hosts the +// WebPluginDelegateImpl. +IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, + std::string /* mime_type */, + int /* instance_id */) + +// The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its +// destructor, so that the stub deletes the actual WebPluginDelegateImpl +// object that it's hosting. +IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, + int /* instance_id */) + +IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, + int /* id */) + +// The messages below all map to WebPluginDelegate methods. +IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_Init, + PluginMsg_Init_Params, + bool /* result */) + +// Used to synchronously request a paint for windowless plugins. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, + gfx::Rect /* damaged_rect */) + +// Sent by the renderer after it paints from its backing store so that the +// plugin knows it can send more invalidates. +IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) + +IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print, + base::SharedMemoryHandle /* shared_memory*/, + uint32 /* size */) + +IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, + int /* route_id */) + +IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, + GURL /* url */, + int /* reason */, + int /* notify_id */) + +// Updates the plugin location. +IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, + PluginMsg_UpdateGeometry_Param) + +// A synchronous version of above. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, + PluginMsg_UpdateGeometry_Param) + +IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, + bool /* focused */) + +IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, + IPC::WebInputEventPointer /* event */, + bool /* handled */, + WebCursor /* cursor type*/) + +IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, + bool /* has_focus */) + +#if defined(OS_MACOSX) +IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, + bool /* has_focus */) + +IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) + +IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, + gfx::Rect /* window_frame */, + gfx::Rect /* view_frame */, + bool /* has_focus */) + +IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, + gfx::Rect /* window_frame */, + gfx::Rect /* view_frame */) + +IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, + string16 /* text */) +#endif + +IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, + unsigned long /* id */, + GURL /* url */, + int /* http_status_code */) + +IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, + PluginMsg_DidReceiveResponseParams) + +IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, + unsigned long /* id */, + std::vector<char> /* buffer */, + int /* data_offset */) + +IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, + unsigned long /* id */) + +IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, + unsigned long /* id */) + +IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, + GURL /* url */, + std::string /* result */, + bool /* success */, + int /* notify_id */) + +IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, + GURL /* url */, + PluginMsg_DidReceiveResponseParams) + +IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, + std::vector<char> /* buffer */) + +IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) + +IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) + +IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin) + +IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, + unsigned long /* resource_id */, + GURL /* url */, + int /* notify_id */) + +IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, + unsigned long /* resource_id */, + int /* range_request_id */) + +IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, + gfx::NativeViewId /* containing_window */) + +IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, + gfx::NativeViewId /* containing_window */) + +#if defined(OS_MACOSX) +// This message, used only on 10.6 and later, transmits the "fake" +// window handle allocated by the browser on behalf of the renderer +// to the GPU plugin. +IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, + gfx::PluginWindowHandle /* window */) +#endif + +IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData, + std::string, /* site */ + uint64, /* flags */ + base::Time /* begin_time */) + + +//----------------------------------------------------------------------------- +// PluginHost messages +// These are messages sent from the plugin process to the renderer process. +// They all map to the corresponding WebPlugin methods. +// Sends the plugin window information to the renderer. +// The window parameter is a handle to the window if the plugin is a windowed +// plugin. It is NULL for windowless plugins. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, + gfx::PluginWindowHandle /* window */) + +#if defined(OS_WIN) +// The modal_loop_pump_messages_event parameter is an event handle which is +// passed in for windowless plugins and is used to indicate if messages +// are to be pumped in sync calls to the plugin process. Currently used +// in HandleEvent calls. +IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent, + HANDLE /* modal_loop_pump_messages_event */) +#endif + +IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, + PluginHostMsg_URLRequest_Params) + +IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, + int /* id */) + +IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, + gfx::Rect /* rect */) + +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, + int /* route id */, + bool /* success */) + +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, + int /* route id */, + bool /* success */) + +IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookie */) + +IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, + GURL /* url */, + GURL /* first_party_for_cookies */, + std::string /* cookies */) + +IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, + int /* status */) + +IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) + +IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, + std::string /* url */, + std::string /* range_info */, + int /* range_request_id */) + +IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, + unsigned long /* resource_id */, + bool /* defer */) + +IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, + std::string /* message */) + +IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) + +#if defined(OS_MACOSX) +IPC_MESSAGE_ROUTED1(PluginHostMsg_UpdateGeometry_ACK, + int /* ack_key */) + +IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged, + bool /* focused */) + +IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme) + +// This message, used in Mac OS X 10.5 and earlier, is sent from the plug-in +// process to the renderer process to indicate that the plug-in allocated a +// new TransportDIB that holds the GPU's rendered image. This information is +// then forwarded to the browser process via a similar message. +IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + TransportDIB::Handle /* handle to the TransportDIB */) + +// Synthesize a fake window handle for the plug-in to identify the instance +// to the browser, allowing mapping to a surface for hardware accelleration +// of plug-in content. The browser generates the handle which is then set on +// the plug-in. |opaque| indicates whether the content should be treated as +// opaque. +IPC_MESSAGE_ROUTED1(PluginHostMsg_BindFakePluginWindowHandle, + bool /* opaque */) + +// This message, used only on 10.6 and later, is sent from the plug-in process +// to the renderer process to indicate that the plugin allocated a new +// IOSurface object of the given width and height. This information is then +// forwarded on to the browser process. +// +// NOTE: the original intent was to pass a mach port as the IOSurface +// identifier but it looks like that will be a lot of work. For now we pass an +// ID from IOSurfaceGetID. +IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetIOSurface, + gfx::PluginWindowHandle /* window */, + int32 /* width */, + int32 /* height */, + uint64 /* surface_id */) + + +// On the Mac, shared memory can't be allocated in the sandbox, so +// the TransportDIB used by the plug-in for rendering has to be allocated +// and managed by the browser. This is a synchronous message, use with care. +IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_AllocTransportDIB, + size_t /* requested memory size */, + TransportDIB::Handle /* output: DIB handle */) + +// Since the browser keeps handles to the allocated transport DIBs, this +// message is sent to tell the browser that it may release them when the +// renderer is finished with them. +IPC_MESSAGE_ROUTED1(PluginHostMsg_FreeTransportDIB, + TransportDIB::Id /* DIB id */) + +// This message notifies the renderer process (and from there the +// browser process) that the plug-in swapped the buffers associated +// with the given "window", which should cause the browser to redraw +// the various plug-ins' contents. +IPC_MESSAGE_ROUTED2(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, + gfx::PluginWindowHandle /* window */, + uint64 /* surface_id */) +#endif + +IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult, + bool /* success */) + +IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, + bool /* allow */, + int /* resource_id */) + + +//----------------------------------------------------------------------------- +// NPObject messages +// These are messages used to marshall NPObjects. They are sent both from the +// plugin to the renderer and from the renderer to the plugin. +IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, + bool /* is_default */, + NPIdentifier_Param /* method */, + std::vector<NPVariant_Param> /* args */, + NPVariant_Param /* result_param */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, + NPIdentifier_Param /* name */, + NPVariant_Param /* property */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, + NPIdentifier_Param /* name */, + NPVariant_Param /* property */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, + NPIdentifier_Param /* name */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) + +IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, + std::vector<NPIdentifier_Param> /* value */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, + std::vector<NPVariant_Param> /* args */, + NPVariant_Param /* result_param */, + bool /* result */) + +IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, + std::string /* script */, + bool /* popups_allowed */, + NPVariant_Param /* result_param */, + bool /* result */) |