OLD | NEW |
| (Empty) |
1 // Copyright (c) 2009 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 #include "base/shared_memory.h" | |
6 #include "build/build_config.h" | |
7 #include "ipc/ipc_message_macros.h" | |
8 #include "ui/gfx/native_widget_types.h" | |
9 #include "webkit/glue/webcursor.h" | |
10 | |
11 #if defined(OS_POSIX) | |
12 #include "base/file_descriptor_posix.h" | |
13 #endif | |
14 | |
15 #define IPC_MESSAGE_START PluginMsgStart | |
16 | |
17 //----------------------------------------------------------------------------- | |
18 // PluginProcess messages | |
19 // These are messages sent from the browser to the plugin process. | |
20 // Tells the plugin process to create a new channel for communication with a | |
21 // given renderer. The channel name is returned in a | |
22 // PluginProcessHostMsg_ChannelCreated message. The renderer ID is passed so | |
23 // that the plugin process reuses an existing channel to that process if it | |
24 // exists. This ID is a unique opaque identifier generated by the browser | |
25 // process. | |
26 IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel, | |
27 int /* renderer_id */, | |
28 bool /* off_the_record */) | |
29 | |
30 // Tells the plugin process to notify every connected renderer of the pending | |
31 // shutdown, so we don't mistake it for a crash. | |
32 IPC_MESSAGE_CONTROL0(PluginProcessMsg_NotifyRenderersOfPendingShutdown) | |
33 | |
34 | |
35 //----------------------------------------------------------------------------- | |
36 // PluginProcessHost messages | |
37 // These are messages sent from the plugin process to the browser process. | |
38 // Response to a PluginProcessMsg_CreateChannel message. | |
39 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated, | |
40 IPC::ChannelHandle /* channel_handle */) | |
41 | |
42 IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl, | |
43 std::string /* plugin finder URL */) | |
44 | |
45 IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest) | |
46 | |
47 // Get the list of proxies to use for |url|, as a semicolon delimited list | |
48 // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy | |
49 // which does the same thing. | |
50 IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy, | |
51 GURL /* url */, | |
52 int /* network error */, | |
53 std::string /* proxy list */) | |
54 | |
55 #if defined(OS_WIN) | |
56 // Destroys the given window's parent on the UI thread. | |
57 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed, | |
58 HWND /* window */, | |
59 HWND /* parent */) | |
60 | |
61 IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl, | |
62 std::string /* URL */, | |
63 int /* process id */, | |
64 HWND /* caller window */) | |
65 #endif | |
66 | |
67 #if defined(USE_X11) | |
68 // On X11, the mapping between NativeViewId and X window ids | |
69 // is known only to the browser. This message lets the plugin process | |
70 // ask about a NativeViewId that was provided by the renderer. | |
71 // It will get 0 back if it's a bogus input. | |
72 IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId, | |
73 gfx::NativeViewId /* input: native view id */, | |
74 gfx::PluginWindowHandle /* output: X window id */) | |
75 #endif | |
76 | |
77 #if defined(OS_MACOSX) | |
78 // On Mac OS X, we need the browser to keep track of plugin windows so | |
79 // that it can add and remove them from stacking groups, hide and show the | |
80 // menu bar, etc. We pass the window rect for convenience so that the | |
81 // browser can easily tell if the window is fullscreen. | |
82 | |
83 // Notifies the browser that the plugin has selected a window (i.e., brought | |
84 // it to the front and wants it to have keyboard focus). | |
85 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow, | |
86 uint32 /* window ID */, | |
87 gfx::Rect /* window rect */, | |
88 bool /* modal */) | |
89 | |
90 // Notifies the browser that the plugin has shown a window. | |
91 IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow, | |
92 uint32 /* window ID */, | |
93 gfx::Rect /* window rect */, | |
94 bool /* modal */) | |
95 | |
96 // Notifies the browser that the plugin has hidden a window. | |
97 IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow, | |
98 uint32 /* window ID */, | |
99 gfx::Rect /* window rect */) | |
100 | |
101 // Notifies the browser that a plugin instance has requested a cursor | |
102 // visibility change. | |
103 IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginSetCursorVisibility, | |
104 bool /* cursor visibility */) | |
105 #endif | |
106 | |
107 | |
108 //----------------------------------------------------------------------------- | |
109 // Plugin messages | |
110 // These are messages sent from the renderer process to the plugin process. | |
111 // Tells the plugin process to create a new plugin instance with the given | |
112 // id. A corresponding WebPluginDelegateStub is created which hosts the | |
113 // WebPluginDelegateImpl. | |
114 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, | |
115 std::string /* mime_type */, | |
116 int /* instance_id */) | |
117 | |
118 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its | |
119 // destructor, so that the stub deletes the actual WebPluginDelegateImpl | |
120 // object that it's hosting. | |
121 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, | |
122 int /* instance_id */) | |
123 | |
124 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, | |
125 int /* id */) | |
126 | |
127 // The messages below all map to WebPluginDelegate methods. | |
128 IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_Init, | |
129 PluginMsg_Init_Params, | |
130 bool /* result */) | |
131 | |
132 // Used to synchronously request a paint for windowless plugins. | |
133 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, | |
134 gfx::Rect /* damaged_rect */) | |
135 | |
136 // Sent by the renderer after it paints from its backing store so that the | |
137 // plugin knows it can send more invalidates. | |
138 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) | |
139 | |
140 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print, | |
141 base::SharedMemoryHandle /* shared_memory*/, | |
142 uint32 /* size */) | |
143 | |
144 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, | |
145 int /* route_id */) | |
146 | |
147 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, | |
148 GURL /* url */, | |
149 int /* reason */, | |
150 int /* notify_id */) | |
151 | |
152 // Updates the plugin location. | |
153 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, | |
154 PluginMsg_UpdateGeometry_Param) | |
155 | |
156 // A synchronous version of above. | |
157 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, | |
158 PluginMsg_UpdateGeometry_Param) | |
159 | |
160 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, | |
161 bool /* focused */) | |
162 | |
163 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, | |
164 IPC::WebInputEventPointer /* event */, | |
165 bool /* handled */, | |
166 WebCursor /* cursor type*/) | |
167 | |
168 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, | |
169 bool /* has_focus */) | |
170 | |
171 #if defined(OS_MACOSX) | |
172 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, | |
173 bool /* has_focus */) | |
174 | |
175 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) | |
176 | |
177 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, | |
178 gfx::Rect /* window_frame */, | |
179 gfx::Rect /* view_frame */, | |
180 bool /* has_focus */) | |
181 | |
182 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, | |
183 gfx::Rect /* window_frame */, | |
184 gfx::Rect /* view_frame */) | |
185 | |
186 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, | |
187 string16 /* text */) | |
188 #endif | |
189 | |
190 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, | |
191 unsigned long /* id */, | |
192 GURL /* url */, | |
193 int /* http_status_code */) | |
194 | |
195 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, | |
196 PluginMsg_DidReceiveResponseParams) | |
197 | |
198 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, | |
199 unsigned long /* id */, | |
200 std::vector<char> /* buffer */, | |
201 int /* data_offset */) | |
202 | |
203 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, | |
204 unsigned long /* id */) | |
205 | |
206 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, | |
207 unsigned long /* id */) | |
208 | |
209 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, | |
210 GURL /* url */, | |
211 std::string /* result */, | |
212 bool /* success */, | |
213 int /* notify_id */) | |
214 | |
215 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, | |
216 GURL /* url */, | |
217 PluginMsg_DidReceiveResponseParams) | |
218 | |
219 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, | |
220 std::vector<char> /* buffer */) | |
221 | |
222 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) | |
223 | |
224 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) | |
225 | |
226 IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin) | |
227 | |
228 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, | |
229 unsigned long /* resource_id */, | |
230 GURL /* url */, | |
231 int /* notify_id */) | |
232 | |
233 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, | |
234 unsigned long /* resource_id */, | |
235 int /* range_request_id */) | |
236 | |
237 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, | |
238 gfx::NativeViewId /* containing_window */) | |
239 | |
240 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, | |
241 gfx::NativeViewId /* containing_window */) | |
242 | |
243 #if defined(OS_MACOSX) | |
244 // This message, used only on 10.6 and later, transmits the "fake" | |
245 // window handle allocated by the browser on behalf of the renderer | |
246 // to the GPU plugin. | |
247 IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, | |
248 gfx::PluginWindowHandle /* window */) | |
249 #endif | |
250 | |
251 IPC_MESSAGE_CONTROL3(PluginMsg_ClearSiteData, | |
252 std::string, /* site */ | |
253 uint64, /* flags */ | |
254 base::Time /* begin_time */) | |
255 | |
256 | |
257 //----------------------------------------------------------------------------- | |
258 // PluginHost messages | |
259 // These are messages sent from the plugin process to the renderer process. | |
260 // They all map to the corresponding WebPlugin methods. | |
261 // Sends the plugin window information to the renderer. | |
262 // The window parameter is a handle to the window if the plugin is a windowed | |
263 // plugin. It is NULL for windowless plugins. | |
264 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, | |
265 gfx::PluginWindowHandle /* window */) | |
266 | |
267 #if defined(OS_WIN) | |
268 // The modal_loop_pump_messages_event parameter is an event handle which is | |
269 // passed in for windowless plugins and is used to indicate if messages | |
270 // are to be pumped in sync calls to the plugin process. Currently used | |
271 // in HandleEvent calls. | |
272 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent, | |
273 HANDLE /* modal_loop_pump_messages_event */) | |
274 #endif | |
275 | |
276 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, | |
277 PluginHostMsg_URLRequest_Params) | |
278 | |
279 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, | |
280 int /* id */) | |
281 | |
282 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, | |
283 gfx::Rect /* rect */) | |
284 | |
285 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, | |
286 int /* route id */, | |
287 bool /* success */) | |
288 | |
289 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, | |
290 int /* route id */, | |
291 bool /* success */) | |
292 | |
293 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, | |
294 GURL /* url */, | |
295 GURL /* first_party_for_cookies */, | |
296 std::string /* cookie */) | |
297 | |
298 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, | |
299 GURL /* url */, | |
300 GURL /* first_party_for_cookies */, | |
301 std::string /* cookies */) | |
302 | |
303 IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus, | |
304 int /* status */) | |
305 | |
306 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) | |
307 | |
308 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, | |
309 std::string /* url */, | |
310 std::string /* range_info */, | |
311 int /* range_request_id */) | |
312 | |
313 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, | |
314 unsigned long /* resource_id */, | |
315 bool /* defer */) | |
316 | |
317 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, | |
318 std::string /* message */) | |
319 | |
320 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) | |
321 | |
322 #if defined(OS_MACOSX) | |
323 IPC_MESSAGE_ROUTED1(PluginHostMsg_UpdateGeometry_ACK, | |
324 int /* ack_key */) | |
325 | |
326 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged, | |
327 bool /* focused */) | |
328 | |
329 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme) | |
330 | |
331 // This message, used in Mac OS X 10.5 and earlier, is sent from the plug-in | |
332 // process to the renderer process to indicate that the plug-in allocated a | |
333 // new TransportDIB that holds the GPU's rendered image. This information is | |
334 // then forwarded to the browser process via a similar message. | |
335 IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetTransportDIB, | |
336 gfx::PluginWindowHandle /* window */, | |
337 int32 /* width */, | |
338 int32 /* height */, | |
339 TransportDIB::Handle /* handle to the TransportDIB */) | |
340 | |
341 // Synthesize a fake window handle for the plug-in to identify the instance | |
342 // to the browser, allowing mapping to a surface for hardware accelleration | |
343 // of plug-in content. The browser generates the handle which is then set on | |
344 // the plug-in. |opaque| indicates whether the content should be treated as | |
345 // opaque. | |
346 IPC_MESSAGE_ROUTED1(PluginHostMsg_BindFakePluginWindowHandle, | |
347 bool /* opaque */) | |
348 | |
349 // This message, used only on 10.6 and later, is sent from the plug-in process | |
350 // to the renderer process to indicate that the plugin allocated a new | |
351 // IOSurface object of the given width and height. This information is then | |
352 // forwarded on to the browser process. | |
353 // | |
354 // NOTE: the original intent was to pass a mach port as the IOSurface | |
355 // identifier but it looks like that will be a lot of work. For now we pass an | |
356 // ID from IOSurfaceGetID. | |
357 IPC_MESSAGE_ROUTED4(PluginHostMsg_AcceleratedSurfaceSetIOSurface, | |
358 gfx::PluginWindowHandle /* window */, | |
359 int32 /* width */, | |
360 int32 /* height */, | |
361 uint64 /* surface_id */) | |
362 | |
363 | |
364 // On the Mac, shared memory can't be allocated in the sandbox, so | |
365 // the TransportDIB used by the plug-in for rendering has to be allocated | |
366 // and managed by the browser. This is a synchronous message, use with care. | |
367 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_AllocTransportDIB, | |
368 size_t /* requested memory size */, | |
369 TransportDIB::Handle /* output: DIB handle */) | |
370 | |
371 // Since the browser keeps handles to the allocated transport DIBs, this | |
372 // message is sent to tell the browser that it may release them when the | |
373 // renderer is finished with them. | |
374 IPC_MESSAGE_ROUTED1(PluginHostMsg_FreeTransportDIB, | |
375 TransportDIB::Id /* DIB id */) | |
376 | |
377 // This message notifies the renderer process (and from there the | |
378 // browser process) that the plug-in swapped the buffers associated | |
379 // with the given "window", which should cause the browser to redraw | |
380 // the various plug-ins' contents. | |
381 IPC_MESSAGE_ROUTED2(PluginHostMsg_AcceleratedSurfaceBuffersSwapped, | |
382 gfx::PluginWindowHandle /* window */, | |
383 uint64 /* surface_id */) | |
384 #endif | |
385 | |
386 IPC_MESSAGE_CONTROL1(PluginHostMsg_ClearSiteDataResult, | |
387 bool /* success */) | |
388 | |
389 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, | |
390 bool /* allow */, | |
391 int /* resource_id */) | |
392 | |
393 | |
394 //----------------------------------------------------------------------------- | |
395 // NPObject messages | |
396 // These are messages used to marshall NPObjects. They are sent both from the | |
397 // plugin to the renderer and from the renderer to the plugin. | |
398 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) | |
399 | |
400 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, | |
401 NPIdentifier_Param /* name */, | |
402 bool /* result */) | |
403 | |
404 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, | |
405 bool /* is_default */, | |
406 NPIdentifier_Param /* method */, | |
407 std::vector<NPVariant_Param> /* args */, | |
408 NPVariant_Param /* result_param */, | |
409 bool /* result */) | |
410 | |
411 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, | |
412 NPIdentifier_Param /* name */, | |
413 bool /* result */) | |
414 | |
415 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, | |
416 NPIdentifier_Param /* name */, | |
417 NPVariant_Param /* property */, | |
418 bool /* result */) | |
419 | |
420 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, | |
421 NPIdentifier_Param /* name */, | |
422 NPVariant_Param /* property */, | |
423 bool /* result */) | |
424 | |
425 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, | |
426 NPIdentifier_Param /* name */, | |
427 bool /* result */) | |
428 | |
429 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) | |
430 | |
431 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, | |
432 std::vector<NPIdentifier_Param> /* value */, | |
433 bool /* result */) | |
434 | |
435 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, | |
436 std::vector<NPVariant_Param> /* args */, | |
437 NPVariant_Param /* result_param */, | |
438 bool /* result */) | |
439 | |
440 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, | |
441 std::string /* script */, | |
442 bool /* popups_allowed */, | |
443 NPVariant_Param /* result_param */, | |
444 bool /* result */) | |
OLD | NEW |