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