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