summaryrefslogtreecommitdiffstats
path: root/chrome/common/plugin_messages_internal.h
blob: f9a5bbf975469c11ab004b71c3d1904bc7c278f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "app/gfx/native_widget_types.h"
#include "base/shared_memory.h"
#include "build/build_config.h"
#include "ipc/ipc_message_macros.h"
#include "webkit/glue/webcursor.h"

#if defined(OS_POSIX)
#include "base/file_descriptor_posix.h"
#endif

//-----------------------------------------------------------------------------
// PluginProcess messages
// These are messages sent from the browser to the plugin process.
IPC_BEGIN_MESSAGES(PluginProcess)
  // Tells the plugin process to create a new channel for communication with a
  // given renderer.  The channel name is returned in a
  // PluginProcessHostMsg_ChannelCreated message.  The renderer ID is passed so
  // that the plugin process reuses an existing channel to that process if it
  // exists. This ID is a unique opaque identifier generated by the browser
  // process.
  IPC_MESSAGE_CONTROL2(PluginProcessMsg_CreateChannel,
                       int /* renderer_id */,
                       bool /* off_the_record */)

  // Allows a chrome plugin loaded in the browser process to send arbitrary
  // data to an instance of the same plugin loaded in a plugin process.
  IPC_MESSAGE_CONTROL1(PluginProcessMsg_PluginMessage,
                       std::vector<uint8> /* opaque data */)

  // The following messages are used by all child processes, even though they
  // are listed under PluginProcess.  It seems overkill to define ChildProcess.
  // Tells the child process it should stop.
  IPC_MESSAGE_CONTROL0(PluginProcessMsg_AskBeforeShutdown)

  // Sent in response to PluginProcessHostMsg_ShutdownRequest to tell the child
  // process that it's safe to shutdown.
  IPC_MESSAGE_CONTROL0(PluginProcessMsg_Shutdown)

#if defined(IPC_MESSAGE_LOG_ENABLED)
  // Tell the child process to begin or end IPC message logging.
  // Like above, this is used by all ChildProcesses.
  IPC_MESSAGE_CONTROL1(PluginProcessMsg_SetIPCLoggingEnabled,
                       bool /* on or off */)
#endif

IPC_END_MESSAGES(PluginProcess)


//-----------------------------------------------------------------------------
// PluginProcessHost messages
// These are messages sent from the plugin process to the browser process.
IPC_BEGIN_MESSAGES(PluginProcessHost)
  // Response to a PluginProcessMsg_CreateChannel message.
  IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_ChannelCreated,
                       IPC::ChannelHandle /* channel_handle */)

  IPC_SYNC_MESSAGE_CONTROL0_1(PluginProcessHostMsg_GetPluginFinderUrl,
                              std::string /* plugin finder URL */)

  IPC_MESSAGE_CONTROL0(PluginProcessHostMsg_ShutdownRequest)

  // Allows a chrome plugin loaded in a plugin process to send arbitrary
  // data to an instance of the same plugin loaded in the browser process.
  IPC_MESSAGE_CONTROL1(PluginProcessHostMsg_PluginMessage,
                       std::vector<uint8> /* opaque data */)

  // Allows a chrome plugin loaded in a plugin process to send arbitrary
  // data to an instance of the same plugin loaded in the browser process.
  IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_PluginSyncMessage,
                              std::vector<uint8> /* opaque data */,
                              std::vector<uint8> /* opaque data response */)

  // Used to get cookies for the given URL.  The request_context is a
  // CPBrowsingContext, but is passed as int32 to avoid compilation errors.
  IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_GetCookies,
                              int32 /* request_context */,
                              GURL /* url */,
                              std::string /* cookies */)

  // Used by the plugin process to verify that its renderer |renderer_id| has
  // permission to access the given |files|.
  IPC_SYNC_MESSAGE_CONTROL2_1(PluginProcessHostMsg_AccessFiles,
                              int /* renderer_id */,
                              std::vector<std::string> /* files */,
                              bool /* allowed */)

  // Get the list of proxies to use for |url|, as a semicolon delimited list
  // of "<TYPE> <HOST>:<PORT>" | "DIRECT". See also ViewHostMsg_ResolveProxy
  // which does the same thing.
  IPC_SYNC_MESSAGE_CONTROL1_2(PluginProcessHostMsg_ResolveProxy,
                              GURL /* url */,
                              int /* network error */,
                              std::string /* proxy list */)

#if defined(OS_WIN)
  // Creates a child window of the given parent window on the UI thread.
  IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_CreateWindow,
                              HWND /* parent */,
                              HWND /* child */)

  // Destroys the given window's parent on the UI thread.
  IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginWindowDestroyed,
                       HWND /* window */,
                       HWND /* parent */)

  IPC_MESSAGE_ROUTED3(PluginProcessHostMsg_DownloadUrl,
                      std::string /* URL */,
                      int /* process id */,
                      HWND /* caller window */)
#endif

#if defined(OS_LINUX)
  // On Linux, the mapping between NativeViewId and X window ids
  // is known only to the browser.  This message lets the plugin process
  // ask about a NativeViewId that was provided by the renderer.
  // It will get 0 back if it's a bogus input.
  IPC_SYNC_MESSAGE_CONTROL1_1(PluginProcessHostMsg_MapNativeViewId,
                             gfx::NativeViewId /* input: native view id */,
                             gfx::PluginWindowHandle /* output: X window id */)
#endif

#if defined(OS_MACOSX)
  // On Mac OS X, we need the browser to keep track of plugin windows so
  // that it can add and remove them from stacking groups, hide and show the
  // menu bar, etc.  We pass the window rect for convenience so that the
  // browser can easily tell if the window is fullscreen.

  // Notifies the browser that the plugin has selected a window (i.e., brought
  // it to the front and wants it to have keyboard focus).
  IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginSelectWindow,
                       uint32 /* window ID */,
                       gfx::Rect /* window rect */,
                       bool /* modal */)

  // Notifies the browser that the plugin has shown a window.
  IPC_MESSAGE_CONTROL3(PluginProcessHostMsg_PluginShowWindow,
                       uint32 /* window ID */,
                       gfx::Rect /* window rect */,
                       bool /* modal */)

  // Notifies the browser that the plugin has hidden a window.
  IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginHideWindow,
                       uint32 /* window ID */,
                       gfx::Rect /* window rect */)

  // Notifies the browser that the plugin has disposed of a window.
  IPC_MESSAGE_CONTROL2(PluginProcessHostMsg_PluginDisposeWindow,
                       uint32 /* window ID */,
                       gfx::Rect /* window rect */)
#endif

IPC_END_MESSAGES(PluginProcessHost)


//-----------------------------------------------------------------------------
// Plugin messages
// These are messages sent from the renderer process to the plugin process.
IPC_BEGIN_MESSAGES(Plugin)
  // Tells the plugin process to create a new plugin instance with the given
  // id.  A corresponding WebPluginDelegateStub is created which hosts the
  // WebPluginDelegateImpl.
  IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance,
                              std::string /* mime_type */,
                              int /* instance_id */)

  // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its
  // destructor, so that the stub deletes the actual WebPluginDelegateImpl
  // object that it's hosting.
  IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance,
                              int /* instance_id */)

  IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID,
                             int /* id */)

  // The messages below all map to WebPluginDelegate methods.
  IPC_SYNC_MESSAGE_ROUTED1_1(PluginMsg_Init,
                             PluginMsg_Init_Params,
                             bool /* result */)

  // Used to synchronously request a paint for windowless plugins.
  IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint,
                             gfx::Rect /* damaged_rect */)

  // Sent by the renderer after it paints from its backing store so that the
  // plugin knows it can send more invalidates.
  IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint)

  IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_Print,
                             base::SharedMemoryHandle /* shared_memory*/,
                             size_t /* size */)

  IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetPluginScriptableObject,
                             int /* route_id */,
                             intptr_t /* npobject_ptr */)

  IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_DidFinishLoadWithReason,
                             GURL /* url */,
                             int /* reason */,
                             intptr_t /* notify_data */)

  // Updates the plugin location.
  IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry,
                      PluginMsg_UpdateGeometry_Param)

  // A synchronous version of above.
  IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync,
                             PluginMsg_UpdateGeometry_Param)

  IPC_SYNC_MESSAGE_ROUTED0_0(PluginMsg_SetFocus)

  IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent,
                             IPC::WebInputEventPointer /* event */,
                             bool /* handled */,
                             WebCursor /* cursor type*/)

  IPC_SYNC_MESSAGE_ROUTED2_0(PluginMsg_WillSendRequest,
                             int /* id */,
                             GURL /* url */)

  IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse,
                      PluginMsg_DidReceiveResponseParams)

  IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData,
                      int /* id */,
                      std::vector<char> /* buffer */,
                      int /* data_offset */)

  IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading,
                      int /* id */)

  IPC_MESSAGE_ROUTED1(PluginMsg_DidFail,
                      int /* id */)

  IPC_MESSAGE_ROUTED5(PluginMsg_SendJavaScriptStream,
                      GURL /* url */,
                      std::string /* result */,
                      bool /* success */,
                      bool /* notify required */,
                      intptr_t /* notify data */)

  IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse,
                      GURL /* url */,
                      PluginMsg_DidReceiveResponseParams)

  IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData,
                      std::vector<char> /* buffer */)

  IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading)

  IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail)

  IPC_MESSAGE_ROUTED0(PluginMsg_InstallMissingPlugin)

  IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_HandleURLRequestReply,
                             PluginMsg_URLRequestReply_Params)

  IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent,
                       gfx::NativeViewId /* containing_window */)

  IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent,
                       gfx::NativeViewId /* containing_window */)
IPC_END_MESSAGES(Plugin)


//-----------------------------------------------------------------------------
// PluginHost messages
// These are messages sent from the plugin process to the renderer process.
// They all map to the corresponding WebPlugin methods.
IPC_BEGIN_MESSAGES(PluginHost)
  // Sends the plugin window information to the renderer.
  // The window parameter is a handle to the window if the plugin is a windowed
  // plugin. It is NULL for windowless plugins.
  IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow,
                             gfx::PluginWindowHandle /* window */)

#if defined(OS_WIN)
  // The modal_loop_pump_messages_event parameter is an event handle which is
  // passed in for windowless plugins and is used to indicate if messages
  // are to be pumped in sync calls to the plugin process. Currently used
  // in HandleEvent calls.
  IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindowlessPumpEvent,
                             HANDLE /* modal_loop_pump_messages_event */)
#endif

  IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest,
                      PluginHostMsg_URLRequest_Params)

  IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource,
                      int /* id */)

  IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect,
                      gfx::Rect /* rect */)

  IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_GetWindowScriptNPObject,
                             int /* route id */,
                             bool /* success */,
                             intptr_t /* npobject_ptr */)

  IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_GetPluginElement,
                             int /* route id */,
                             bool /* success */,
                             intptr_t /* npobject_ptr */)

  IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie,
                      GURL /* url */,
                      GURL /* first_party_for_cookies */,
                      std::string /* cookie */)

  IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies,
                             GURL /* url */,
                             GURL /* first_party_for_cookies */,
                             std::string /* cookies */)

  // Asks the browser to show a modal HTML dialog.  The dialog is passed the
  // given arguments as a JSON string, and returns its result as a JSON string
  // through json_retval.
  IPC_SYNC_MESSAGE_ROUTED4_1(PluginHostMsg_ShowModalHTMLDialog,
                              GURL /* url */,
                              int /* width */,
                              int /* height */,
                              std::string /* json_arguments */,
                              std::string /* json_retval */)

  IPC_SYNC_MESSAGE_ROUTED2_2(PluginHostMsg_GetDragData,
                             NPVariant_Param /* event */,
                             bool /* add_data */,
                             std::vector<NPVariant_Param> /* result_values */,
                             bool /* result_success */)

  IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_SetDropEffect,
                             NPVariant_Param /* event */,
                             int /* effect */,
                             bool /* result_success */)

  IPC_MESSAGE_ROUTED1(PluginHostMsg_MissingPluginStatus,
                      int /* status */)

  IPC_SYNC_MESSAGE_ROUTED0_1(PluginHostMsg_GetCPBrowsingContext,
                             uint32 /* context */)

  IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad)

  IPC_MESSAGE_ROUTED5(PluginHostMsg_InitiateHTTPRangeRequest,
                      std::string /* url */,
                      std::string /* range_info */,
                      intptr_t    /* existing_stream */,
                      bool        /* notify_needed */,
                      intptr_t    /* notify_data */)

  IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading,
                      int  /* resource_id */,
                      bool /* defer */)

IPC_END_MESSAGES(PluginHost)

//-----------------------------------------------------------------------------
// NPObject messages
// These are messages used to marshall NPObjects.  They are sent both from the
// plugin to the renderer and from the renderer to the plugin.
IPC_BEGIN_MESSAGES(NPObject)
  IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release)

  IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod,
                             NPIdentifier_Param /* name */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke,
                             bool /* is_default */,
                             NPIdentifier_Param /* method */,
                             std::vector<NPVariant_Param> /* args */,
                             NPVariant_Param /* result_param */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty,
                             NPIdentifier_Param /* name */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty,
                             NPIdentifier_Param /* name */,
                             NPVariant_Param /* property */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty,
                             NPIdentifier_Param /* name */,
                             NPVariant_Param /* property */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty,
                             NPIdentifier_Param /* name */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate)

  IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration,
                             std::vector<NPIdentifier_Param> /* value */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct,
                             std::vector<NPVariant_Param> /* args */,
                             NPVariant_Param /* result_param */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate,
                             std::string /* script */,
                             bool /* popups_allowed */,
                             NPVariant_Param /* result_param */,
                             bool /* result */)

  IPC_SYNC_MESSAGE_ROUTED1_0(NPObjectMsg_SetException,
                             std::string /* message */)

IPC_END_MESSAGES(NPObject)