Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / child / plugin_messages.h
blob25d4545f683a7411865d360a38eca5f0b233ddf9
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.
4 //
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/geometry/rect.h"
16 #include "ui/gfx/ipc/gfx_param_traits.h"
17 #include "ui/gfx/native_widget_types.h"
19 #if defined(OS_POSIX)
20 #include "base/file_descriptor_posix.h"
21 #endif
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)
35 IPC_STRUCT_END()
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)
45 IPC_STRUCT_END()
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)
54 IPC_STRUCT_END()
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(blink::WebReferrerPolicy, referrer_policy)
65 IPC_STRUCT_MEMBER(bool, notify_redirect)
66 IPC_STRUCT_MEMBER(bool, is_plugin_src_load)
67 IPC_STRUCT_MEMBER(int, render_frame_id)
68 IPC_STRUCT_END()
70 IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param)
71 IPC_STRUCT_MEMBER(gfx::Rect, window_rect)
72 IPC_STRUCT_MEMBER(gfx::Rect, clip_rect)
73 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer0)
74 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer1)
75 IPC_STRUCT_MEMBER(int, windowless_buffer_index)
76 IPC_STRUCT_END()
78 //-----------------------------------------------------------------------------
79 // Plugin messages
80 // These are messages sent from the renderer process to the plugin process.
81 // Tells the plugin process to create a new plugin instance with the given
82 // id. A corresponding WebPluginDelegateStub is created which hosts the
83 // WebPluginDelegateImpl.
84 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance,
85 std::string /* mime_type */,
86 int /* instance_id */)
88 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its
89 // destructor, so that the stub deletes the actual WebPluginDelegateImpl
90 // object that it's hosting.
91 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance,
92 int /* instance_id */)
94 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID,
95 int /* id */)
97 // The messages below all map to WebPluginDelegate methods.
98 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init,
99 PluginMsg_Init_Params,
100 bool /* transparent */,
101 bool /* result */)
103 // Used to synchronously request a paint for windowless plugins.
104 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint,
105 gfx::Rect /* damaged_rect */)
107 // Sent by the renderer after it paints from its backing store so that the
108 // plugin knows it can send more invalidates.
109 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint)
111 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject,
112 int /* route_id */)
114 // Gets the form value of the plugin instance synchronously.
115 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue,
116 base::string16 /* value */,
117 bool /* success */)
119 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason,
120 GURL /* url */,
121 int /* reason */,
122 int /* notify_id */)
124 // Updates the plugin location.
125 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry,
126 PluginMsg_UpdateGeometry_Param)
128 // A synchronous version of above.
129 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync,
130 PluginMsg_UpdateGeometry_Param)
132 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus,
133 bool /* focused */)
135 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent,
136 IPC::WebInputEventPointer /* event */,
137 bool /* handled */,
138 content::WebCursor /* cursor type*/)
140 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus,
141 bool /* has_focus */)
143 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest,
144 unsigned long /* id */,
145 GURL /* url */,
146 int /* http_status_code */)
148 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse,
149 PluginMsg_DidReceiveResponseParams)
151 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData,
152 unsigned long /* id */,
153 std::vector<char> /* buffer */,
154 int /* data_offset */)
156 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading,
157 unsigned long /* id */)
159 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail,
160 unsigned long /* id */)
162 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream,
163 GURL /* url */,
164 std::string /* result */,
165 bool /* success */,
166 int /* notify_id */)
168 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse,
169 GURL /* url */,
170 PluginMsg_DidReceiveResponseParams)
172 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData,
173 std::vector<char> /* buffer */)
175 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading)
177 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail)
179 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply,
180 unsigned long /* resource_id */,
181 GURL /* url */,
182 int /* notify_id */)
184 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply,
185 unsigned long /* resource_id */,
186 int /* range_request_id */)
188 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent,
189 int /* render_view_id */)
191 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent,
192 int /* render_view_id */)
194 IPC_MESSAGE_ROUTED1(PluginMsg_FetchURL,
195 PluginMsg_FetchURL_Params)
197 IPC_MESSAGE_CONTROL1(PluginHostMsg_DidAbortLoading,
198 int /* render_view_id */)
200 #if defined(OS_WIN)
201 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated,
202 base::string16 /* text */,
203 std::vector<int> /* clauses */,
204 std::vector<int>, /* target */
205 int /* cursor_position */)
207 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted,
208 base::string16 /* text */)
209 #endif
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,
227 base::string16 /* text */)
228 #endif
230 //-----------------------------------------------------------------------------
231 // PluginHost messages
232 // These are messages sent from the plugin process to the renderer process.
233 // They all map to the corresponding WebPlugin methods.
234 // Sends the plugin window information to the renderer.
235 // The window parameter is a handle to the window if the plugin is a windowed
236 // plugin. It is NULL for windowless plugins.
237 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow,
238 gfx::PluginWindowHandle /* window */)
240 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest,
241 PluginHostMsg_URLRequest_Params)
243 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource,
244 int /* id */)
246 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect,
247 gfx::Rect /* rect */)
249 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject,
250 int /* route id */,
251 bool /* success */)
253 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement,
254 int /* route id */,
255 bool /* success */)
257 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy,
258 GURL /* url */,
259 bool /* result */,
260 std::string /* proxy list */)
262 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie,
263 GURL /* url */,
264 GURL /* first_party_for_cookies */,
265 std::string /* cookie */)
267 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies,
268 GURL /* url */,
269 GURL /* first_party_for_cookies */,
270 std::string /* cookies */)
272 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad)
274 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest,
275 std::string /* url */,
276 std::string /* range_info */,
277 int /* range_request_id */)
279 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStartLoading)
280 IPC_MESSAGE_ROUTED0(PluginHostMsg_DidStopLoading)
282 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading,
283 unsigned long /* resource_id */,
284 bool /* defer */)
286 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException,
287 std::string /* message */)
289 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown)
291 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse,
292 bool /* allow */,
293 int /* resource_id */)
295 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_CheckIfRunInsecureContent,
296 GURL /* url */,
297 bool /* result */)
299 #if defined(OS_WIN)
300 // The modal_loop_pump_messages_event parameter is an event handle which is
301 // passed in for windowless plugins and is used to indicate if messages
302 // are to be pumped in sync calls to the plugin process. Currently used
303 // in HandleEvent calls.
304 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData,
305 HANDLE /* modal_loop_pump_messages_event */,
306 gfx::NativeViewId /* dummy_activation_window*/)
308 // Send the IME status retrieved from a windowless plugin. A windowless plugin
309 // uses the IME attached to a browser process as a renderer does. A plugin
310 // sends this message to control the IME status of a browser process. I would
311 // note that a plugin sends this message to a renderer process that hosts this
312 // plugin (not directly to a browser process) so the renderer process can
313 // update its IME status.
314 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus,
315 int /* input_type */,
316 gfx::Rect /* caret_rect */)
317 #endif
319 #if defined(OS_MACOSX)
320 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged,
321 bool /* focused */)
323 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme)
325 //----------------------------------------------------------------------
326 // Core Animation plugin implementation rendering via compositor.
328 // Notifies the renderer process that this plugin will be using the
329 // accelerated rendering path.
330 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering)
332 // Notifies the renderer process that the plugin allocated a new
333 // IOSurface into which it is rendering. The renderer process forwards
334 // this IOSurface to the GPU process, causing it to be bound to a
335 // texture from which the compositor can render. Any previous
336 // IOSurface allocated by this plugin must be implicitly released by
337 // the receipt of this message.
338 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface,
339 int32 /* width */,
340 int32 /* height */,
341 uint32 /* surface_id */)
343 // Notifies the renderer process that the plugin produced a new frame
344 // of content into its IOSurface, and therefore that the compositor
345 // needs to redraw.
346 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface)
347 #endif
350 //-----------------------------------------------------------------------------
351 // NPObject messages
352 // These are messages used to marshall NPObjects. They are sent both from the
353 // plugin to the renderer and from the renderer to the plugin.
354 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release)
356 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod,
357 content::NPIdentifier_Param /* name */,
358 bool /* result */)
360 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke,
361 bool /* is_default */,
362 content::NPIdentifier_Param /* method */,
363 std::vector<content::NPVariant_Param> /* args */,
364 content::NPVariant_Param /* result_param */,
365 bool /* result */)
367 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty,
368 content::NPIdentifier_Param /* name */,
369 bool /* result */)
371 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty,
372 content::NPIdentifier_Param /* name */,
373 content::NPVariant_Param /* property */,
374 bool /* result */)
376 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty,
377 content::NPIdentifier_Param /* name */,
378 content::NPVariant_Param /* property */,
379 bool /* result */)
381 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty,
382 content::NPIdentifier_Param /* name */,
383 bool /* result */)
385 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate)
387 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration,
388 std::vector<content::NPIdentifier_Param> /* value */,
389 bool /* result */)
391 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct,
392 std::vector<content::NPVariant_Param> /* args */,
393 content::NPVariant_Param /* result_param */,
394 bool /* result */)
396 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate,
397 std::string /* script */,
398 bool /* popups_allowed */,
399 content::NPVariant_Param /* result_param */,
400 bool /* result */)