| 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_child/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/common/cursors/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 // Plugin messages | |
| 65 // These are messages sent from the renderer process to the plugin process. | |
| 66 // Tells the plugin process to create a new plugin instance with the given | |
| 67 // id. A corresponding WebPluginDelegateStub is created which hosts the | |
| 68 // WebPluginDelegateImpl. | |
| 69 IPC_SYNC_MESSAGE_CONTROL1_1(PluginMsg_CreateInstance, | |
| 70 std::string /* mime_type */, | |
| 71 int /* instance_id */) | |
| 72 | |
| 73 // The WebPluginDelegateProxy sends this to the WebPluginDelegateStub in its | |
| 74 // destructor, so that the stub deletes the actual WebPluginDelegateImpl | |
| 75 // object that it's hosting. | |
| 76 IPC_SYNC_MESSAGE_CONTROL1_0(PluginMsg_DestroyInstance, | |
| 77 int /* instance_id */) | |
| 78 | |
| 79 IPC_SYNC_MESSAGE_CONTROL0_1(PluginMsg_GenerateRouteID, | |
| 80 int /* id */) | |
| 81 | |
| 82 // The messages below all map to WebPluginDelegate methods. | |
| 83 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_Init, | |
| 84 PluginMsg_Init_Params, | |
| 85 bool /* transparent */, | |
| 86 bool /* result */) | |
| 87 | |
| 88 // Used to synchronously request a paint for windowless plugins. | |
| 89 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_Paint, | |
| 90 gfx::Rect /* damaged_rect */) | |
| 91 | |
| 92 // Sent by the renderer after it paints from its backing store so that the | |
| 93 // plugin knows it can send more invalidates. | |
| 94 IPC_MESSAGE_ROUTED0(PluginMsg_DidPaint) | |
| 95 | |
| 96 IPC_SYNC_MESSAGE_ROUTED0_1(PluginMsg_GetPluginScriptableObject, | |
| 97 int /* route_id */) | |
| 98 | |
| 99 // Gets the form value of the plugin instance synchronously. | |
| 100 IPC_SYNC_MESSAGE_ROUTED0_2(PluginMsg_GetFormValue, | |
| 101 string16 /* value */, | |
| 102 bool /* success */) | |
| 103 | |
| 104 IPC_MESSAGE_ROUTED3(PluginMsg_DidFinishLoadWithReason, | |
| 105 GURL /* url */, | |
| 106 int /* reason */, | |
| 107 int /* notify_id */) | |
| 108 | |
| 109 // Updates the plugin location. | |
| 110 IPC_MESSAGE_ROUTED1(PluginMsg_UpdateGeometry, | |
| 111 PluginMsg_UpdateGeometry_Param) | |
| 112 | |
| 113 // A synchronous version of above. | |
| 114 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_UpdateGeometrySync, | |
| 115 PluginMsg_UpdateGeometry_Param) | |
| 116 | |
| 117 IPC_SYNC_MESSAGE_ROUTED1_0(PluginMsg_SetFocus, | |
| 118 bool /* focused */) | |
| 119 | |
| 120 IPC_SYNC_MESSAGE_ROUTED1_2(PluginMsg_HandleInputEvent, | |
| 121 IPC::WebInputEventPointer /* event */, | |
| 122 bool /* handled */, | |
| 123 WebCursor /* cursor type*/) | |
| 124 | |
| 125 IPC_MESSAGE_ROUTED1(PluginMsg_SetContentAreaFocus, | |
| 126 bool /* has_focus */) | |
| 127 | |
| 128 #if defined(OS_WIN) | |
| 129 IPC_MESSAGE_ROUTED4(PluginMsg_ImeCompositionUpdated, | |
| 130 string16 /* text */, | |
| 131 std::vector<int> /* clauses */, | |
| 132 std::vector<int>, /* target */ | |
| 133 int /* cursor_position */) | |
| 134 | |
| 135 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, | |
| 136 string16 /* text */) | |
| 137 #endif | |
| 138 | |
| 139 #if defined(OS_MACOSX) | |
| 140 IPC_MESSAGE_ROUTED1(PluginMsg_SetWindowFocus, | |
| 141 bool /* has_focus */) | |
| 142 | |
| 143 IPC_MESSAGE_ROUTED0(PluginMsg_ContainerHidden) | |
| 144 | |
| 145 IPC_MESSAGE_ROUTED3(PluginMsg_ContainerShown, | |
| 146 gfx::Rect /* window_frame */, | |
| 147 gfx::Rect /* view_frame */, | |
| 148 bool /* has_focus */) | |
| 149 | |
| 150 IPC_MESSAGE_ROUTED2(PluginMsg_WindowFrameChanged, | |
| 151 gfx::Rect /* window_frame */, | |
| 152 gfx::Rect /* view_frame */) | |
| 153 | |
| 154 IPC_MESSAGE_ROUTED1(PluginMsg_ImeCompositionCompleted, | |
| 155 string16 /* text */) | |
| 156 #endif | |
| 157 | |
| 158 IPC_SYNC_MESSAGE_ROUTED3_0(PluginMsg_WillSendRequest, | |
| 159 unsigned long /* id */, | |
| 160 GURL /* url */, | |
| 161 int /* http_status_code */) | |
| 162 | |
| 163 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveResponse, | |
| 164 PluginMsg_DidReceiveResponseParams) | |
| 165 | |
| 166 IPC_MESSAGE_ROUTED3(PluginMsg_DidReceiveData, | |
| 167 unsigned long /* id */, | |
| 168 std::vector<char> /* buffer */, | |
| 169 int /* data_offset */) | |
| 170 | |
| 171 IPC_MESSAGE_ROUTED1(PluginMsg_DidFinishLoading, | |
| 172 unsigned long /* id */) | |
| 173 | |
| 174 IPC_MESSAGE_ROUTED1(PluginMsg_DidFail, | |
| 175 unsigned long /* id */) | |
| 176 | |
| 177 IPC_MESSAGE_ROUTED4(PluginMsg_SendJavaScriptStream, | |
| 178 GURL /* url */, | |
| 179 std::string /* result */, | |
| 180 bool /* success */, | |
| 181 int /* notify_id */) | |
| 182 | |
| 183 IPC_MESSAGE_ROUTED2(PluginMsg_DidReceiveManualResponse, | |
| 184 GURL /* url */, | |
| 185 PluginMsg_DidReceiveResponseParams) | |
| 186 | |
| 187 IPC_MESSAGE_ROUTED1(PluginMsg_DidReceiveManualData, | |
| 188 std::vector<char> /* buffer */) | |
| 189 | |
| 190 IPC_MESSAGE_ROUTED0(PluginMsg_DidFinishManualLoading) | |
| 191 | |
| 192 IPC_MESSAGE_ROUTED0(PluginMsg_DidManualLoadFail) | |
| 193 | |
| 194 IPC_MESSAGE_ROUTED3(PluginMsg_HandleURLRequestReply, | |
| 195 unsigned long /* resource_id */, | |
| 196 GURL /* url */, | |
| 197 int /* notify_id */) | |
| 198 | |
| 199 IPC_MESSAGE_ROUTED2(PluginMsg_HTTPRangeRequestReply, | |
| 200 unsigned long /* resource_id */, | |
| 201 int /* range_request_id */) | |
| 202 | |
| 203 IPC_MESSAGE_CONTROL1(PluginMsg_SignalModalDialogEvent, | |
| 204 int /* render_view_id */) | |
| 205 | |
| 206 IPC_MESSAGE_CONTROL1(PluginMsg_ResetModalDialogEvent, | |
| 207 int /* render_view_id */) | |
| 208 | |
| 209 #if defined(OS_MACOSX) | |
| 210 // This message, used only on 10.6 and later, transmits the "fake" | |
| 211 // window handle allocated by the browser on behalf of the renderer | |
| 212 // to the GPU plugin. | |
| 213 IPC_MESSAGE_ROUTED1(PluginMsg_SetFakeAcceleratedSurfaceWindowHandle, | |
| 214 gfx::PluginWindowHandle /* window */) | |
| 215 #endif | |
| 216 | |
| 217 //----------------------------------------------------------------------------- | |
| 218 // PluginHost messages | |
| 219 // These are messages sent from the plugin process to the renderer process. | |
| 220 // They all map to the corresponding WebPlugin methods. | |
| 221 // Sends the plugin window information to the renderer. | |
| 222 // The window parameter is a handle to the window if the plugin is a windowed | |
| 223 // plugin. It is NULL for windowless plugins. | |
| 224 IPC_SYNC_MESSAGE_ROUTED1_0(PluginHostMsg_SetWindow, | |
| 225 gfx::PluginWindowHandle /* window */) | |
| 226 | |
| 227 #if defined(OS_WIN) | |
| 228 // The modal_loop_pump_messages_event parameter is an event handle which is | |
| 229 // passed in for windowless plugins and is used to indicate if messages | |
| 230 // are to be pumped in sync calls to the plugin process. Currently used | |
| 231 // in HandleEvent calls. | |
| 232 IPC_SYNC_MESSAGE_ROUTED2_0(PluginHostMsg_SetWindowlessData, | |
| 233 HANDLE /* modal_loop_pump_messages_event */, | |
| 234 gfx::NativeViewId /* dummy_activation_window*/) | |
| 235 | |
| 236 // Send the IME status retrieved from a windowless plug-in. A windowless plug-in | |
| 237 // uses the IME attached to a browser process as a renderer does. A plug-in | |
| 238 // sends this message to control the IME status of a browser process. I would | |
| 239 // note that a plug-in sends this message to a renderer process that hosts this | |
| 240 // plug-in (not directly to a browser process) so the renderer process can | |
| 241 // update its IME status. | |
| 242 IPC_MESSAGE_ROUTED2(PluginHostMsg_NotifyIMEStatus, | |
| 243 int /* input_type */, | |
| 244 gfx::Rect /* caret_rect */) | |
| 245 #endif | |
| 246 | |
| 247 IPC_MESSAGE_ROUTED1(PluginHostMsg_URLRequest, | |
| 248 PluginHostMsg_URLRequest_Params) | |
| 249 | |
| 250 IPC_MESSAGE_ROUTED1(PluginHostMsg_CancelResource, | |
| 251 int /* id */) | |
| 252 | |
| 253 IPC_MESSAGE_ROUTED1(PluginHostMsg_InvalidateRect, | |
| 254 gfx::Rect /* rect */) | |
| 255 | |
| 256 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetWindowScriptNPObject, | |
| 257 int /* route id */, | |
| 258 bool /* success */) | |
| 259 | |
| 260 IPC_SYNC_MESSAGE_ROUTED1_1(PluginHostMsg_GetPluginElement, | |
| 261 int /* route id */, | |
| 262 bool /* success */) | |
| 263 | |
| 264 IPC_SYNC_MESSAGE_ROUTED1_2(PluginHostMsg_ResolveProxy, | |
| 265 GURL /* url */, | |
| 266 bool /* result */, | |
| 267 std::string /* proxy list */) | |
| 268 | |
| 269 IPC_MESSAGE_ROUTED3(PluginHostMsg_SetCookie, | |
| 270 GURL /* url */, | |
| 271 GURL /* first_party_for_cookies */, | |
| 272 std::string /* cookie */) | |
| 273 | |
| 274 IPC_SYNC_MESSAGE_ROUTED2_1(PluginHostMsg_GetCookies, | |
| 275 GURL /* url */, | |
| 276 GURL /* first_party_for_cookies */, | |
| 277 std::string /* cookies */) | |
| 278 | |
| 279 IPC_MESSAGE_ROUTED0(PluginHostMsg_CancelDocumentLoad) | |
| 280 | |
| 281 IPC_MESSAGE_ROUTED3(PluginHostMsg_InitiateHTTPRangeRequest, | |
| 282 std::string /* url */, | |
| 283 std::string /* range_info */, | |
| 284 int /* range_request_id */) | |
| 285 | |
| 286 IPC_MESSAGE_ROUTED2(PluginHostMsg_DeferResourceLoading, | |
| 287 unsigned long /* resource_id */, | |
| 288 bool /* defer */) | |
| 289 | |
| 290 IPC_SYNC_MESSAGE_CONTROL1_0(PluginHostMsg_SetException, | |
| 291 std::string /* message */) | |
| 292 | |
| 293 IPC_MESSAGE_CONTROL0(PluginHostMsg_PluginShuttingDown) | |
| 294 | |
| 295 #if defined(OS_MACOSX) | |
| 296 IPC_MESSAGE_ROUTED1(PluginHostMsg_FocusChanged, | |
| 297 bool /* focused */) | |
| 298 | |
| 299 IPC_MESSAGE_ROUTED0(PluginHostMsg_StartIme) | |
| 300 | |
| 301 //---------------------------------------------------------------------- | |
| 302 // Core Animation plugin implementation rendering via compositor. | |
| 303 | |
| 304 // Notifies the renderer process that this plugin will be using the | |
| 305 // accelerated rendering path. | |
| 306 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginEnabledRendering) | |
| 307 | |
| 308 // Notifies the renderer process that the plugin allocated a new | |
| 309 // IOSurface into which it is rendering. The renderer process forwards | |
| 310 // this IOSurface to the GPU process, causing it to be bound to a | |
| 311 // texture from which the compositor can render. Any previous | |
| 312 // IOSurface allocated by this plugin must be implicitly released by | |
| 313 // the receipt of this message. | |
| 314 IPC_MESSAGE_ROUTED3(PluginHostMsg_AcceleratedPluginAllocatedIOSurface, | |
| 315 int32 /* width */, | |
| 316 int32 /* height */, | |
| 317 uint32 /* surface_id */) | |
| 318 | |
| 319 // Notifies the renderer process that the plugin produced a new frame | |
| 320 // of content into its IOSurface, and therefore that the compositor | |
| 321 // needs to redraw. | |
| 322 IPC_MESSAGE_ROUTED0(PluginHostMsg_AcceleratedPluginSwappedIOSurface) | |
| 323 #endif | |
| 324 | |
| 325 IPC_MESSAGE_ROUTED2(PluginHostMsg_URLRedirectResponse, | |
| 326 bool /* allow */, | |
| 327 int /* resource_id */) | |
| 328 | |
| 329 | |
| 330 //----------------------------------------------------------------------------- | |
| 331 // NPObject messages | |
| 332 // These are messages used to marshall NPObjects. They are sent both from the | |
| 333 // plugin to the renderer and from the renderer to the plugin. | |
| 334 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Release) | |
| 335 | |
| 336 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasMethod, | |
| 337 content::NPIdentifier_Param /* name */, | |
| 338 bool /* result */) | |
| 339 | |
| 340 IPC_SYNC_MESSAGE_ROUTED3_2(NPObjectMsg_Invoke, | |
| 341 bool /* is_default */, | |
| 342 content::NPIdentifier_Param /* method */, | |
| 343 std::vector<content::NPVariant_Param> /* args */, | |
| 344 content::NPVariant_Param /* result_param */, | |
| 345 bool /* result */) | |
| 346 | |
| 347 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_HasProperty, | |
| 348 content::NPIdentifier_Param /* name */, | |
| 349 bool /* result */) | |
| 350 | |
| 351 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_GetProperty, | |
| 352 content::NPIdentifier_Param /* name */, | |
| 353 content::NPVariant_Param /* property */, | |
| 354 bool /* result */) | |
| 355 | |
| 356 IPC_SYNC_MESSAGE_ROUTED2_1(NPObjectMsg_SetProperty, | |
| 357 content::NPIdentifier_Param /* name */, | |
| 358 content::NPVariant_Param /* property */, | |
| 359 bool /* result */) | |
| 360 | |
| 361 IPC_SYNC_MESSAGE_ROUTED1_1(NPObjectMsg_RemoveProperty, | |
| 362 content::NPIdentifier_Param /* name */, | |
| 363 bool /* result */) | |
| 364 | |
| 365 IPC_SYNC_MESSAGE_ROUTED0_0(NPObjectMsg_Invalidate) | |
| 366 | |
| 367 IPC_SYNC_MESSAGE_ROUTED0_2(NPObjectMsg_Enumeration, | |
| 368 std::vector<content::NPIdentifier_Param> /* value */, | |
| 369 bool /* result */) | |
| 370 | |
| 371 IPC_SYNC_MESSAGE_ROUTED1_2(NPObjectMsg_Construct, | |
| 372 std::vector<content::NPVariant_Param> /* args */, | |
| 373 content::NPVariant_Param /* result_param */, | |
| 374 bool /* result */) | |
| 375 | |
| 376 IPC_SYNC_MESSAGE_ROUTED2_2(NPObjectMsg_Evaluate, | |
| 377 std::string /* script */, | |
| 378 bool /* popups_allowed */, | |
| 379 content::NPVariant_Param /* result_param */, | |
| 380 bool /* result */) | |
| OLD | NEW |