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/public/common/common_param_traits.h"
12 #include "ipc/ipc_channel_handle.h"
13 #include "ipc/ipc_message_macros.h"
14 #include "ui/gfx/native_widget_types.h"
15 #include "ui/gfx/rect.h"
16 #include "webkit/common/cursors/webcursor.h"
19 #include "base/file_descriptor_posix.h"
22 #undef IPC_MESSAGE_EXPORT
23 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
25 #define IPC_MESSAGE_START PluginMsgStart
27 IPC_STRUCT_BEGIN(PluginMsg_Init_Params)
28 IPC_STRUCT_MEMBER(GURL, url)
29 IPC_STRUCT_MEMBER(GURL, page_url)
30 IPC_STRUCT_MEMBER(std::vector<std::string>, arg_names)
31 IPC_STRUCT_MEMBER(std::vector<std::string>, arg_values)
32 IPC_STRUCT_MEMBER(bool, load_manually)
33 IPC_STRUCT_MEMBER(int, host_render_view_routing_id)
36 IPC_STRUCT_BEGIN(PluginHostMsg_URLRequest_Params)
37 IPC_STRUCT_MEMBER(std::string, url)
38 IPC_STRUCT_MEMBER(std::string, method)
39 IPC_STRUCT_MEMBER(std::string, target)
40 IPC_STRUCT_MEMBER(std::vector<char>, buffer)
41 IPC_STRUCT_MEMBER(int, notify_id)
42 IPC_STRUCT_MEMBER(bool, popups_allowed)
43 IPC_STRUCT_MEMBER(bool, notify_redirects)
46 IPC_STRUCT_BEGIN(PluginMsg_DidReceiveResponseParams)
47 IPC_STRUCT_MEMBER(unsigned long, id)
48 IPC_STRUCT_MEMBER(std::string, mime_type)
49 IPC_STRUCT_MEMBER(std::string, headers)
50 IPC_STRUCT_MEMBER(uint32, expected_length)
51 IPC_STRUCT_MEMBER(uint32, last_modified)
52 IPC_STRUCT_MEMBER(bool, request_is_seekable)
55 IPC_STRUCT_BEGIN(PluginMsg_FetchURL_Params)
56 IPC_STRUCT_MEMBER(unsigned long, resource_id)
57 IPC_STRUCT_MEMBER(int, notify_id)
58 IPC_STRUCT_MEMBER(GURL, url)
59 IPC_STRUCT_MEMBER(GURL, first_party_for_cookies)
60 IPC_STRUCT_MEMBER(std::string, method)
61 IPC_STRUCT_MEMBER(std::vector<char>, post_data)
62 IPC_STRUCT_MEMBER(GURL, referrer)
63 IPC_STRUCT_MEMBER(bool, notify_redirect)
64 IPC_STRUCT_MEMBER(bool, is_plugin_src_load)
65 IPC_STRUCT_MEMBER(int, render_view_id)
68 IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param)
69 IPC_STRUCT_MEMBER(gfx::Rect, window_rect)
70 IPC_STRUCT_MEMBER(gfx::Rect, clip_rect)
71 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer0)
72 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer1)
73 IPC_STRUCT_MEMBER(int, windowless_buffer_index)
76 //-----------------------------------------------------------------------------
78 // These are messages sent from the renderer process to the plugin process.
79 // Tells the plugin process to create a new plugin instance with the given
80 // id. A corresponding WebPluginDelegateStub is created which hosts the
81 // WebPluginDelegateImpl.
82 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance,
83 std::string /* mime_type */,
84 int /* instance_id */)
86 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its
87 // destructor, so that the stub deletes the actual WebPluginDelegateImpl
88 // object that it's hosting.
89 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance,
90 int /* instance_id */)
92 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID,
95 // The messages below all map to WebPluginDelegate methods.
96 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init,
97 PluginMsg_Init_Params,
98 bool /* transparent */,
101 // Used to synchronously request a paint for windowless plugins.
102 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint,
103 gfx::Rect /* damaged_rect */)
105 // Sent by the renderer after it paints from its backing store so that the
106 // plugin knows it can send more invalidates.
107 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint)
109 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject,
112 // Gets the form value of the plugin instance synchronously.
113 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue,
114 string16 /* value */,
117 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason,
122 // Updates the plugin location.
123 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry,
124 PluginMsg_UpdateGeometry_Param)
126 // A synchronous version of above.
127 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync,
128 PluginMsg_UpdateGeometry_Param)
130 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus,
133 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent,
134 IPC::WebInputEventPointer /* event */,
136 WebCursor /* cursor type*/)
138 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus,
139 bool /* has_focus */)
141 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest,
142 unsigned long /* id */,
144 int /* http_status_code */)
146 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse,
147 PluginMsg_DidReceiveResponseParams)
149 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData,
150 unsigned long /* id */,
151 std::vector<char> /* buffer */,
152 int /* data_offset */)
154 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading,
155 unsigned long /* id */)
157 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail,
158 unsigned long /* id */)
160 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream,
162 std::string /* result */,
166 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse,
168 PluginMsg_DidReceiveResponseParams)
170 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData,
171 std::vector<char> /* buffer */)
173 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading)
175 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail)
177 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply,
178 unsigned long /* resource_id */,
182 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply,
183 unsigned long /* resource_id */,
184 int /* range_request_id */)
186 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent,
187 int /* render_view_id */)
189 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent,
190 int /* render_view_id */)
192 IPC_MESSAGE_ROUTED1(PluginMsg_FetchURL,
193 PluginMsg_FetchURL_Params)
195 IPC_MESSAGE_CONTROL1(PluginHostMsg_DidAbortLoading,
196 int /* render_view_id */)
199 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated,
201 std::vector<int> /* clauses */,
202 std::vector<int>, /* target */
203 int /* cursor_position */)
205 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted,
209 #if defined(OS_MACOSX)
210 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus,
211 bool /* has_focus */)
213 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden)
215 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown,
216 gfx::Rect /* window_frame */,
217 gfx::Rect /* view_frame */,
218 bool /* has_focus */)
220 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged,
221 gfx::Rect /* window_frame */,
222 gfx::Rect /* view_frame */)
224 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted,
227 // This message, used only on 10.6 and later, transmits the "fake"
228 // window handle allocated by the browser on behalf of the renderer
229 // to the GPU plugin.
230 IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle,
231 gfx::PluginWindowHandle /* window */)
234 //-----------------------------------------------------------------------------
235 // PluginHost messages
236 // These are messages sent from the plugin process to the renderer process.
237 // They all map to the corresponding WebPlugin methods.
238 // Sends the plugin window information to the renderer.
239 // The window parameter is a handle to the window if the plugin is a windowed
240 // plugin. It is NULL for windowless plugins.
241 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow,
242 gfx::PluginWindowHandle /* window */)
244 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest,
245 PluginHostMsg_URLRequest_Params)
247 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource,
250 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect,
251 gfx::Rect /* rect */)
253 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject,
257 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement,
261 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy,
264 std::string /* proxy list */)
266 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie,
268 GURL /* first_party_for_cookies */,
269 std::string /* cookie */)
271 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies,
273 GURL /* first_party_for_cookies */,
274 std::string /* cookies */)
276 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad)
278 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest,
279 std::string /* url */,
280 std::string /* range_info */,
281 int /* range_request_id */)
283 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStartLoading)
284 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStopLoading)
286 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading,
287 unsigned long /* resource_id */,
290 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException,
291 std::string /* message */)
293 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown)
295 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse,
297 int /* resource_id */)
299 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_CheckIfRunInsecureContent,
304 // The modal_loop_pump_messages_event parameter is an event handle which is
305 // passed in for windowless plugins and is used to indicate if messages
306 // are to be pumped in sync calls to the plugin process. Currently used
307 // in HandleEvent calls.
308 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData,
309 HANDLE /* modal_loop_pump_messages_event */,
310 gfx::NativeViewId /* dummy_activation_window*/)
312 // Send the IME status retrieved from a windowless plug-in. A windowless plug-in
313 // uses the IME attached to a browser process as a renderer does. A plug-in
314 // sends this message to control the IME status of a browser process. I would
315 // note that a plug-in sends this message to a renderer process that hosts this
316 // plug-in (not directly to a browser process) so the renderer process can
317 // update its IME status.
318 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus,
319 int /* input_type */,
320 gfx::Rect /* caret_rect */)
323 #if defined(OS_MACOSX)
324 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged,
327 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme)
329 //----------------------------------------------------------------------
330 // Core Animation plugin implementation rendering via compositor.
332 // Notifies the renderer process that this plugin will be using the
333 // accelerated rendering path.
334 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering)
336 // Notifies the renderer process that the plugin allocated a new
337 // IOSurface into which it is rendering. The renderer process forwards
338 // this IOSurface to the GPU process, causing it to be bound to a
339 // texture from which the compositor can render. Any previous
340 // IOSurface allocated by this plugin must be implicitly released by
341 // the receipt of this message.
342 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface,
345 uint32 /* surface_id */)
347 // Notifies the renderer process that the plugin produced a new frame
348 // of content into its IOSurface, and therefore that the compositor
350 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface)
354 //-----------------------------------------------------------------------------
356 // These are messages used to marshall NPObjects. They are sent both from the
357 // plugin to the renderer and from the renderer to the plugin.
358 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release)
360 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod,
361 content::NPIdentifier_Param /* name */,
364 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke,
365 bool /* is_default */,
366 content::NPIdentifier_Param /* method */,
367 std::vector<content::NPVariant_Param> /* args */,
368 content::NPVariant_Param /* result_param */,
371 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty,
372 content::NPIdentifier_Param /* name */,
375 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty,
376 content::NPIdentifier_Param /* name */,
377 content::NPVariant_Param /* property */,
380 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty,
381 content::NPIdentifier_Param /* name */,
382 content::NPVariant_Param /* property */,
385 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty,
386 content::NPIdentifier_Param /* name */,
389 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate)
391 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration,
392 std::vector<content::NPIdentifier_Param> /* value */,
395 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct,
396 std::vector<content::NPVariant_Param> /* args */,
397 content::NPVariant_Param /* result_param */,
400 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate,
401 std::string /* script */,
402 bool /* popups_allowed */,
403 content::NPVariant_Param /* result_param */,