OLD | NEW |
| (Empty) |
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. | |
4 // | |
5 // Multiply-included message file, hence no include guard. | |
6 | |
7 #include "build/build_config.h" | |
8 #include "content/common/content_export.h" | |
9 #include "content/common/content_param_traits.h" | |
10 #include "content/common/plugin_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/glue/webcursor.h" | |
17 | |
18 #if defined(OS_POSIX) | |
19 #include "base/file_descriptor_posix.h" | |
20 #endif | |
21 | |
22 #undef IPC_MESSAGE_EXPORT | |
23 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | |
24 | |
25 #define IPC_MESSAGE_START PluginMsgStart | |
26 | |
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) | |
34 IPC_STRUCT_END() | |
35 | |
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) | |
44 IPC_STRUCT_END() | |
45 | |
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) | |
53 IPC_STRUCT_END() | |
54 | |
55 IPC_STRUCT_BEGIN(PluginMsg_UpdateGeometry_Param) | |
56 IPC_STRUCT_MEMBER(gfx::Rect, window_rect) | |
57 IPC_STRUCT_MEMBER(gfx::Rect, clip_rect) | |
58 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer0) | |
59 IPC_STRUCT_MEMBER(TransportDIB::Handle, windowless_buffer1) | |
60 IPC_STRUCT_MEMBER(int, windowless_buffer_index) | |
61 IPC_STRUCT_END() | |
62 | |
63 //----------------------------------------------------------------------------- | |
64 // PluginProcess messages | |
65 // These are messages sent from the browser to the plugin process. | |
66 // Tells the plugin process to create a new channel for communication with a | |
67 // given renderer. The channel name is returned in a | |
68 // PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so | |
69 // that the plugin process reuses an existing channel to that process if it | |
70 // exists. This ID is a unique opaque identifier generated by the browser | |
71 // process. | |
72 IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, | |
73 int /* renderer_id */, | |
74 bool /* off_the_record */) | |
75 | |
76 // Tells the plugin process to notify every connected renderer of the pending | |
77 // shutdown, so we don't mistake it for a crash. | |
78 IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) | |
79 | |
80 | |
81 //----------------------------------------------------------------------------- | |
82 // PluginProcessHost messages | |
83 // These are messages sent from the plugin process to the browser process. | |
84 // Response to a PluginProcessMsg_CreateChannel message. | |
85 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, | |
86 IPC::ChannelHandle /* channel_handle */) | |
87 | |
88 #if defined(OS_WIN) | |
89 // Destroys the given window's parent on the UI thread. | |
90 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, | |
91 HWND /* window */, | |
92 HWND /* parent */) | |
93 #endif | |
94 | |
95 #if defined(USE_X11) | |
96 // On X11, the mapping between NativeViewId and X window ids | |
97 // is known only to the browser. This message lets the plugin process | |
98 // ask about a NativeViewId that was provided by the renderer. | |
99 // It will get 0 back if it's a bogus input. | |
100 IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId, | |
101 gfx::NativeViewId /* input: native view id */, | |
102 gfx::PluginWindowHandle /* output: X window id */) | |
103 #endif | |
104 | |
105 #if defined(OS_MACOSX) | |
106 // On Mac OS X, we need the browser to keep track of plugin windows so | |
107 // that it can add and remove them from stacking groups, hide and show the | |
108 // menu bar, etc. We pass the window rect for convenience so that the | |
109 // browser can easily tell if the window is fullscreen. | |
110 | |
111 // Notifies the browser that the plugin has selected a window (i.e., brought | |
112 // it to the front and wants it to have keyboard focus). | |
113 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow, | |
114 uint32 /* window ID */, | |
115 gfx::Rect /* window rect */, | |
116 bool /* modal */) | |
117 | |
118 // Notifies the browser that the plugin has shown a window. | |
119 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow, | |
120 uint32 /* window ID */, | |
121 gfx::Rect /* window rect */, | |
122 bool /* modal */) | |
123 | |
124 // Notifies the browser that the plugin has hidden a window. | |
125 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow, | |
126 uint32 /* window ID */, | |
127 gfx::Rect /* window rect */) | |
128 | |
129 // Notifies the browser that a plugin instance has requested a cursor | |
130 // visibility change. | |
131 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility, | |
132 bool /* cursor visibility */) | |
133 #endif | |
134 | |
135 | |
136 //----------------------------------------------------------------------------- | |
137 // Plugin messages | |
138 // These are messages sent from the renderer process to the plugin process. | |
139 // Tells the plugin process to create a new plugin instance with the given | |
140 // id. A corresponding WebPluginDelegateStub is created which hosts the | |
141 // WebPluginDelegateImpl. | |
142 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, | |
143 std::string /* mime_type */, | |
144 int /* instance_id */) | |
145 | |
146 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its | |
147 // destructor, so that the stub deletes the actual WebPluginDelegateImpl | |
148 // object that it's hosting. | |
149 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, | |
150 int /* instance_id */) | |
151 | |
152 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, | |
153 int /* id */) | |
154 | |
155 // The messages below all map to WebPluginDelegate methods. | |
156 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init, | |
157 PluginMsg_Init_Params, | |
158 bool /* transparent */, | |
159 bool /* result */) | |
160 | |
161 // Used to synchronously request a paint for windowless plugins. | |
162 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, | |
163 gfx::Rect /* damaged_rect */) | |
164 | |
165 // Sent by the renderer after it paints from its backing store so that the | |
166 // plugin knows it can send more invalidates. | |
167 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) | |
168 | |
169 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, | |
170 int /* route_id */) | |
171 | |
172 // Gets the form value of the plugin instance synchronously. | |
173 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue, | |
174 string16 /* value */, | |
175 bool /* success */) | |
176 | |
177 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, | |
178 GURL /* url */, | |
179 int /* reason */, | |
180 int /* notify_id */) | |
181 | |
182 // Updates the plugin location. | |
183 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, | |
184 PluginMsg_UpdateGeometry_Param) | |
185 | |
186 // A synchronous version of above. | |
187 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, | |
188 PluginMsg_UpdateGeometry_Param) | |
189 | |
190 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, | |
191 bool /* focused */) | |
192 | |
193 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, | |
194 IPC::WebInputEventPointer /* event */, | |
195 bool /* handled */, | |
196 WebCursor /* cursor type*/) | |
197 | |
198 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, | |
199 bool /* has_focus */) | |
200 | |
201 #if defined(OS_WIN) | |
202 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated, | |
203 string16 /* text */, | |
204 std::vector<int> /* clauses */, | |
205 std::vector<int>, /* target */ | |
206 int /* cursor_position */) | |
207 | |
208 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, | |
209 string16 /* text */) | |
210 #endif | |
211 | |
212 #if defined(OS_MACOSX) | |
213 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, | |
214 bool /* has_focus */) | |
215 | |
216 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) | |
217 | |
218 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, | |
219 gfx::Rect /* window_frame */, | |
220 gfx::Rect /* view_frame */, | |
221 bool /* has_focus */) | |
222 | |
223 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, | |
224 gfx::Rect /* window_frame */, | |
225 gfx::Rect /* view_frame */) | |
226 | |
227 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, | |
228 string16 /* text */) | |
229 #endif | |
230 | |
231 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, | |
232 unsigned long /* id */, | |
233 GURL /* url */, | |
234 int /* http_status_code */) | |
235 | |
236 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, | |
237 PluginMsg_DidReceiveResponseParams) | |
238 | |
239 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, | |
240 unsigned long /* id */, | |
241 std::vector<char> /* buffer */, | |
242 int /* data_offset */) | |
243 | |
244 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, | |
245 unsigned long /* id */) | |
246 | |
247 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, | |
248 unsigned long /* id */) | |
249 | |
250 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, | |
251 GURL /* url */, | |
252 std::string /* result */, | |
253 bool /* success */, | |
254 int /* notify_id */) | |
255 | |
256 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, | |
257 GURL /* url */, | |
258 PluginMsg_DidReceiveResponseParams) | |
259 | |
260 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, | |
261 std::vector<char> /* buffer */) | |
262 | |
263 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) | |
264 | |
265 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) | |
266 | |
267 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, | |
268 unsigned long /* resource_id */, | |
269 GURL /* url */, | |
270 int /* notify_id */) | |
271 | |
272 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, | |
273 unsigned long /* resource_id */, | |
274 int /* range_request_id */) | |
275 | |
276 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, | |
277 int /* render_view_id */) | |
278 | |
279 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, | |
280 int /* render_view_id */) | |
281 | |
282 #if defined(OS_MACOSX) | |
283 // This message, used only on 10.6 and later, transmits the "fake" | |
284 // window handle allocated by the browser on behalf of the renderer | |
285 // to the GPU plugin. | |
286 IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, | |
287 gfx::PluginWindowHandle /* window */) | |
288 #endif | |
289 | |
290 IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData, | |
291 std::string /* site */, | |
292 uint64 /* flags */, | |
293 uint64 /* max_age */) | |
294 | |
295 //----------------------------------------------------------------------------- | |
296 // PluginHost messages | |
297 // These are messages sent from the plugin process to the renderer process. | |
298 // They all map to the corresponding WebPlugin methods. | |
299 // Sends the plugin window information to the renderer. | |
300 // The window parameter is a handle to the window if the plugin is a windowed | |
301 // plugin. It is NULL for windowless plugins. | |
302 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, | |
303 gfx::PluginWindowHandle /* window */) | |
304 | |
305 #if defined(OS_WIN) | |
306 // The modal_loop_pump_messages_event parameter is an event handle which is | |
307 // passed in for windowless plugins and is used to indicate if messages | |
308 // are to be pumped in sync calls to the plugin process. Currently used | |
309 // in HandleEvent calls. | |
310 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData, | |
311 HANDLE /* modal_loop_pump_messages_event */, | |
312 gfx::NativeViewId /* dummy_activation_window*/) | |
313 | |
314 // Send the IME status retrieved from a windowless plug-in. A windowless plug-in | |
315 // uses the IME attached to a browser process as a renderer does. A plug-in | |
316 // sends this message to control the IME status of a browser process. I would | |
317 // note that a plug-in sends this message to a renderer process that hosts this | |
318 // plug-in (not directly to a browser process) so the renderer process can | |
319 // update its IME status. | |
320 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus, | |
321 int /* input_type */, | |
322 gfx::Rect /* caret_rect */) | |
323 #endif | |
324 | |
325 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, | |
326 PluginHostMsg_URLRequest_Params) | |
327 | |
328 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, | |
329 int /* id */) | |
330 | |
331 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, | |
332 gfx::Rect /* rect */) | |
333 | |
334 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, | |
335 int /* route id */, | |
336 bool /* success */) | |
337 | |
338 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, | |
339 int /* route id */, | |
340 bool /* success */) | |
341 | |
342 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy, | |
343 GURL /* url */, | |
344 bool /* result */, | |
345 std::string /* proxy list */) | |
346 | |
347 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, | |
348 GURL /* url */, | |
349 GURL /* first_party_for_cookies */, | |
350 std::string /* cookie */) | |
351 | |
352 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, | |
353 GURL /* url */, | |
354 GURL /* first_party_for_cookies */, | |
355 std::string /* cookies */) | |
356 | |
357 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) | |
358 | |
359 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, | |
360 std::string /* url */, | |
361 std::string /* range_info */, | |
362 int /* range_request_id */) | |
363 | |
364 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, | |
365 unsigned long /* resource_id */, | |
366 bool /* defer */) | |
367 | |
368 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, | |
369 std::string /* message */) | |
370 | |
371 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) | |
372 | |
373 #if defined(OS_MACOSX) | |
374 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged, | |
375 bool /* focused */) | |
376 | |
377 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme) | |
378 | |
379 //---------------------------------------------------------------------- | |
380 // Core Animation plugin implementation rendering via compositor. | |
381 | |
382 // Notifies the renderer process that this plugin will be using the | |
383 // accelerated rendering path. | |
384 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering) | |
385 | |
386 // Notifies the renderer process that the plugin allocated a new | |
387 // IOSurface into which it is rendering. The renderer process forwards | |
388 // this IOSurface to the GPU process, causing it to be bound to a | |
389 // texture from which the compositor can render. Any previous | |
390 // IOSurface allocated by this plugin must be implicitly released by | |
391 // the receipt of this message. | |
392 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface, | |
393 int32 /* width */, | |
394 int32 /* height */, | |
395 uint32 /* surface_id */) | |
396 | |
397 // Notifies the renderer process that the plugin produced a new frame | |
398 // of content into its IOSurface, and therefore that the compositor | |
399 // needs to redraw. | |
400 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface) | |
401 #endif | |
402 | |
403 IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult, | |
404 bool /* success */) | |
405 | |
406 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, | |
407 bool /* allow */, | |
408 int /* resource_id */) | |
409 | |
410 | |
411 //----------------------------------------------------------------------------- | |
412 // NPObject messages | |
413 // These are messages used to marshall NPObjects. They are sent both from the | |
414 // plugin to the renderer and from the renderer to the plugin. | |
415 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) | |
416 | |
417 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, | |
418 content::NPIdentifier_Param /* name */, | |
419 bool /* result */) | |
420 | |
421 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, | |
422 bool /* is_default */, | |
423 content::NPIdentifier_Param /* method */, | |
424 std::vector<content::NPVariant_Param> /* args */, | |
425 content::NPVariant_Param /* result_param */, | |
426 bool /* result */) | |
427 | |
428 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, | |
429 content::NPIdentifier_Param /* name */, | |
430 bool /* result */) | |
431 | |
432 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, | |
433 content::NPIdentifier_Param /* name */, | |
434 content::NPVariant_Param /* property */, | |
435 bool /* result */) | |
436 | |
437 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, | |
438 content::NPIdentifier_Param /* name */, | |
439 content::NPVariant_Param /* property */, | |
440 bool /* result */) | |
441 | |
442 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, | |
443 content::NPIdentifier_Param /* name */, | |
444 bool /* result */) | |
445 | |
446 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) | |
447 | |
448 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, | |
449 std::vector<content::NPIdentifier_Param> /* value */, | |
450 bool /* result */) | |
451 | |
452 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, | |
453 std::vector<content::NPVariant_Param> /* args */, | |
454 content::NPVariant_Param /* result_param */, | |
455 bool /* result */) | |
456 | |
457 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, | |
458 std::string /* script */, | |
459 bool /* popups_allowed */, | |
460 content::NPVariant_Param /* result_param */, | |
461 bool /* result */) | |
OLD | NEW |