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.
5 // IPC messages for extensions.
6 // Multiply-included message file, hence no include guard.
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/user_script.h"
26 #include "extensions/common/view_type.h"
27 #include "ipc/ipc_message_macros.h"
28 #include "ui/gfx/ipc/gfx_param_traits.h"
31 #define IPC_MESSAGE_START ExtensionMsgStart
33 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType
, extensions::VIEW_TYPE_LAST
)
34 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType
,
35 content::SocketPermissionRequest::OPERATION_TYPE_LAST
)
37 IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType
,
38 extensions::UserScript::INJECTION_TYPE_LAST
)
40 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
41 // ExtensionHostMsg_AddEventToActivityLog.
42 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params
)
44 IPC_STRUCT_MEMBER(std::string
, api_call
)
47 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
49 // Extra logging information.
50 IPC_STRUCT_MEMBER(std::string
, extra
)
53 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
54 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params
)
56 IPC_STRUCT_MEMBER(GURL
, url
)
59 IPC_STRUCT_MEMBER(base::string16
, url_title
)
62 IPC_STRUCT_MEMBER(std::string
, api_call
)
65 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
67 // Type of DOM API call.
68 IPC_STRUCT_MEMBER(int, call_type
)
71 // Parameters structure for ExtensionHostMsg_Request.
72 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params
)
74 IPC_STRUCT_MEMBER(std::string
, name
)
76 // List of message arguments.
77 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
79 // Extension ID this request was sent from. This can be empty, in the case
80 // where we expose APIs to normal web pages using the extension function
82 IPC_STRUCT_MEMBER(std::string
, extension_id
)
84 // URL of the frame the request was sent from. This isn't necessarily an
85 // extension url. Extension requests can also originate from content scripts,
86 // in which case extension_id will indicate the ID of the associated
87 // extension. Or, they can originate from hosted apps or normal web pages.
88 IPC_STRUCT_MEMBER(GURL
, source_url
)
90 // The id of the tab that sent this request, or -1 if there is no source tab.
91 IPC_STRUCT_MEMBER(int, source_tab_id
)
93 // Unique request id to match requests and responses.
94 IPC_STRUCT_MEMBER(int, request_id
)
96 // True if request has a callback specified.
97 IPC_STRUCT_MEMBER(bool, has_callback
)
99 // True if request is executed in response to an explicit user gesture.
100 IPC_STRUCT_MEMBER(bool, user_gesture
)
103 // Allows an extension to execute code in a tab.
104 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params
)
105 // The extension API request id, for responding.
106 IPC_STRUCT_MEMBER(int, request_id
)
108 // The ID of the requesting extension. To know which isolated world to
109 // execute the code inside of.
110 IPC_STRUCT_MEMBER(std::string
, extension_id
)
112 // Whether the code is JavaScript or CSS.
113 IPC_STRUCT_MEMBER(bool, is_javascript
)
115 // String of code to execute.
116 IPC_STRUCT_MEMBER(std::string
, code
)
118 // The webview guest source who calls to execute code.
119 IPC_STRUCT_MEMBER(GURL
, webview_src
)
121 // Whether to inject into all frames, or only the root frame.
122 IPC_STRUCT_MEMBER(bool, all_frames
)
124 // Whether to inject into about:blank (sub)frames.
125 IPC_STRUCT_MEMBER(bool, match_about_blank
)
127 // When to inject the code.
128 IPC_STRUCT_MEMBER(int, run_at
)
130 // Whether to execute code in the main world (as opposed to an isolated
132 IPC_STRUCT_MEMBER(bool, in_main_world
)
134 // Whether the request is coming from a <webview>.
135 IPC_STRUCT_MEMBER(bool, is_web_view
)
137 // Whether the caller is interested in the result value. Manifest-declared
138 // content scripts and executeScript() calls without a response callback
139 // are examples of when this will be false.
140 IPC_STRUCT_MEMBER(bool, wants_result
)
142 // The URL of the file that was injected, if any.
143 IPC_STRUCT_MEMBER(GURL
, file_url
)
145 // Whether the code to be executed should be associated with a user gesture.
146 IPC_STRUCT_MEMBER(bool, user_gesture
)
149 // Struct containing the data for external connections to extensions. Used to
150 // handle the IPCs initiated by both connect() and onConnect().
151 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
152 // The ID of the extension that is the target of the request.
153 IPC_STRUCT_MEMBER(std::string
, target_id
)
155 // The ID of the extension that initiated the request. May be empty if it
156 // wasn't initiated by an extension.
157 IPC_STRUCT_MEMBER(std::string
, source_id
)
159 // The URL of the frame that initiated the request.
160 IPC_STRUCT_MEMBER(GURL
, source_url
)
163 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
164 IPC_STRUCT_TRAITS_MEMBER(draggable
)
165 IPC_STRUCT_TRAITS_MEMBER(bounds
)
166 IPC_STRUCT_TRAITS_END()
168 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
169 IPC_STRUCT_TRAITS_MEMBER(type
)
170 IPC_STRUCT_TRAITS_MEMBER(host
)
171 IPC_STRUCT_TRAITS_MEMBER(port
)
172 IPC_STRUCT_TRAITS_END()
174 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
175 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
176 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
177 IPC_STRUCT_TRAITS_END()
179 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
180 IPC_STRUCT_TRAITS_MEMBER(entry())
181 IPC_STRUCT_TRAITS_END()
183 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
184 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
185 IPC_STRUCT_TRAITS_MEMBER(product_id())
186 IPC_STRUCT_TRAITS_END()
188 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
189 IPC_STRUCT_TRAITS_MEMBER(permission())
190 IPC_STRUCT_TRAITS_END()
192 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
193 IPC_STRUCT_TRAITS_MEMBER(data
)
194 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
195 IPC_STRUCT_TRAITS_END()
197 // Singly-included section for custom IPC traits.
198 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
199 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
201 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
202 // to typedef it to avoid that.
203 // Substitution map for l10n messages.
204 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
206 // Map of extensions IDs to the executing script paths.
207 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
209 struct ExtensionMsg_PermissionSetStruct
{
210 ExtensionMsg_PermissionSetStruct();
211 explicit ExtensionMsg_PermissionSetStruct(
212 const extensions::PermissionSet
* permissions
);
213 ~ExtensionMsg_PermissionSetStruct();
215 scoped_refptr
<const extensions::PermissionSet
> ToPermissionSet() const;
217 extensions::APIPermissionSet apis
;
218 extensions::ManifestPermissionSet manifest_permissions
;
219 extensions::URLPatternSet explicit_hosts
;
220 extensions::URLPatternSet scriptable_hosts
;
223 struct ExtensionMsg_Loaded_Params
{
224 ExtensionMsg_Loaded_Params();
225 ~ExtensionMsg_Loaded_Params();
226 explicit ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
);
228 // Creates a new extension from the data in this object.
229 scoped_refptr
<extensions::Extension
> ConvertToExtension(
230 std::string
* error
) const;
232 // The subset of the extension manifest data we send to renderers.
233 linked_ptr
<base::DictionaryValue
> manifest
;
235 // The location the extension was installed from.
236 extensions::Manifest::Location location
;
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.
242 // The extension's active and withheld permissions.
243 ExtensionMsg_PermissionSetStruct active_permissions
;
244 ExtensionMsg_PermissionSetStruct withheld_permissions
;
246 // We keep this separate so that it can be used in logging.
249 // Send creation flags so extension is initialized identically.
256 struct ParamTraits
<URLPattern
> {
257 typedef URLPattern param_type
;
258 static void Write(Message
* m
, const param_type
& p
);
259 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
260 static void Log(const param_type
& p
, std::string
* l
);
264 struct ParamTraits
<extensions::URLPatternSet
> {
265 typedef extensions::URLPatternSet param_type
;
266 static void Write(Message
* m
, const param_type
& p
);
267 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
268 static void Log(const param_type
& p
, std::string
* l
);
272 struct ParamTraits
<extensions::APIPermission::ID
> {
273 typedef extensions::APIPermission::ID param_type
;
274 static void Write(Message
* m
, const param_type
& p
);
275 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
276 static void Log(const param_type
& p
, std::string
* l
);
280 struct ParamTraits
<extensions::APIPermissionSet
> {
281 typedef extensions::APIPermissionSet param_type
;
282 static void Write(Message
* m
, const param_type
& p
);
283 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
284 static void Log(const param_type
& p
, std::string
* l
);
288 struct ParamTraits
<extensions::ManifestPermissionSet
> {
289 typedef extensions::ManifestPermissionSet 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
);
296 struct ParamTraits
<ExtensionMsg_PermissionSetStruct
> {
297 typedef ExtensionMsg_PermissionSetStruct param_type
;
298 static void Write(Message
* m
, const param_type
& p
);
299 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
300 static void Log(const param_type
& p
, std::string
* l
);
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
);
313 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
315 // Parameters structure for ExtensionMsg_UpdatePermissions.
316 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
317 IPC_STRUCT_MEMBER(std::string
, extension_id
)
318 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, active_permissions
)
319 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, withheld_permissions
)
322 // Messages sent from the browser to the renderer.
324 // The browser sends this message in response to all extension api calls. The
325 // response data (if any) is one of the base::Value subclasses, wrapped as the
326 // first element in a ListValue.
327 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
328 int /* request_id */,
330 base::ListValue
/* response wrapper (see comment above) */,
331 std::string
/* error */)
333 // This message is optionally routed. If used as a control message, it will
334 // call a javascript function |function_name| from module |module_name| in
335 // every registered context in the target process. If routed, it will be
336 // restricted to the contexts that are part of the target RenderView.
338 // If |extension_id| is non-empty, the function will be invoked only in
339 // contexts owned by the extension. |args| is a list of primitive Value types
340 // that are passed to the function.
341 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
342 std::string
/* extension_id */,
343 std::string
/* module_name */,
344 std::string
/* function_name */,
345 base::ListValue
/* args */,
346 bool /* delivered as part of a user gesture */)
348 // Tell the renderer process all known extension function names.
349 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
350 std::vector
<std::string
>)
352 // Tell the renderer process the platforms system font.
353 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
354 std::string
/* font_family */,
355 std::string
/* font_size */)
357 // Marks an extension as 'active' in an extension process. 'Active' extensions
358 // have more privileges than other extension content that might end up running
359 // in the process (e.g. because of iframes or content scripts).
360 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
361 std::string
/* extension_id */)
363 // Notifies the renderer that extensions were loaded in the browser.
364 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
365 std::vector
<ExtensionMsg_Loaded_Params
>)
367 // Notifies the renderer that an extension was unloaded in the browser.
368 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
371 // Updates the scripting whitelist for extensions in the render process. This is
372 // only used for testing.
373 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
375 extensions::ExtensionsClient::ScriptingWhitelist
)
377 // Notification that renderer should run some JavaScript code.
378 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
379 ExtensionMsg_ExecuteCode_Params
)
381 // Notification that the user scripts have been updated. It has one
382 // SharedMemoryHandle argument consisting of the pickled script data. This
383 // handle is valid in the context of the renderer.
384 // If |changed_extensions| is not empty, only the extensions in that set will
385 // be updated. Otherwise, all extensions will be updated.
386 IPC_MESSAGE_CONTROL2(ExtensionMsg_UpdateUserScripts
,
387 base::SharedMemoryHandle
,
388 std::set
<std::string
> /* changed extensions */)
390 // Tell the render view which browser window it's being attached to.
391 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
392 int /* id of browser window */)
394 // Tell the render view what its tab ID is.
395 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
398 // Tell the renderer to update an extension's permission set.
399 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
400 ExtensionMsg_UpdatePermissions_Params
)
402 // Tell the renderer about new tab-specific permissions for an extension.
403 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions
,
406 std::string
/* extension_id */,
407 extensions::URLPatternSet
/* hosts */)
409 // Tell the renderer to clear tab-specific permissions for some extensions.
410 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions
,
412 std::vector
<std::string
> /* extension_ids */)
414 // Tell the renderer which type this view is.
415 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
416 extensions::ViewType
/* view_type */)
418 // Deliver a message sent with ExtensionHostMsg_PostMessage.
419 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
420 bool /* webrequest_used */)
422 // Ask the lazy background page if it is ready to be suspended. This is sent
423 // when the page is considered idle. The renderer will reply with the same
424 // sequence_id so that we can tell which message it is responding to.
425 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
426 std::string
/* extension_id */,
427 uint64
/* sequence_id */)
429 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
430 // the lazy background page becoming active again, we are ready to unload. This
431 // message tells the page to dispatch the suspend event.
432 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
433 std::string
/* extension_id */)
435 // The browser changed its mind about suspending this extension.
436 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
437 std::string
/* extension_id */)
439 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
440 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
441 std::string
/* state */,
442 int32
/* callback_id */)
444 // Dispatch the Port.onConnect event for message channels.
445 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
446 int /* target_port_id */,
447 std::string
/* channel_name */,
448 base::DictionaryValue
/* source_tab */,
449 ExtensionMsg_ExternalConnectionInfo
,
450 std::string
/* tls_channel_id */)
452 // Deliver a message sent with ExtensionHostMsg_PostMessage.
453 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
454 int /* target_port_id */,
457 // Dispatch the Port.onDisconnect event for message channels.
458 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
460 std::string
/* error_message */)
462 // Informs the renderer what channel (dev, beta, stable, etc) is running.
463 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
466 // Adds a logging message to the renderer's root frame DevTools console.
467 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
468 content::ConsoleMessageLevel
/* level */,
469 std::string
/* message */)
471 // Notify the renderer that its window has closed.
472 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
474 // Notify the renderer that an extension wants notifications when certain
475 // searches match the active page. This message replaces the old set of
476 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
477 // each tab to keep the browser updated about changes.
478 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
479 std::vector
<std::string
> /* CSS selectors */)
481 // Send by the browser to indicate a Blob handle has been transferred to the
482 // renderer. This is sent after the actual extension response, and depends on
483 // the sequential nature of IPCs so that the blob has already been caught.
484 // This is a separate control message, so that the renderer process will send
485 // an acknowledgement even if the RenderView has closed or navigated away.
486 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
487 std::vector
<std::string
> /* blob_uuids */)
489 // Messages sent from the renderer to the browser.
491 // A renderer sends this message when an extension process starts an API
492 // request. The browser will always respond with a ExtensionMsg_Response.
493 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
494 ExtensionHostMsg_Request_Params
)
496 // A renderer sends this message when an extension process starts an API
497 // request. The browser will always respond with a ExtensionMsg_Response.
498 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
499 int /* routing_id */,
500 ExtensionHostMsg_Request_Params
)
502 // Notify the browser that the given extension added a listener to an event.
503 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddListener
,
504 std::string
/* extension_id */,
505 std::string
/* name */)
507 // Notify the browser that the given extension removed a listener from an
509 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveListener
,
510 std::string
/* extension_id */,
511 std::string
/* name */)
513 // Notify the browser that the given extension added a listener to an event from
514 // a lazy background page.
515 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
516 std::string
/* extension_id */,
517 std::string
/* name */)
519 // Notify the browser that the given extension is no longer interested in
520 // receiving the given event from a lazy background page.
521 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
522 std::string
/* extension_id */,
523 std::string
/* name */)
525 // Notify the browser that the given extension added a listener to instances of
526 // the named event that satisfy the filter.
527 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
528 std::string
/* extension_id */,
529 std::string
/* name */,
530 base::DictionaryValue
/* filter */,
533 // Notify the browser that the given extension is no longer interested in
534 // instances of the named event that satisfy the filter.
535 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
536 std::string
/* extension_id */,
537 std::string
/* name */,
538 base::DictionaryValue
/* filter */,
541 // Notify the browser that an event has finished being dispatched.
542 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
544 // Open a channel to all listening contexts owned by the extension with
545 // the given ID. This always returns a valid port ID which can be used for
546 // sending messages. If an error occurred, the opener will be notified
548 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
549 int /* routing_id */,
550 ExtensionMsg_ExternalConnectionInfo
,
551 std::string
/* channel_name */,
552 bool /* include_tls_channel_id */,
555 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
556 int /* routing_id */,
557 std::string
/* source_extension_id */,
558 std::string
/* native_app_name */,
561 // Get a port handle to the given tab. The handle can be used for sending
562 // messages to the extension.
563 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
564 int /* routing_id */,
566 std::string
/* extension_id */,
567 std::string
/* channel_name */,
570 // Send a message to an extension process. The handle is the value returned
571 // by ViewHostMsg_OpenChannelTo*.
572 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
576 // Send a message to an extension process. The handle is the value returned
577 // by ViewHostMsg_OpenChannelTo*.
578 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
580 std::string
/* error_message */)
582 // Used to get the extension message bundle.
583 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
584 std::string
/* extension id */,
585 SubstitutionMap
/* message bundle */)
587 // Sent from the renderer to the browser to return the script running result.
589 ExtensionHostMsg_ExecuteCodeFinished
,
590 int /* request id */,
591 std::string
/* error; empty implies success */,
592 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
593 base::ListValue
/* result of the script */)
595 // Sent from the renderer to the browser to notify that content scripts are
596 // running in the renderer that the IPC originated from.
597 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
599 GURL
/* url of the _topmost_ frame */)
601 // Sent from the renderer to the browser to request permission for a script
603 // If request id is -1, this signals that the request has already ran, and this
604 // merely serves as a notification. This happens when the feature to disable
605 // scripts running without user consent is not enabled.
606 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
607 std::string
/* extension id */,
608 extensions::UserScript::InjectionType
/* script type */,
609 int64
/* request id */)
611 // Sent from the browser to the renderer in reply to a
612 // RequestScriptInjectionPermission message, granting permission for a script
614 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
615 int64
/* request id */)
617 // Sent by the renderer when a web page is checking if its app is installed.
618 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
619 GURL
/* requestor_url */,
620 int32
/* return_route_id */,
621 int32
/* callback_id */)
623 // Optional Ack message sent to the browser to notify that the response to a
624 // function has been processed.
625 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
626 int /* request_id */)
628 // Response to ExtensionMsg_ShouldSuspend.
629 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
630 std::string
/* extension_id */,
631 uint64
/* sequence_id */)
633 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
634 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
635 std::string
/* extension_id */)
637 // Informs the browser to increment the keepalive count for the lazy background
638 // page, keeping it alive.
639 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
641 // Informs the browser there is one less thing keeping the lazy background page
643 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
645 // Fetches a globally unique ID (for the lifetime of the browser) from the
647 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
650 // Resumes resource requests for a newly created app window.
651 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
653 // Sent by the renderer when the draggable regions are updated.
654 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
655 std::vector
<extensions::DraggableRegion
> /* regions */)
657 // Sent by the renderer to log an API action to the extension activity log.
658 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
659 std::string
/* extension_id */,
660 ExtensionHostMsg_APIActionOrEvent_Params
)
662 // Sent by the renderer to log an event to the extension activity log.
663 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
664 std::string
/* extension_id */,
665 ExtensionHostMsg_APIActionOrEvent_Params
)
667 // Sent by the renderer to log a DOM action to the extension activity log.
668 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
669 std::string
/* extension_id */,
670 ExtensionHostMsg_DOMAction_Params
)
672 // Notifies the browser process that a tab has started or stopped matching
673 // certain conditions. This message is sent in response to several events:
675 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
676 // * A new page is loaded. This will be sent after
677 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
679 // * Something changed on an existing frame causing the set of matching searches
681 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
682 std::vector
<std::string
> /* Matching CSS selectors */)
684 // Sent by the renderer when it has received a Blob handle from the browser.
685 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
686 std::vector
<std::string
> /* blob_uuids */)