1 // Copyright (c) 2012 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/common/content_export.h"
9 #include "content/common/content_param_traits.h"
10 #include "content/public/common/common_param_traits.h"
11 #include "ipc/ipc_channel_handle.h"
12 #include "ipc/ipc_message_macros.h"
13 #include "ui/gfx/native_widget_types.h"
14 #include "ui/gfx/rect.h"
15 #include "webkit/glue/webcursor.h"
18 #include "base/file_descriptor_posix.h"
21 #undef IPC_MESSAGE_EXPORT
22 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
24 #define IPC_MESSAGE_START PluginMsgStart
26 IPC_STRUCT_BEGIN(PluginMsg_Init_Params
)
27 IPC_STRUCT_MEMBER(GURL
, url
)
28 IPC_STRUCT_MEMBER(GURL
, page_url
)
29 IPC_STRUCT_MEMBER(std::vector
<std::string
>, arg_names
)
30 IPC_STRUCT_MEMBER(std::vector
<std::string
>, arg_values
)
31 IPC_STRUCT_MEMBER(bool, load_manually
)
32 IPC_STRUCT_MEMBER(int, host_render_view_routing_id
)
35 IPC_STRUCT_BEGIN(PluginHostMsg_URLRequest_Params
)
36 IPC_STRUCT_MEMBER(std::string
, url
)
37 IPC_STRUCT_MEMBER(std::string
, method
)
38 IPC_STRUCT_MEMBER(std::string
, target
)
39 IPC_STRUCT_MEMBER(std::vector
<char>, buffer
)
40 IPC_STRUCT_MEMBER(int, notify_id
)
41 IPC_STRUCT_MEMBER(bool, popups_allowed
)
42 IPC_STRUCT_MEMBER(bool, notify_redirects
)
45 IPC_STRUCT_BEGIN(PluginMsg_DidReceiveResponseParams
)
46 IPC_STRUCT_MEMBER(unsigned long, id
)
47 IPC_STRUCT_MEMBER(std::string
, mime_type
)
48 IPC_STRUCT_MEMBER(std::string
, headers
)
49 IPC_STRUCT_MEMBER(uint32
, expected_length
)
50 IPC_STRUCT_MEMBER(uint32
, last_modified
)
51 IPC_STRUCT_MEMBER(bool, request_is_seekable
)
54 IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param
)
55 IPC_STRUCT_MEMBER(gfx::Rect
, window_rect
)
56 IPC_STRUCT_MEMBER(gfx::Rect
, clip_rect
)
57 IPC_STRUCT_MEMBER(TransportDIB::Handle
, windowless_buffer0
)
58 IPC_STRUCT_MEMBER(TransportDIB::Handle
, windowless_buffer1
)
59 IPC_STRUCT_MEMBER(int, windowless_buffer_index
)
62 //-----------------------------------------------------------------------------
63 // PluginProcess messages
64 // These are messages sent from the browser to the plugin process.
65 // Tells the plugin process to create a new channel for communication with a
66 // given renderer. The channel name is returned in a
67 // PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so
68 // that the plugin process reuses an existing channel to that process if it
69 // exists. This ID is a unique opaque identifier generated by the browser
71 IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel
,
72 int /* renderer_id */,
73 bool /* off_the_record */)
75 // Tells the plugin process to notify every connected renderer of the pending
76 // shutdown, so we don't mistake it for a crash.
77 IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown
)
80 //-----------------------------------------------------------------------------
81 // PluginProcessHost messages
82 // These are messages sent from the plugin process to the browser process.
83 // Response to a PluginProcessMsg_CreateChannel message.
84 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated
,
85 IPC::ChannelHandle
/* channel_handle */)
88 // Destroys the given window's parent on the UI thread.
89 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed
,
95 // On X11, the mapping between NativeViewId and X window ids
96 // is known only to the browser. This message lets the plugin process
97 // ask about a NativeViewId that was provided by the renderer.
98 // It will get 0 back if it's a bogus input.
99 IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId
,
100 gfx::NativeViewId
/* input: native view id */,
101 gfx::PluginWindowHandle
/* output: X window id */)
104 #if defined(OS_MACOSX)
105 // On Mac OS X, we need the browser to keep track of plugin windows so
106 // that it can add and remove them from stacking groups, hide and show the
107 // menu bar, etc. We pass the window rect for convenience so that the
108 // browser can easily tell if the window is fullscreen.
110 // Notifies the browser that the plugin has selected a window (i.e., brought
111 // it to the front and wants it to have keyboard focus).
112 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow
,
113 uint32
/* window ID */,
114 gfx::Rect
/* window rect */,
117 // Notifies the browser that the plugin has shown a window.
118 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow
,
119 uint32
/* window ID */,
120 gfx::Rect
/* window rect */,
123 // Notifies the browser that the plugin has hidden a window.
124 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow
,
125 uint32
/* window ID */,
126 gfx::Rect
/* window rect */)
128 // Notifies the browser that a plugin instance has requested a cursor
129 // visibility change.
130 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility
,
131 bool /* cursor visibility */)
135 //-----------------------------------------------------------------------------
137 // These are messages sent from the renderer process to the plugin process.
138 // Tells the plugin process to create a new plugin instance with the given
139 // id. A corresponding WebPluginDelegateStub is created which hosts the
140 // WebPluginDelegateImpl.
141 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance
,
142 std::string
/* mime_type */,
143 int /* instance_id */)
145 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its
146 // destructor, so that the stub deletes the actual WebPluginDelegateImpl
147 // object that it's hosting.
148 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance
,
149 int /* instance_id */)
151 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID
,
154 // The messages below all map to WebPluginDelegate methods.
155 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init
,
156 PluginMsg_Init_Params
,
157 bool /* transparent */,
160 // Used to synchronously request a paint for windowless plugins.
161 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint
,
162 gfx::Rect
/* damaged_rect */)
164 // Sent by the renderer after it paints from its backing store so that the
165 // plugin knows it can send more invalidates.
166 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint
)
168 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject
,
171 // Gets the form value of the plugin instance synchronously.
172 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue
,
173 string16
/* value */,
176 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason
,
181 // Updates the plugin location.
182 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry
,
183 PluginMsg_UpdateGeometry_Param
)
185 // A synchronous version of above.
186 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync
,
187 PluginMsg_UpdateGeometry_Param
)
189 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus
,
192 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent
,
193 IPC::WebInputEventPointer
/* event */,
195 WebCursor
/* cursor type*/)
197 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus
,
198 bool /* has_focus */)
201 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated
,
203 std::vector
<int> /* clauses */,
204 std::vector
<int>, /* target */
205 int /* cursor_position */)
207 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted
,
211 #if defined(OS_MACOSX)
212 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus
,
213 bool /* has_focus */)
215 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden
)
217 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown
,
218 gfx::Rect
/* window_frame */,
219 gfx::Rect
/* view_frame */,
220 bool /* has_focus */)
222 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged
,
223 gfx::Rect
/* window_frame */,
224 gfx::Rect
/* view_frame */)
226 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted
,
230 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest
,
231 unsigned long /* id */,
233 int /* http_status_code */)
235 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse
,
236 PluginMsg_DidReceiveResponseParams
)
238 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData
,
239 unsigned long /* id */,
240 std::vector
<char> /* buffer */,
241 int /* data_offset */)
243 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading
,
244 unsigned long /* id */)
246 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail
,
247 unsigned long /* id */)
249 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream
,
251 std::string
/* result */,
255 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse
,
257 PluginMsg_DidReceiveResponseParams
)
259 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData
,
260 std::vector
<char> /* buffer */)
262 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading
)
264 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail
)
266 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply
,
267 unsigned long /* resource_id */,
271 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply
,
272 unsigned long /* resource_id */,
273 int /* range_request_id */)
275 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent
,
276 int /* render_view_id */)
278 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent
,
279 int /* render_view_id */)
281 #if defined(OS_MACOSX)
282 // This message, used only on 10.6 and later, transmits the "fake"
283 // window handle allocated by the browser on behalf of the renderer
284 // to the GPU plugin.
285 IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle
,
286 gfx::PluginWindowHandle
/* window */)
289 IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData
,
290 std::string
/* site */,
292 uint64
/* max_age */)
294 //-----------------------------------------------------------------------------
295 // PluginHost messages
296 // These are messages sent from the plugin process to the renderer process.
297 // They all map to the corresponding WebPlugin methods.
298 // Sends the plugin window information to the renderer.
299 // The window parameter is a handle to the window if the plugin is a windowed
300 // plugin. It is NULL for windowless plugins.
301 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow
,
302 gfx::PluginWindowHandle
/* window */)
305 // The modal_loop_pump_messages_event parameter is an event handle which is
306 // passed in for windowless plugins and is used to indicate if messages
307 // are to be pumped in sync calls to the plugin process. Currently used
308 // in HandleEvent calls.
309 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData
,
310 HANDLE
/* modal_loop_pump_messages_event */,
311 gfx::NativeViewId
/* dummy_activation_window*/)
313 // Send the IME status retrieved from a windowless plug-in. A windowless plug-in
314 // uses the IME attached to a browser process as a renderer does. A plug-in
315 // sends this message to control the IME status of a browser process. I would
316 // note that a plug-in sends this message to a renderer process that hosts this
317 // plug-in (not directly to a browser process) so the renderer process can
318 // update its IME status.
319 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus
,
320 int /* input_type */,
321 gfx::Rect
/* caret_rect */)
324 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest
,
325 PluginHostMsg_URLRequest_Params
)
327 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource
,
330 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect
,
331 gfx::Rect
/* rect */)
333 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject
,
337 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement
,
341 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy
,
344 std::string
/* proxy list */)
346 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie
,
348 GURL
/* first_party_for_cookies */,
349 std::string
/* cookie */)
351 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies
,
353 GURL
/* first_party_for_cookies */,
354 std::string
/* cookies */)
356 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad
)
358 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest
,
359 std::string
/* url */,
360 std::string
/* range_info */,
361 int /* range_request_id */)
363 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading
,
364 unsigned long /* resource_id */,
367 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException
,
368 std::string
/* message */)
370 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown
)
372 #if defined(OS_MACOSX)
373 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged
,
376 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme
)
378 //----------------------------------------------------------------------
379 // Core Animation plugin implementation rendering via compositor.
381 // Notifies the renderer process that this plugin will be using the
382 // accelerated rendering path.
383 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering
)
385 // Notifies the renderer process that the plugin allocated a new
386 // IOSurface into which it is rendering. The renderer process forwards
387 // this IOSurface to the GPU process, causing it to be bound to a
388 // texture from which the compositor can render. Any previous
389 // IOSurface allocated by this plugin must be implicitly released by
390 // the receipt of this message.
391 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface
,
394 uint32
/* surface_id */)
396 // Notifies the renderer process that the plugin produced a new frame
397 // of content into its IOSurface, and therefore that the compositor
399 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface
)
402 IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult
,
405 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse
,
407 int /* resource_id */)
410 //-----------------------------------------------------------------------------
412 // These are messages used to marshall NPObjects. They are sent both from the
413 // plugin to the renderer and from the renderer to the plugin.
414 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release
)
416 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod
,
417 content::NPIdentifier_Param
/* name */,
420 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke
,
421 bool /* is_default */,
422 content::NPIdentifier_Param
/* method */,
423 std::vector
<content::NPVariant_Param
> /* args */,
424 content::NPVariant_Param
/* result_param */,
427 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty
,
428 content::NPIdentifier_Param
/* name */,
431 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty
,
432 content::NPIdentifier_Param
/* name */,
433 content::NPVariant_Param
/* property */,
436 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty
,
437 content::NPIdentifier_Param
/* name */,
438 content::NPVariant_Param
/* property */,
441 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty
,
442 content::NPIdentifier_Param
/* name */,
445 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate
)
447 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration
,
448 std::vector
<content::NPIdentifier_Param
> /* value */,
451 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct
,
452 std::vector
<content::NPVariant_Param
> /* args */,
453 content::NPVariant_Param
/* result_param */,
456 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate
,
457 std::string
/* script */,
458 bool /* popups_allowed */,
459 content::NPVariant_Param
/* result_param */,