1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Multiply-included message file, hence no include guard.
7 #include "build/build_config.h"
8 #include "content/child/plugin_param_traits.h"
9 #include "content/common/content_export.h"
10 #include "content/common/content_param_traits.h"
11 #include "content/common/cursors/webcursor.h"
12 #include "content/public/common/common_param_traits.h"
13 #include "ipc/ipc_channel_handle.h"
14 #include "ipc/ipc_message_macros.h"
15 #include "ui/gfx/ipc/gfx_param_traits.h"
16 #include "ui/gfx/native_widget_types.h"
17 #include "ui/gfx/rect.h"
20 #include "base/file_descriptor_posix.h"
23 #undef IPC_MESSAGE_EXPORT
24 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
26 #define IPC_MESSAGE_START PluginMsgStart
28 IPC_STRUCT_BEGIN(PluginMsg_Init_Params
)
29 IPC_STRUCT_MEMBER(GURL
, url
)
30 IPC_STRUCT_MEMBER(GURL
, page_url
)
31 IPC_STRUCT_MEMBER(std::vector
<std::string
>, arg_names
)
32 IPC_STRUCT_MEMBER(std::vector
<std::string
>, arg_values
)
33 IPC_STRUCT_MEMBER(bool, load_manually
)
34 IPC_STRUCT_MEMBER(int, host_render_view_routing_id
)
37 IPC_STRUCT_BEGIN(PluginHostMsg_URLRequest_Params
)
38 IPC_STRUCT_MEMBER(std::string
, url
)
39 IPC_STRUCT_MEMBER(std::string
, method
)
40 IPC_STRUCT_MEMBER(std::string
, target
)
41 IPC_STRUCT_MEMBER(std::vector
<char>, buffer
)
42 IPC_STRUCT_MEMBER(int, notify_id
)
43 IPC_STRUCT_MEMBER(bool, popups_allowed
)
44 IPC_STRUCT_MEMBER(bool, notify_redirects
)
47 IPC_STRUCT_BEGIN(PluginMsg_DidReceiveResponseParams
)
48 IPC_STRUCT_MEMBER(unsigned long, id
)
49 IPC_STRUCT_MEMBER(std::string
, mime_type
)
50 IPC_STRUCT_MEMBER(std::string
, headers
)
51 IPC_STRUCT_MEMBER(uint32
, expected_length
)
52 IPC_STRUCT_MEMBER(uint32
, last_modified
)
53 IPC_STRUCT_MEMBER(bool, request_is_seekable
)
56 IPC_STRUCT_BEGIN(PluginMsg_FetchURL_Params
)
57 IPC_STRUCT_MEMBER(unsigned long, resource_id
)
58 IPC_STRUCT_MEMBER(int, notify_id
)
59 IPC_STRUCT_MEMBER(GURL
, url
)
60 IPC_STRUCT_MEMBER(GURL
, first_party_for_cookies
)
61 IPC_STRUCT_MEMBER(std::string
, method
)
62 IPC_STRUCT_MEMBER(std::vector
<char>, post_data
)
63 IPC_STRUCT_MEMBER(GURL
, referrer
)
64 IPC_STRUCT_MEMBER(bool, notify_redirect
)
65 IPC_STRUCT_MEMBER(bool, is_plugin_src_load
)
66 IPC_STRUCT_MEMBER(int, render_frame_id
)
69 IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param
)
70 IPC_STRUCT_MEMBER(gfx::Rect
, window_rect
)
71 IPC_STRUCT_MEMBER(gfx::Rect
, clip_rect
)
72 IPC_STRUCT_MEMBER(TransportDIB::Handle
, windowless_buffer0
)
73 IPC_STRUCT_MEMBER(TransportDIB::Handle
, windowless_buffer1
)
74 IPC_STRUCT_MEMBER(int, windowless_buffer_index
)
77 //-----------------------------------------------------------------------------
79 // These are messages sent from the renderer process to the plugin process.
80 // Tells the plugin process to create a new plugin instance with the given
81 // id. A corresponding WebPluginDelegateStub is created which hosts the
82 // WebPluginDelegateImpl.
83 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance
,
84 std::string
/* mime_type */,
85 int /* instance_id */)
87 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its
88 // destructor, so that the stub deletes the actual WebPluginDelegateImpl
89 // object that it's hosting.
90 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance
,
91 int /* instance_id */)
93 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID
,
96 // The messages below all map to WebPluginDelegate methods.
97 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init
,
98 PluginMsg_Init_Params
,
99 bool /* transparent */,
102 // Used to synchronously request a paint for windowless plugins.
103 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint
,
104 gfx::Rect
/* damaged_rect */)
106 // Sent by the renderer after it paints from its backing store so that the
107 // plugin knows it can send more invalidates.
108 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint
)
110 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject
,
113 // Gets the form value of the plugin instance synchronously.
114 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue
,
115 base::string16
/* value */,
118 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason
,
123 // Updates the plugin location.
124 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry
,
125 PluginMsg_UpdateGeometry_Param
)
127 // A synchronous version of above.
128 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync
,
129 PluginMsg_UpdateGeometry_Param
)
131 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus
,
134 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent
,
135 IPC::WebInputEventPointer
/* event */,
137 content::WebCursor
/* cursor type*/)
139 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus
,
140 bool /* has_focus */)
142 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest
,
143 unsigned long /* id */,
145 int /* http_status_code */)
147 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse
,
148 PluginMsg_DidReceiveResponseParams
)
150 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData
,
151 unsigned long /* id */,
152 std::vector
<char> /* buffer */,
153 int /* data_offset */)
155 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading
,
156 unsigned long /* id */)
158 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail
,
159 unsigned long /* id */)
161 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream
,
163 std::string
/* result */,
167 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse
,
169 PluginMsg_DidReceiveResponseParams
)
171 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData
,
172 std::vector
<char> /* buffer */)
174 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading
)
176 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail
)
178 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply
,
179 unsigned long /* resource_id */,
183 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply
,
184 unsigned long /* resource_id */,
185 int /* range_request_id */)
187 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent
,
188 int /* render_view_id */)
190 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent
,
191 int /* render_view_id */)
193 IPC_MESSAGE_ROUTED1(PluginMsg_FetchURL
,
194 PluginMsg_FetchURL_Params
)
196 IPC_MESSAGE_CONTROL1(PluginHostMsg_DidAbortLoading
,
197 int /* render_view_id */)
200 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated
,
201 base::string16
/* text */,
202 std::vector
<int> /* clauses */,
203 std::vector
<int>, /* target */
204 int /* cursor_position */)
206 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted
,
207 base::string16
/* text */)
210 #if defined(OS_MACOSX)
211 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus
,
212 bool /* has_focus */)
214 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden
)
216 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown
,
217 gfx::Rect
/* window_frame */,
218 gfx::Rect
/* view_frame */,
219 bool /* has_focus */)
221 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged
,
222 gfx::Rect
/* window_frame */,
223 gfx::Rect
/* view_frame */)
225 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted
,
226 base::string16
/* text */)
229 //-----------------------------------------------------------------------------
230 // PluginHost messages
231 // These are messages sent from the plugin process to the renderer process.
232 // They all map to the corresponding WebPlugin methods.
233 // Sends the plugin window information to the renderer.
234 // The window parameter is a handle to the window if the plugin is a windowed
235 // plugin. It is NULL for windowless plugins.
236 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow
,
237 gfx::PluginWindowHandle
/* window */)
239 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest
,
240 PluginHostMsg_URLRequest_Params
)
242 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource
,
245 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect
,
246 gfx::Rect
/* rect */)
248 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject
,
252 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement
,
256 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy
,
259 std::string
/* proxy list */)
261 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie
,
263 GURL
/* first_party_for_cookies */,
264 std::string
/* cookie */)
266 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies
,
268 GURL
/* first_party_for_cookies */,
269 std::string
/* cookies */)
271 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad
)
273 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest
,
274 std::string
/* url */,
275 std::string
/* range_info */,
276 int /* range_request_id */)
278 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStartLoading
)
279 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStopLoading
)
281 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading
,
282 unsigned long /* resource_id */,
285 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException
,
286 std::string
/* message */)
288 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown
)
290 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse
,
292 int /* resource_id */)
294 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_CheckIfRunInsecureContent
,
299 // The modal_loop_pump_messages_event parameter is an event handle which is
300 // passed in for windowless plugins and is used to indicate if messages
301 // are to be pumped in sync calls to the plugin process. Currently used
302 // in HandleEvent calls.
303 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData
,
304 HANDLE
/* modal_loop_pump_messages_event */,
305 gfx::NativeViewId
/* dummy_activation_window*/)
307 // Send the IME status retrieved from a windowless plug-in. A windowless plug-in
308 // uses the IME attached to a browser process as a renderer does. A plug-in
309 // sends this message to control the IME status of a browser process. I would
310 // note that a plug-in sends this message to a renderer process that hosts this
311 // plug-in (not directly to a browser process) so the renderer process can
312 // update its IME status.
313 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus
,
314 int /* input_type */,
315 gfx::Rect
/* caret_rect */)
318 #if defined(OS_MACOSX)
319 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged
,
322 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme
)
324 //----------------------------------------------------------------------
325 // Core Animation plugin implementation rendering via compositor.
327 // Notifies the renderer process that this plugin will be using the
328 // accelerated rendering path.
329 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering
)
331 // Notifies the renderer process that the plugin allocated a new
332 // IOSurface into which it is rendering. The renderer process forwards
333 // this IOSurface to the GPU process, causing it to be bound to a
334 // texture from which the compositor can render. Any previous
335 // IOSurface allocated by this plugin must be implicitly released by
336 // the receipt of this message.
337 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface
,
340 uint32
/* surface_id */)
342 // Notifies the renderer process that the plugin produced a new frame
343 // of content into its IOSurface, and therefore that the compositor
345 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface
)
349 //-----------------------------------------------------------------------------
351 // These are messages used to marshall NPObjects. They are sent both from the
352 // plugin to the renderer and from the renderer to the plugin.
353 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release
)
355 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod
,
356 content::NPIdentifier_Param
/* name */,
359 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke
,
360 bool /* is_default */,
361 content::NPIdentifier_Param
/* method */,
362 std::vector
<content::NPVariant_Param
> /* args */,
363 content::NPVariant_Param
/* result_param */,
366 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty
,
367 content::NPIdentifier_Param
/* name */,
370 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty
,
371 content::NPIdentifier_Param
/* name */,
372 content::NPVariant_Param
/* property */,
375 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty
,
376 content::NPIdentifier_Param
/* name */,
377 content::NPVariant_Param
/* property */,
380 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty
,
381 content::NPIdentifier_Param
/* name */,
384 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate
)
386 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration
,
387 std::vector
<content::NPIdentifier_Param
> /* value */,
390 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct
,
391 std::vector
<content::NPVariant_Param
> /* args */,
392 content::NPVariant_Param
/* result_param */,
395 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate
,
396 std::string
/* script */,
397 bool /* popups_allowed */,
398 content::NPVariant_Param
/* result_param */,