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/stack_frame.h"
24 #include "extensions/common/url_pattern.h"
25 #include "extensions/common/url_pattern_set.h"
26 #include "extensions/common/user_script.h"
27 #include "extensions/common/view_type.h"
28 #include "ipc/ipc_message_macros.h"
29 #include "ui/gfx/ipc/gfx_param_traits.h"
32 #define IPC_MESSAGE_START ExtensionMsgStart
34 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType
, extensions::VIEW_TYPE_LAST
)
35 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType
,
36 content::SocketPermissionRequest::OPERATION_TYPE_LAST
)
38 IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType
,
39 extensions::UserScript::INJECTION_TYPE_LAST
)
41 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
42 // ExtensionHostMsg_AddEventToActivityLog.
43 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params
)
45 IPC_STRUCT_MEMBER(std::string
, api_call
)
48 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
50 // Extra logging information.
51 IPC_STRUCT_MEMBER(std::string
, extra
)
54 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
55 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params
)
57 IPC_STRUCT_MEMBER(GURL
, url
)
60 IPC_STRUCT_MEMBER(base::string16
, url_title
)
63 IPC_STRUCT_MEMBER(std::string
, api_call
)
66 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
68 // Type of DOM API call.
69 IPC_STRUCT_MEMBER(int, call_type
)
72 // Parameters structure for ExtensionHostMsg_Request.
73 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params
)
75 IPC_STRUCT_MEMBER(std::string
, name
)
77 // List of message arguments.
78 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
80 // Extension ID this request was sent from. This can be empty, in the case
81 // where we expose APIs to normal web pages using the extension function
83 IPC_STRUCT_MEMBER(std::string
, extension_id
)
85 // URL of the frame the request was sent from. This isn't necessarily an
86 // extension url. Extension requests can also originate from content scripts,
87 // in which case extension_id will indicate the ID of the associated
88 // extension. Or, they can originate from hosted apps or normal web pages.
89 IPC_STRUCT_MEMBER(GURL
, source_url
)
91 // The id of the tab that sent this request, or -1 if there is no source tab.
92 IPC_STRUCT_MEMBER(int, source_tab_id
)
94 // Unique request id to match requests and responses.
95 IPC_STRUCT_MEMBER(int, request_id
)
97 // True if request has a callback specified.
98 IPC_STRUCT_MEMBER(bool, has_callback
)
100 // True if request is executed in response to an explicit user gesture.
101 IPC_STRUCT_MEMBER(bool, user_gesture
)
104 // Allows an extension to execute code in a tab.
105 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params
)
106 // The extension API request id, for responding.
107 IPC_STRUCT_MEMBER(int, request_id
)
109 // The ID of the requesting extension. To know which isolated world to
110 // execute the code inside of.
111 IPC_STRUCT_MEMBER(std::string
, extension_id
)
113 // Whether the code is JavaScript or CSS.
114 IPC_STRUCT_MEMBER(bool, is_javascript
)
116 // String of code to execute.
117 IPC_STRUCT_MEMBER(std::string
, code
)
119 // The webview guest source who calls to execute code.
120 IPC_STRUCT_MEMBER(GURL
, webview_src
)
122 // Whether to inject into all frames, or only the root frame.
123 IPC_STRUCT_MEMBER(bool, all_frames
)
125 // Whether to inject into about:blank (sub)frames.
126 IPC_STRUCT_MEMBER(bool, match_about_blank
)
128 // When to inject the code.
129 IPC_STRUCT_MEMBER(int, run_at
)
131 // Whether to execute code in the main world (as opposed to an isolated
133 IPC_STRUCT_MEMBER(bool, in_main_world
)
135 // Whether the request is coming from a <webview>.
136 IPC_STRUCT_MEMBER(bool, is_web_view
)
138 // Whether the caller is interested in the result value. Manifest-declared
139 // content scripts and executeScript() calls without a response callback
140 // are examples of when this will be false.
141 IPC_STRUCT_MEMBER(bool, wants_result
)
143 // The URL of the file that was injected, if any.
144 IPC_STRUCT_MEMBER(GURL
, file_url
)
146 // Whether the code to be executed should be associated with a user gesture.
147 IPC_STRUCT_MEMBER(bool, user_gesture
)
150 // Struct containing the data for external connections to extensions. Used to
151 // handle the IPCs initiated by both connect() and onConnect().
152 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
153 // The ID of the extension that is the target of the request.
154 IPC_STRUCT_MEMBER(std::string
, target_id
)
156 // The ID of the extension that initiated the request. May be empty if it
157 // wasn't initiated by an extension.
158 IPC_STRUCT_MEMBER(std::string
, source_id
)
160 // The URL of the frame that initiated the request.
161 IPC_STRUCT_MEMBER(GURL
, source_url
)
164 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
165 IPC_STRUCT_TRAITS_MEMBER(draggable
)
166 IPC_STRUCT_TRAITS_MEMBER(bounds
)
167 IPC_STRUCT_TRAITS_END()
169 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
170 IPC_STRUCT_TRAITS_MEMBER(type
)
171 IPC_STRUCT_TRAITS_MEMBER(host
)
172 IPC_STRUCT_TRAITS_MEMBER(port
)
173 IPC_STRUCT_TRAITS_END()
175 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
176 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
177 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
178 IPC_STRUCT_TRAITS_END()
180 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
181 IPC_STRUCT_TRAITS_MEMBER(entry())
182 IPC_STRUCT_TRAITS_END()
184 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame
)
185 IPC_STRUCT_TRAITS_MEMBER(line_number
)
186 IPC_STRUCT_TRAITS_MEMBER(column_number
)
187 IPC_STRUCT_TRAITS_MEMBER(source
)
188 IPC_STRUCT_TRAITS_MEMBER(function
)
189 IPC_STRUCT_TRAITS_END()
191 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
192 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
193 IPC_STRUCT_TRAITS_MEMBER(product_id())
194 IPC_STRUCT_TRAITS_END()
196 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
197 IPC_STRUCT_TRAITS_MEMBER(permission())
198 IPC_STRUCT_TRAITS_END()
200 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
201 IPC_STRUCT_TRAITS_MEMBER(data
)
202 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
203 IPC_STRUCT_TRAITS_END()
205 // Singly-included section for custom IPC traits.
206 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
207 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
209 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
210 // to typedef it to avoid that.
211 // Substitution map for l10n messages.
212 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
214 // Map of extensions IDs to the executing script paths.
215 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
217 struct ExtensionMsg_PermissionSetStruct
{
218 ExtensionMsg_PermissionSetStruct();
219 explicit ExtensionMsg_PermissionSetStruct(
220 const extensions::PermissionSet
& permissions
);
221 ~ExtensionMsg_PermissionSetStruct();
223 scoped_refptr
<const extensions::PermissionSet
> ToPermissionSet() const;
225 extensions::APIPermissionSet apis
;
226 extensions::ManifestPermissionSet manifest_permissions
;
227 extensions::URLPatternSet explicit_hosts
;
228 extensions::URLPatternSet scriptable_hosts
;
231 struct ExtensionMsg_Loaded_Params
{
232 ExtensionMsg_Loaded_Params();
233 ~ExtensionMsg_Loaded_Params();
234 explicit ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
);
236 // Creates a new extension from the data in this object.
237 scoped_refptr
<extensions::Extension
> ConvertToExtension(
238 std::string
* error
) const;
240 // The subset of the extension manifest data we send to renderers.
241 linked_ptr
<base::DictionaryValue
> manifest
;
243 // The location the extension was installed from.
244 extensions::Manifest::Location location
;
246 // The path the extension was loaded from. This is used in the renderer only
247 // to generate the extension ID for extensions that are loaded unpacked.
250 // The extension's active and withheld permissions.
251 ExtensionMsg_PermissionSetStruct active_permissions
;
252 ExtensionMsg_PermissionSetStruct withheld_permissions
;
254 // We keep this separate so that it can be used in logging.
257 // Send creation flags so extension is initialized identically.
264 struct ParamTraits
<URLPattern
> {
265 typedef URLPattern 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::URLPatternSet
> {
273 typedef extensions::URLPatternSet 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::APIPermission::ID
> {
281 typedef extensions::APIPermission::ID param_type
;
282 static void Write(Message
* m
, const param_type
& p
);
283 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
284 static void Log(const param_type
& p
, std::string
* l
);
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
);
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
);
304 struct ParamTraits
<ExtensionMsg_PermissionSetStruct
> {
305 typedef ExtensionMsg_PermissionSetStruct 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
);
312 struct ParamTraits
<ExtensionMsg_Loaded_Params
> {
313 typedef ExtensionMsg_Loaded_Params param_type
;
314 static void Write(Message
* m
, const param_type
& p
);
315 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
316 static void Log(const param_type
& p
, std::string
* l
);
321 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
323 // Parameters structure for ExtensionMsg_UpdatePermissions.
324 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
325 IPC_STRUCT_MEMBER(std::string
, extension_id
)
326 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, active_permissions
)
327 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, withheld_permissions
)
330 // Messages sent from the browser to the renderer.
332 // The browser sends this message in response to all extension api calls. The
333 // response data (if any) is one of the base::Value subclasses, wrapped as the
334 // first element in a ListValue.
335 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
336 int /* request_id */,
338 base::ListValue
/* response wrapper (see comment above) */,
339 std::string
/* error */)
341 // This message is optionally routed. If used as a control message, it will
342 // call a javascript function |function_name| from module |module_name| in
343 // every registered context in the target process. If routed, it will be
344 // restricted to the contexts that are part of the target RenderView.
346 // If |extension_id| is non-empty, the function will be invoked only in
347 // contexts owned by the extension. |args| is a list of primitive Value types
348 // that are passed to the function.
349 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
350 std::string
/* extension_id */,
351 std::string
/* module_name */,
352 std::string
/* function_name */,
353 base::ListValue
/* args */,
354 bool /* delivered as part of a user gesture */)
356 // Tell the renderer process all known extension function names.
357 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
358 std::vector
<std::string
>)
360 // Set the top-level frame to the provided name.
361 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName
,
362 std::string
/* frame_name */)
364 // Tell the renderer process the platforms system font.
365 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
366 std::string
/* font_family */,
367 std::string
/* font_size */)
369 // Marks an extension as 'active' in an extension process. 'Active' extensions
370 // have more privileges than other extension content that might end up running
371 // in the process (e.g. because of iframes or content scripts).
372 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
373 std::string
/* extension_id */)
375 // Notifies the renderer that extensions were loaded in the browser.
376 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
377 std::vector
<ExtensionMsg_Loaded_Params
>)
379 // Notifies the renderer that an extension was unloaded in the browser.
380 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
383 // Updates the scripting whitelist for extensions in the render process. This is
384 // only used for testing.
385 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
387 extensions::ExtensionsClient::ScriptingWhitelist
)
389 // Notification that renderer should run some JavaScript code.
390 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
391 ExtensionMsg_ExecuteCode_Params
)
393 // Notification that the user scripts have been updated. It has one
394 // SharedMemoryHandle argument consisting of the pickled script data. This
395 // handle is valid in the context of the renderer.
396 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
397 // programmatically-defined scripts. Otherwise, the handle refers to all
398 // extensions' statically defined scripts.
399 // If |changed_extensions| is not empty, only the extensions in that set will
400 // be updated. Otherwise, all extensions that have scripts in the shared memory
401 // region will be updated. Note that the empty set => all extensions case is not
402 // supported for per-extension programmatically-defined script regions; in such
403 // regions, the owner is expected to list itself as the only changed extension.
404 IPC_MESSAGE_CONTROL3(ExtensionMsg_UpdateUserScripts
,
405 base::SharedMemoryHandle
,
406 extensions::ExtensionId
/* owner */,
407 std::set
<std::string
> /* changed extensions */)
409 // Trigger to execute declarative content script under browser control.
410 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript
,
411 int /* tab identifier */,
412 extensions::ExtensionId
/* extension identifier */,
413 int /* script identifier */,
414 GURL
/* page URL where script should be injected */)
416 // Tell the render view which browser window it's being attached to.
417 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
418 int /* id of browser window */)
420 // Tell the render view what its tab ID is.
421 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
424 // Tell the renderer to update an extension's permission set.
425 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
426 ExtensionMsg_UpdatePermissions_Params
)
428 // Tell the renderer about new tab-specific permissions for an extension.
429 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions
,
432 std::string
/* extension_id */,
433 extensions::URLPatternSet
/* hosts */)
435 // Tell the renderer to clear tab-specific permissions for some extensions.
436 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions
,
438 std::vector
<std::string
> /* extension_ids */)
440 // Tell the renderer which type this view is.
441 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
442 extensions::ViewType
/* view_type */)
444 // Deliver a message sent with ExtensionHostMsg_PostMessage.
445 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
446 bool /* webrequest_used */)
448 // Ask the lazy background page if it is ready to be suspended. This is sent
449 // when the page is considered idle. The renderer will reply with the same
450 // sequence_id so that we can tell which message it is responding to.
451 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
452 std::string
/* extension_id */,
453 uint64
/* sequence_id */)
455 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
456 // the lazy background page becoming active again, we are ready to unload. This
457 // message tells the page to dispatch the suspend event.
458 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
459 std::string
/* extension_id */)
461 // The browser changed its mind about suspending this extension.
462 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
463 std::string
/* extension_id */)
465 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
466 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
467 std::string
/* state */,
468 int32
/* callback_id */)
470 // Dispatch the Port.onConnect event for message channels.
471 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
472 int /* target_port_id */,
473 std::string
/* channel_name */,
474 base::DictionaryValue
/* source_tab */,
475 ExtensionMsg_ExternalConnectionInfo
,
476 std::string
/* tls_channel_id */)
478 // Deliver a message sent with ExtensionHostMsg_PostMessage.
479 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
480 int /* target_port_id */,
483 // Dispatch the Port.onDisconnect event for message channels.
484 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
486 std::string
/* error_message */)
488 // Informs the renderer what channel (dev, beta, stable, etc) is running.
489 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
492 // Adds a logging message to the renderer's root frame DevTools console.
493 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
494 content::ConsoleMessageLevel
/* level */,
495 std::string
/* message */)
497 // Notify the renderer that its window has closed.
498 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
500 // Notify the renderer that an extension wants notifications when certain
501 // searches match the active page. This message replaces the old set of
502 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
503 // each tab to keep the browser updated about changes.
504 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
505 std::vector
<std::string
> /* CSS selectors */)
507 // Send by the browser to indicate a Blob handle has been transferred to the
508 // renderer. This is sent after the actual extension response, and depends on
509 // the sequential nature of IPCs so that the blob has already been caught.
510 // This is a separate control message, so that the renderer process will send
511 // an acknowledgement even if the RenderView has closed or navigated away.
512 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
513 std::vector
<std::string
> /* blob_uuids */)
515 // The ACK for ExtensionHostMsg_CreateMimeHandlerViewGuest.
516 IPC_MESSAGE_CONTROL1(ExtensionMsg_CreateMimeHandlerViewGuestACK
,
517 int /* element_instance_id */)
519 // Messages sent from the renderer to the browser.
521 // A renderer sends this message when an extension process starts an API
522 // request. The browser will always respond with a ExtensionMsg_Response.
523 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
524 ExtensionHostMsg_Request_Params
)
526 // A renderer sends this message when an extension process starts an API
527 // request. The browser will always respond with a ExtensionMsg_Response.
528 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
529 int /* routing_id */,
530 ExtensionHostMsg_Request_Params
)
532 // Notify the browser that the given extension added a listener to an event.
533 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener
,
534 std::string
/* extension_id */,
535 GURL
/* listener_url */,
536 std::string
/* name */)
538 // Notify the browser that the given extension removed a listener from an
540 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener
,
541 std::string
/* extension_id */,
542 GURL
/* listener_url */,
543 std::string
/* name */)
545 // Notify the browser that the given extension added a listener to an event from
546 // a lazy background page.
547 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
548 std::string
/* extension_id */,
549 std::string
/* name */)
551 // Notify the browser that the given extension is no longer interested in
552 // receiving the given event from a lazy background page.
553 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
554 std::string
/* extension_id */,
555 std::string
/* name */)
557 // Notify the browser that the given extension added a listener to instances of
558 // the named event that satisfy the filter.
559 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
560 std::string
/* extension_id */,
561 std::string
/* name */,
562 base::DictionaryValue
/* filter */,
565 // Notify the browser that the given extension is no longer interested in
566 // instances of the named event that satisfy the filter.
567 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
568 std::string
/* extension_id */,
569 std::string
/* name */,
570 base::DictionaryValue
/* filter */,
573 // Notify the browser that an event has finished being dispatched.
574 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
576 // Open a channel to all listening contexts owned by the extension with
577 // the given ID. This always returns a valid port ID which can be used for
578 // sending messages. If an error occurred, the opener will be notified
580 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
581 int /* routing_id */,
582 ExtensionMsg_ExternalConnectionInfo
,
583 std::string
/* channel_name */,
584 bool /* include_tls_channel_id */,
587 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
588 int /* routing_id */,
589 std::string
/* source_extension_id */,
590 std::string
/* native_app_name */,
593 // Get a port handle to the given tab. The handle can be used for sending
594 // messages to the extension.
595 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
596 int /* routing_id */,
598 std::string
/* extension_id */,
599 std::string
/* channel_name */,
602 // Send a message to an extension process. The handle is the value returned
603 // by ViewHostMsg_OpenChannelTo*.
604 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
608 // Send a message to an extension process. The handle is the value returned
609 // by ViewHostMsg_OpenChannelTo*.
610 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
612 std::string
/* error_message */)
614 // Used to get the extension message bundle.
615 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
616 std::string
/* extension id */,
617 SubstitutionMap
/* message bundle */)
619 // Sent from the renderer to the browser to return the script running result.
621 ExtensionHostMsg_ExecuteCodeFinished
,
622 int /* request id */,
623 std::string
/* error; empty implies success */,
624 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
625 base::ListValue
/* result of the script */)
627 // Sent from the renderer to the browser to notify that content scripts are
628 // running in the renderer that the IPC originated from.
629 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
631 GURL
/* url of the _topmost_ frame */)
633 // Sent from the renderer to the browser to request permission for a script
635 // If request id is -1, this signals that the request has already ran, and this
636 // merely serves as a notification. This happens when the feature to disable
637 // scripts running without user consent is not enabled.
638 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
639 std::string
/* extension id */,
640 extensions::UserScript::InjectionType
/* script type */,
641 int64
/* request id */)
643 // Sent from the browser to the renderer in reply to a
644 // RequestScriptInjectionPermission message, granting permission for a script
646 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
647 int64
/* request id */)
649 // Sent by the renderer when a web page is checking if its app is installed.
650 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
651 GURL
/* requestor_url */,
652 int32
/* return_route_id */,
653 int32
/* callback_id */)
655 // Optional Ack message sent to the browser to notify that the response to a
656 // function has been processed.
657 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
658 int /* request_id */)
660 // Response to ExtensionMsg_ShouldSuspend.
661 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
662 std::string
/* extension_id */,
663 uint64
/* sequence_id */)
665 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
666 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
667 std::string
/* extension_id */)
669 // Informs the browser to increment the keepalive count for the lazy background
670 // page, keeping it alive.
671 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
673 // Informs the browser there is one less thing keeping the lazy background page
675 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
677 // Fetches a globally unique ID (for the lifetime of the browser) from the
679 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
682 // Resumes resource requests for a newly created app window.
683 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
685 // Sent by the renderer when the draggable regions are updated.
686 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
687 std::vector
<extensions::DraggableRegion
> /* regions */)
689 // Sent by the renderer to log an API action to the extension activity log.
690 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
691 std::string
/* extension_id */,
692 ExtensionHostMsg_APIActionOrEvent_Params
)
694 // Sent by the renderer to log an event to the extension activity log.
695 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
696 std::string
/* extension_id */,
697 ExtensionHostMsg_APIActionOrEvent_Params
)
699 // Sent by the renderer to log a DOM action to the extension activity log.
700 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
701 std::string
/* extension_id */,
702 ExtensionHostMsg_DOMAction_Params
)
704 // Notifies the browser process that a tab has started or stopped matching
705 // certain conditions. This message is sent in response to several events:
707 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
708 // * A new page is loaded. This will be sent after
709 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
711 // * Something changed on an existing frame causing the set of matching searches
713 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
714 std::vector
<std::string
> /* Matching CSS selectors */)
716 // Sent by the renderer when it has received a Blob handle from the browser.
717 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
718 std::vector
<std::string
> /* blob_uuids */)
720 // Informs of updated frame names.
721 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_FrameNameChanged
,
722 bool /* is_top_level */,
723 std::string
/* name */)
725 // Tells listeners that a detailed message was reported to the console by
727 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded
,
728 base::string16
/* message */,
729 base::string16
/* source */,
730 extensions::StackTrace
/* stack trace */,
731 int32
/* severity level */)
733 // Sent by the renderer to set initialization parameters of a Browser Plugin
734 // that is identified by |element_instance_id|.
735 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AttachGuest
,
736 int /* routing_id */,
737 int /* element_instance_id */,
738 int /* guest_instance_id */,
739 base::DictionaryValue
/* attach_params */)
741 // Tells the browser to create a mime handler guest view for a plugin.
742 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_CreateMimeHandlerViewGuest
,
743 int /* render_frame_id */,
744 std::string
/* embedder_url */,
745 std::string
/* mime_type */,
746 int /* element_instance_id */)