1 // Copyright 2014 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 // IPC messages for extensions. 6 // Multiply-included message file, hence no include guard. 7 8 #include <string> 9 #include <vector> 10 11 #include "base/memory/shared_memory.h" 12 #include "base/values.h" 13 #include "content/public/common/common_param_traits.h" 14 #include "content/public/common/socket_permission_request.h" 15 #include "extensions/common/api/messaging/message.h" 16 #include "extensions/common/draggable_region.h" 17 #include "extensions/common/extension.h" 18 #include "extensions/common/extensions_client.h" 19 #include "extensions/common/permissions/media_galleries_permission_data.h" 20 #include "extensions/common/permissions/permission_set.h" 21 #include "extensions/common/permissions/socket_permission_data.h" 22 #include "extensions/common/permissions/usb_device_permission_data.h" 23 #include "extensions/common/url_pattern.h" 24 #include "extensions/common/url_pattern_set.h" 25 #include "extensions/common/view_type.h" 26 #include "ipc/ipc_message_macros.h" 27 #include "url/gurl.h" 28 29 #define IPC_MESSAGE_START ExtensionMsgStart 30 31 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType, extensions::VIEW_TYPE_LAST) 32 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType, 33 content::SocketPermissionRequest::OPERATION_TYPE_LAST) 34 35 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and 36 // ExtensionHostMsg_AddEventToActivityLog. 37 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params) 38 // API name. 39 IPC_STRUCT_MEMBER(std::string, api_call) 40 41 // List of arguments. 42 IPC_STRUCT_MEMBER(base::ListValue, arguments) 43 44 // Extra logging information. 45 IPC_STRUCT_MEMBER(std::string, extra) 46 IPC_STRUCT_END() 47 48 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog. 49 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params) 50 // URL of the page. 51 IPC_STRUCT_MEMBER(GURL, url) 52 53 // Title of the page. 54 IPC_STRUCT_MEMBER(base::string16, url_title) 55 56 // API name. 57 IPC_STRUCT_MEMBER(std::string, api_call) 58 59 // List of arguments. 60 IPC_STRUCT_MEMBER(base::ListValue, arguments) 61 62 // Type of DOM API call. 63 IPC_STRUCT_MEMBER(int, call_type) 64 IPC_STRUCT_END() 65 66 // Parameters structure for ExtensionHostMsg_Request. 67 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params) 68 // Message name. 69 IPC_STRUCT_MEMBER(std::string, name) 70 71 // List of message arguments. 72 IPC_STRUCT_MEMBER(base::ListValue, arguments) 73 74 // Extension ID this request was sent from. This can be empty, in the case 75 // where we expose APIs to normal web pages using the extension function 76 // system. 77 IPC_STRUCT_MEMBER(std::string, extension_id) 78 79 // URL of the frame the request was sent from. This isn't necessarily an 80 // extension url. Extension requests can also originate from content scripts, 81 // in which case extension_id will indicate the ID of the associated 82 // extension. Or, they can originate from hosted apps or normal web pages. 83 IPC_STRUCT_MEMBER(GURL, source_url) 84 85 // The id of the tab that sent this request, or -1 if there is no source tab. 86 IPC_STRUCT_MEMBER(int, source_tab_id) 87 88 // Unique request id to match requests and responses. 89 IPC_STRUCT_MEMBER(int, request_id) 90 91 // True if request has a callback specified. 92 IPC_STRUCT_MEMBER(bool, has_callback) 93 94 // True if request is executed in response to an explicit user gesture. 95 IPC_STRUCT_MEMBER(bool, user_gesture) 96 IPC_STRUCT_END() 97 98 // Allows an extension to execute code in a tab. 99 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params) 100 // The extension API request id, for responding. 101 IPC_STRUCT_MEMBER(int, request_id) 102 103 // The ID of the requesting extension. To know which isolated world to 104 // execute the code inside of. 105 IPC_STRUCT_MEMBER(std::string, extension_id) 106 107 // Whether the code is JavaScript or CSS. 108 IPC_STRUCT_MEMBER(bool, is_javascript) 109 110 // String of code to execute. 111 IPC_STRUCT_MEMBER(std::string, code) 112 113 // The webview guest source who calls to execute code. 114 IPC_STRUCT_MEMBER(GURL, webview_src) 115 116 // Whether to inject into all frames, or only the root frame. 117 IPC_STRUCT_MEMBER(bool, all_frames) 118 119 // Whether to inject into about:blank (sub)frames. 120 IPC_STRUCT_MEMBER(bool, match_about_blank) 121 122 // When to inject the code. 123 IPC_STRUCT_MEMBER(int, run_at) 124 125 // Whether to execute code in the main world (as opposed to an isolated 126 // world). 127 IPC_STRUCT_MEMBER(bool, in_main_world) 128 129 // Whether the request is coming from a <webview>. 130 IPC_STRUCT_MEMBER(bool, is_web_view) 131 132 // Whether the caller is interested in the result value. Manifest-declared 133 // content scripts and executeScript() calls without a response callback 134 // are examples of when this will be false. 135 IPC_STRUCT_MEMBER(bool, wants_result) 136 137 // The URL of the file that was injected, if any. 138 IPC_STRUCT_MEMBER(GURL, file_url) 139 140 // Whether the code to be executed should be associated with a user gesture. 141 IPC_STRUCT_MEMBER(bool, user_gesture) 142 IPC_STRUCT_END() 143 144 // Struct containing the data for external connections to extensions. Used to 145 // handle the IPCs initiated by both connect() and onConnect(). 146 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo) 147 // The ID of the extension that is the target of the request. 148 IPC_STRUCT_MEMBER(std::string, target_id) 149 150 // The ID of the extension that initiated the request. May be empty if it 151 // wasn't initiated by an extension. 152 IPC_STRUCT_MEMBER(std::string, source_id) 153 154 // The URL of the frame that initiated the request. 155 IPC_STRUCT_MEMBER(GURL, source_url) 156 IPC_STRUCT_END() 157 158 // Parameters structure for ExtensionMsg_UpdatePermissions. 159 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params) 160 IPC_STRUCT_MEMBER(int /* UpdateExtensionPermissionsInfo::REASON */, reason_id) 161 IPC_STRUCT_MEMBER(std::string, extension_id) 162 IPC_STRUCT_MEMBER(extensions::APIPermissionSet, apis) 163 IPC_STRUCT_MEMBER(extensions::ManifestPermissionSet, manifest_permissions) 164 IPC_STRUCT_MEMBER(extensions::URLPatternSet, explicit_hosts) 165 IPC_STRUCT_MEMBER(extensions::URLPatternSet, scriptable_hosts) 166 IPC_STRUCT_END() 167 168 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion) 169 IPC_STRUCT_TRAITS_MEMBER(draggable) 170 IPC_STRUCT_TRAITS_MEMBER(bounds) 171 IPC_STRUCT_TRAITS_END() 172 173 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest) 174 IPC_STRUCT_TRAITS_MEMBER(type) 175 IPC_STRUCT_TRAITS_MEMBER(host) 176 IPC_STRUCT_TRAITS_MEMBER(port) 177 IPC_STRUCT_TRAITS_END() 178 179 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry) 180 IPC_STRUCT_TRAITS_MEMBER(pattern_) 181 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_) 182 IPC_STRUCT_TRAITS_END() 183 184 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData) 185 IPC_STRUCT_TRAITS_MEMBER(entry()) 186 IPC_STRUCT_TRAITS_END() 187 188 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData) 189 IPC_STRUCT_TRAITS_MEMBER(vendor_id()) 190 IPC_STRUCT_TRAITS_MEMBER(product_id()) 191 IPC_STRUCT_TRAITS_END() 192 193 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData) 194 IPC_STRUCT_TRAITS_MEMBER(permission()) 195 IPC_STRUCT_TRAITS_END() 196 197 IPC_STRUCT_TRAITS_BEGIN(extensions::Message) 198 IPC_STRUCT_TRAITS_MEMBER(data) 199 IPC_STRUCT_TRAITS_MEMBER(user_gesture) 200 IPC_STRUCT_TRAITS_END() 201 202 // Singly-included section for custom IPC traits. 203 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ 204 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ 205 206 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need 207 // to typedef it to avoid that. 208 // Substitution map for l10n messages. 209 typedef std::map<std::string, std::string> SubstitutionMap; 210 211 // Map of extensions IDs to the executing script paths. 212 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap; 213 214 struct ExtensionMsg_Loaded_Params { 215 ExtensionMsg_Loaded_Params(); 216 ~ExtensionMsg_Loaded_Params(); 217 explicit ExtensionMsg_Loaded_Params(const extensions::Extension* extension); 218 219 // Creates a new extension from the data in this object. 220 scoped_refptr<extensions::Extension> ConvertToExtension( 221 std::string* error) const; 222 223 // The subset of the extension manifest data we send to renderers. 224 linked_ptr<base::DictionaryValue> manifest; 225 226 // The location the extension was installed from. 227 extensions::Manifest::Location location; 228 229 // The path the extension was loaded from. This is used in the renderer only 230 // to generate the extension ID for extensions that are loaded unpacked. 231 base::FilePath path; 232 233 // The extension's active permissions. 234 extensions::APIPermissionSet apis; 235 extensions::ManifestPermissionSet manifest_permissions; 236 extensions::URLPatternSet explicit_hosts; 237 extensions::URLPatternSet scriptable_hosts; 238 239 // We keep this separate so that it can be used in logging. 240 std::string id; 241 242 // Send creation flags so extension is initialized identically. 243 int creation_flags; 244 }; 245 246 namespace IPC { 247 248 template <> 249 struct ParamTraits<URLPattern> { 250 typedef URLPattern param_type; 251 static void Write(Message* m, const param_type& p); 252 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 253 static void Log(const param_type& p, std::string* l); 254 }; 255 256 template <> 257 struct ParamTraits<extensions::URLPatternSet> { 258 typedef extensions::URLPatternSet param_type; 259 static void Write(Message* m, const param_type& p); 260 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 261 static void Log(const param_type& p, std::string* l); 262 }; 263 264 template <> 265 struct ParamTraits<extensions::APIPermission::ID> { 266 typedef extensions::APIPermission::ID param_type; 267 static void Write(Message* m, const param_type& p); 268 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 269 static void Log(const param_type& p, std::string* l); 270 }; 271 272 template <> 273 struct ParamTraits<extensions::APIPermissionSet> { 274 typedef extensions::APIPermissionSet param_type; 275 static void Write(Message* m, const param_type& p); 276 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 277 static void Log(const param_type& p, std::string* l); 278 }; 279 280 template <> 281 struct ParamTraits<extensions::ManifestPermissionSet> { 282 typedef extensions::ManifestPermissionSet param_type; 283 static void Write(Message* m, const param_type& p); 284 static bool Read(const Message* m, PickleIterator* iter, param_type* r); 285 static void Log(const param_type& p, std::string* l); 286 }; 287 288 template <> 289 struct ParamTraits<ExtensionMsg_Loaded_Params> { 290 typedef ExtensionMsg_Loaded_Params param_type; 291 static void Write(Message* m, const param_type& p); 292 static bool Read(const Message* m, PickleIterator* iter, param_type* p); 293 static void Log(const param_type& p, std::string* l); 294 }; 295 296 } // namespace IPC 297 298 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ 299 300 // Messages sent from the browser to the renderer. 301 302 // The browser sends this message in response to all extension api calls. The 303 // response data (if any) is one of the base::Value subclasses, wrapped as the 304 // first element in a ListValue. 305 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response, 306 int /* request_id */, 307 bool /* success */, 308 base::ListValue /* response wrapper (see comment above) */, 309 std::string /* error */) 310 311 // This message is optionally routed. If used as a control message, it will 312 // call a javascript function |function_name| from module |module_name| in 313 // every registered context in the target process. If routed, it will be 314 // restricted to the contexts that are part of the target RenderView. 315 // 316 // If |extension_id| is non-empty, the function will be invoked only in 317 // contexts owned by the extension. |args| is a list of primitive Value types 318 // that are passed to the function. 319 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke, 320 std::string /* extension_id */, 321 std::string /* module_name */, 322 std::string /* function_name */, 323 base::ListValue /* args */, 324 bool /* delivered as part of a user gesture */) 325 326 // Tell the renderer process all known extension function names. 327 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames, 328 std::vector<std::string>) 329 330 // Tell the renderer process the platforms system font. 331 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont, 332 std::string /* font_family */, 333 std::string /* font_size */) 334 335 // Marks an extension as 'active' in an extension process. 'Active' extensions 336 // have more privileges than other extension content that might end up running 337 // in the process (e.g. because of iframes or content scripts). 338 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension, 339 std::string /* extension_id */) 340 341 // Notifies the renderer that extensions were loaded in the browser. 342 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded, 343 std::vector<ExtensionMsg_Loaded_Params>) 344 345 // Notifies the renderer that an extension was unloaded in the browser. 346 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded, 347 std::string) 348 349 // Updates the scripting whitelist for extensions in the render process. This is 350 // only used for testing. 351 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist, 352 // extension ids 353 extensions::ExtensionsClient::ScriptingWhitelist) 354 355 // Notification that renderer should run some JavaScript code. 356 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode, 357 ExtensionMsg_ExecuteCode_Params) 358 359 // Notification that the user scripts have been updated. It has one 360 // SharedMemoryHandle argument consisting of the pickled script data. This 361 // handle is valid in the context of the renderer. 362 // If |changed_extensions| is not empty, only the extensions in that set will 363 // be updated. Otherwise, all extensions will be updated. 364 IPC_MESSAGE_CONTROL2(ExtensionMsg_UpdateUserScripts, 365 base::SharedMemoryHandle, 366 std::set<std::string> /* changed extensions */) 367 368 // Tell the render view which browser window it's being attached to. 369 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId, 370 int /* id of browser window */) 371 372 // Tell the render view what its tab ID is. 373 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId, 374 int /* id of tab */) 375 376 // Tell the renderer to update an extension's permission set. 377 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions, 378 ExtensionMsg_UpdatePermissions_Params) 379 380 // Tell the renderer about new tab-specific permissions for an extension. 381 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions, 382 int32 /* page_id (only relevant for the target tab) */, 383 int /* tab_id */, 384 std::string /* extension_id */, 385 extensions::URLPatternSet /* hosts */) 386 387 // Tell the renderer to clear tab-specific permissions for some extensions. 388 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions, 389 int /* tab_id */, 390 std::vector<std::string> /* extension_ids */) 391 392 // Tell the renderer which type this view is. 393 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType, 394 extensions::ViewType /* view_type */) 395 396 // Deliver a message sent with ExtensionHostMsg_PostMessage. 397 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI, 398 bool /* webrequest_used */) 399 400 // Ask the lazy background page if it is ready to be suspended. This is sent 401 // when the page is considered idle. The renderer will reply with the same 402 // sequence_id so that we can tell which message it is responding to. 403 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend, 404 std::string /* extension_id */, 405 int /* sequence_id */) 406 407 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without 408 // the lazy background page becoming active again, we are ready to unload. This 409 // message tells the page to dispatch the suspend event. 410 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend, 411 std::string /* extension_id */) 412 413 // The browser changed its mind about suspending this extension. 414 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend, 415 std::string /* extension_id */) 416 417 // Response to the renderer for ExtensionHostMsg_GetAppInstallState. 418 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse, 419 std::string /* state */, 420 int32 /* callback_id */) 421 422 // Dispatch the Port.onConnect event for message channels. 423 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect, 424 int /* target_port_id */, 425 std::string /* channel_name */, 426 base::DictionaryValue /* source_tab */, 427 ExtensionMsg_ExternalConnectionInfo, 428 std::string /* tls_channel_id */) 429 430 // Deliver a message sent with ExtensionHostMsg_PostMessage. 431 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage, 432 int /* target_port_id */, 433 extensions::Message) 434 435 // Dispatch the Port.onDisconnect event for message channels. 436 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect, 437 int /* port_id */, 438 std::string /* error_message */) 439 440 // Informs the renderer what channel (dev, beta, stable, etc) is running. 441 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel, 442 int /* channel */) 443 444 // Adds a logging message to the renderer's root frame DevTools console. 445 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole, 446 content::ConsoleMessageLevel /* level */, 447 std::string /* message */) 448 449 // Notify the renderer that its window has closed. 450 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed) 451 452 // Notify the renderer that an extension wants notifications when certain 453 // searches match the active page. This message replaces the old set of 454 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from 455 // each tab to keep the browser updated about changes. 456 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages, 457 std::vector<std::string> /* CSS selectors */) 458 459 // Send by the browser to indicate a Blob handle has been transferred to the 460 // renderer. This is sent after the actual extension response, and depends on 461 // the sequential nature of IPCs so that the blob has already been caught. 462 // This is a separate control message, so that the renderer process will send 463 // an acknowledgement even if the RenderView has closed or navigated away. 464 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs, 465 std::vector<std::string> /* blob_uuids */) 466 467 // Messages sent from the renderer to the browser. 468 469 // A renderer sends this message when an extension process starts an API 470 // request. The browser will always respond with a ExtensionMsg_Response. 471 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request, 472 ExtensionHostMsg_Request_Params) 473 474 // A renderer sends this message when an extension process starts an API 475 // request. The browser will always respond with a ExtensionMsg_Response. 476 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread, 477 int /* routing_id */, 478 ExtensionHostMsg_Request_Params) 479 480 // Notify the browser that the given extension added a listener to an event. 481 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddListener, 482 std::string /* extension_id */, 483 std::string /* name */) 484 485 // Notify the browser that the given extension removed a listener from an 486 // event. 487 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveListener, 488 std::string /* extension_id */, 489 std::string /* name */) 490 491 // Notify the browser that the given extension added a listener to an event from 492 // a lazy background page. 493 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener, 494 std::string /* extension_id */, 495 std::string /* name */) 496 497 // Notify the browser that the given extension is no longer interested in 498 // receiving the given event from a lazy background page. 499 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener, 500 std::string /* extension_id */, 501 std::string /* name */) 502 503 // Notify the browser that the given extension added a listener to instances of 504 // the named event that satisfy the filter. 505 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener, 506 std::string /* extension_id */, 507 std::string /* name */, 508 base::DictionaryValue /* filter */, 509 bool /* lazy */) 510 511 // Notify the browser that the given extension is no longer interested in 512 // instances of the named event that satisfy the filter. 513 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener, 514 std::string /* extension_id */, 515 std::string /* name */, 516 base::DictionaryValue /* filter */, 517 bool /* lazy */) 518 519 // Notify the browser that an event has finished being dispatched. 520 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck) 521 522 // Open a channel to all listening contexts owned by the extension with 523 // the given ID. This always returns a valid port ID which can be used for 524 // sending messages. If an error occurred, the opener will be notified 525 // asynchronously. 526 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension, 527 int /* routing_id */, 528 ExtensionMsg_ExternalConnectionInfo, 529 std::string /* channel_name */, 530 bool /* include_tls_channel_id */, 531 int /* port_id */) 532 533 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp, 534 int /* routing_id */, 535 std::string /* source_extension_id */, 536 std::string /* native_app_name */, 537 int /* port_id */) 538 539 // Get a port handle to the given tab. The handle can be used for sending 540 // messages to the extension. 541 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab, 542 int /* routing_id */, 543 int /* tab_id */, 544 std::string /* extension_id */, 545 std::string /* channel_name */, 546 int /* port_id */) 547 548 // Send a message to an extension process. The handle is the value returned 549 // by ViewHostMsg_OpenChannelTo*. 550 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage, 551 int /* port_id */, 552 extensions::Message) 553 554 // Send a message to an extension process. The handle is the value returned 555 // by ViewHostMsg_OpenChannelTo*. 556 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel, 557 int /* port_id */, 558 std::string /* error_message */) 559 560 // Used to get the extension message bundle. 561 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle, 562 std::string /* extension id */, 563 SubstitutionMap /* message bundle */) 564 565 // Sent from the renderer to the browser to return the script running result. 566 IPC_MESSAGE_ROUTED5( 567 ExtensionHostMsg_ExecuteCodeFinished, 568 int /* request id */, 569 std::string /* error; empty implies success */, 570 int32 /* page_id the code executed on. May be -1 if unsuccessful */, 571 GURL /* URL of the code executed on. May be empty if unsuccessful. */, 572 base::ListValue /* result of the script */) 573 574 // Sent from the renderer to the browser to notify that content scripts are 575 // running in the renderer that the IPC originated from. 576 // Note that the page_id is for the parent (or more accurately the topmost) 577 // frame (e.g. if executing in an iframe this is the page ID of the parent, 578 // unless the parent is an iframe... etc). 579 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting, 580 ExecutingScriptsMap, 581 int32 /* page_id of the _topmost_ frame */, 582 GURL /* url of the _topmost_ frame */) 583 584 // Sent from the renderer to the browser to request permission for a content 585 // script to execute on a given page. 586 // If request id is -1, this signals that the request has already ran, and this 587 // merely serves as a notification. This happens when the feature to disable 588 // scripts running without user consent is not enabled. 589 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestContentScriptPermission, 590 std::string /* extension id */, 591 int /* page id */, 592 int /* request id */) 593 594 // Sent from the browser to the renderer in reply to a 595 // RequestContentScriptPermission message, granting permission for a content 596 // script to run. 597 IPC_MESSAGE_ROUTED1(ExtensionMsg_GrantContentScriptPermission, 598 int /* request id */) 599 600 // Sent by the renderer when a web page is checking if its app is installed. 601 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState, 602 GURL /* requestor_url */, 603 int32 /* return_route_id */, 604 int32 /* callback_id */) 605 606 // Optional Ack message sent to the browser to notify that the response to a 607 // function has been processed. 608 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck, 609 int /* request_id */) 610 611 // Response to ExtensionMsg_ShouldSuspend. 612 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck, 613 std::string /* extension_id */, 614 int /* sequence_id */) 615 616 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event. 617 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck, 618 std::string /* extension_id */) 619 620 // Informs the browser to increment the keepalive count for the lazy background 621 // page, keeping it alive. 622 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount) 623 624 // Informs the browser there is one less thing keeping the lazy background page 625 // alive. 626 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount) 627 628 // Fetches a globally unique ID (for the lifetime of the browser) from the 629 // browser process. 630 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID, 631 int /* unique_id */) 632 633 // Resumes resource requests for a newly created app window. 634 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */) 635 636 // Sent by the renderer when the draggable regions are updated. 637 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions, 638 std::vector<extensions::DraggableRegion> /* regions */) 639 640 // Sent by the renderer to log an API action to the extension activity log. 641 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog, 642 std::string /* extension_id */, 643 ExtensionHostMsg_APIActionOrEvent_Params) 644 645 // Sent by the renderer to log an event to the extension activity log. 646 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog, 647 std::string /* extension_id */, 648 ExtensionHostMsg_APIActionOrEvent_Params) 649 650 // Sent by the renderer to log a DOM action to the extension activity log. 651 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog, 652 std::string /* extension_id */, 653 ExtensionHostMsg_DOMAction_Params) 654 655 // Notifies the browser process that a tab has started or stopped matching 656 // certain conditions. This message is sent in response to several events: 657 // 658 // * ExtensionMsg_WatchPages was received, updating the set of conditions. 659 // * A new page is loaded. This will be sent after 660 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the 661 // main frame. 662 // * Something changed on an existing frame causing the set of matching searches 663 // to change. 664 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange, 665 std::vector<std::string> /* Matching CSS selectors */) 666 667 // Sent by the renderer when it has received a Blob handle from the browser. 668 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck, 669 std::vector<std::string> /* blob_uuids */) 670