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/host_id.h"
20 #include "extensions/common/permissions/media_galleries_permission_data.h"
21 #include "extensions/common/permissions/permission_set.h"
22 #include "extensions/common/permissions/socket_permission_data.h"
23 #include "extensions/common/permissions/usb_device_permission_data.h"
24 #include "extensions/common/stack_frame.h"
25 #include "extensions/common/url_pattern.h"
26 #include "extensions/common/url_pattern_set.h"
27 #include "extensions/common/user_script.h"
28 #include "extensions/common/view_type.h"
29 #include "ipc/ipc_message_macros.h"
30 #include "ui/gfx/ipc/gfx_param_traits.h"
33 #define IPC_MESSAGE_START ExtensionMsgStart
35 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType
, extensions::VIEW_TYPE_LAST
)
36 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType
,
37 content::SocketPermissionRequest::OPERATION_TYPE_LAST
)
39 IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType
,
40 extensions::UserScript::INJECTION_TYPE_LAST
)
42 IPC_ENUM_TRAITS_MAX_VALUE(HostID::HostType
, HostID::HOST_TYPE_LAST
)
44 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
45 // ExtensionHostMsg_AddEventToActivityLog.
46 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params
)
48 IPC_STRUCT_MEMBER(std::string
, api_call
)
51 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
53 // Extra logging information.
54 IPC_STRUCT_MEMBER(std::string
, extra
)
57 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
58 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params
)
60 IPC_STRUCT_MEMBER(GURL
, url
)
63 IPC_STRUCT_MEMBER(base::string16
, url_title
)
66 IPC_STRUCT_MEMBER(std::string
, api_call
)
69 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
71 // Type of DOM API call.
72 IPC_STRUCT_MEMBER(int, call_type
)
75 // Parameters structure for ExtensionHostMsg_Request.
76 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params
)
78 IPC_STRUCT_MEMBER(std::string
, name
)
80 // List of message arguments.
81 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
83 // Extension ID this request was sent from. This can be empty, in the case
84 // where we expose APIs to normal web pages using the extension function
86 IPC_STRUCT_MEMBER(std::string
, extension_id
)
88 // URL of the frame the request was sent from. This isn't necessarily an
89 // extension url. Extension requests can also originate from content scripts,
90 // in which case extension_id will indicate the ID of the associated
91 // extension. Or, they can originate from hosted apps or normal web pages.
92 IPC_STRUCT_MEMBER(GURL
, source_url
)
94 // The id of the tab that sent this request, or -1 if there is no source tab.
95 IPC_STRUCT_MEMBER(int, source_tab_id
)
97 // Unique request id to match requests and responses.
98 IPC_STRUCT_MEMBER(int, request_id
)
100 // True if request has a callback specified.
101 IPC_STRUCT_MEMBER(bool, has_callback
)
103 // True if request is executed in response to an explicit user gesture.
104 IPC_STRUCT_MEMBER(bool, user_gesture
)
107 // Allows an extension to execute code in a tab.
108 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params
)
109 // The extension API request id, for responding.
110 IPC_STRUCT_MEMBER(int, request_id
)
112 // The ID of the requesting injection host.
113 IPC_STRUCT_MEMBER(HostID
, host_id
)
115 // Whether the code is JavaScript or CSS.
116 IPC_STRUCT_MEMBER(bool, is_javascript
)
118 // String of code to execute.
119 IPC_STRUCT_MEMBER(std::string
, code
)
121 // The webview guest source who calls to execute code.
122 IPC_STRUCT_MEMBER(GURL
, webview_src
)
124 // Whether to inject into all frames, or only the root frame.
125 IPC_STRUCT_MEMBER(bool, all_frames
)
127 // Whether to inject into about:blank (sub)frames.
128 IPC_STRUCT_MEMBER(bool, match_about_blank
)
130 // When to inject the code.
131 IPC_STRUCT_MEMBER(int, run_at
)
133 // Whether to execute code in the main world (as opposed to an isolated
135 IPC_STRUCT_MEMBER(bool, in_main_world
)
137 // Whether the request is coming from a <webview>.
138 IPC_STRUCT_MEMBER(bool, is_web_view
)
140 // Whether the caller is interested in the result value. Manifest-declared
141 // content scripts and executeScript() calls without a response callback
142 // are examples of when this will be false.
143 IPC_STRUCT_MEMBER(bool, wants_result
)
145 // The URL of the file that was injected, if any.
146 IPC_STRUCT_MEMBER(GURL
, file_url
)
148 // Whether the code to be executed should be associated with a user gesture.
149 IPC_STRUCT_MEMBER(bool, user_gesture
)
152 // Struct containing information about the sender of connect() calls that
153 // originate from a tab.
154 IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo
)
155 // The tab from where the connection was created.
156 IPC_STRUCT_MEMBER(base::DictionaryValue
, tab
)
158 // The ID of the frame that initiated the connection.
159 // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
160 IPC_STRUCT_MEMBER(int, frame_id
)
163 // Struct containing information about the destination of tab.connect().
164 IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo
)
165 // The destination tab's ID.
166 IPC_STRUCT_MEMBER(int, tab_id
)
168 // Frame ID of the destination. -1 for all frames, 0 for main frame and
169 // positive if the destination is a specific child frame.
170 IPC_STRUCT_MEMBER(int, frame_id
)
173 // Struct containing the data for external connections to extensions. Used to
174 // handle the IPCs initiated by both connect() and onConnect().
175 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
176 // The ID of the extension that is the target of the request.
177 IPC_STRUCT_MEMBER(std::string
, target_id
)
179 // The ID of the extension that initiated the request. May be empty if it
180 // wasn't initiated by an extension.
181 IPC_STRUCT_MEMBER(std::string
, source_id
)
183 // The URL of the frame that initiated the request.
184 IPC_STRUCT_MEMBER(GURL
, source_url
)
186 // The ID of the frame that is the target of the request.
187 IPC_STRUCT_MEMBER(int, target_frame_id
)
189 // The process ID of the webview that initiated the request.
190 IPC_STRUCT_MEMBER(int, guest_process_id
)
193 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
194 IPC_STRUCT_TRAITS_MEMBER(draggable
)
195 IPC_STRUCT_TRAITS_MEMBER(bounds
)
196 IPC_STRUCT_TRAITS_END()
198 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
199 IPC_STRUCT_TRAITS_MEMBER(type
)
200 IPC_STRUCT_TRAITS_MEMBER(host
)
201 IPC_STRUCT_TRAITS_MEMBER(port
)
202 IPC_STRUCT_TRAITS_END()
204 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
205 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
206 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
207 IPC_STRUCT_TRAITS_END()
209 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
210 IPC_STRUCT_TRAITS_MEMBER(entry())
211 IPC_STRUCT_TRAITS_END()
213 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame
)
214 IPC_STRUCT_TRAITS_MEMBER(line_number
)
215 IPC_STRUCT_TRAITS_MEMBER(column_number
)
216 IPC_STRUCT_TRAITS_MEMBER(source
)
217 IPC_STRUCT_TRAITS_MEMBER(function
)
218 IPC_STRUCT_TRAITS_END()
220 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
221 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
222 IPC_STRUCT_TRAITS_MEMBER(product_id())
223 IPC_STRUCT_TRAITS_END()
225 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
226 IPC_STRUCT_TRAITS_MEMBER(permission())
227 IPC_STRUCT_TRAITS_END()
229 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
230 IPC_STRUCT_TRAITS_MEMBER(data
)
231 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
232 IPC_STRUCT_TRAITS_END()
234 // Singly-included section for custom IPC traits.
235 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
236 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
238 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
239 // to typedef it to avoid that.
240 // Substitution map for l10n messages.
241 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
243 // Map of extensions IDs to the executing script paths.
244 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
246 struct ExtensionMsg_PermissionSetStruct
{
247 ExtensionMsg_PermissionSetStruct();
248 explicit ExtensionMsg_PermissionSetStruct(
249 const extensions::PermissionSet
& permissions
);
250 ~ExtensionMsg_PermissionSetStruct();
252 scoped_refptr
<const extensions::PermissionSet
> ToPermissionSet() const;
254 extensions::APIPermissionSet apis
;
255 extensions::ManifestPermissionSet manifest_permissions
;
256 extensions::URLPatternSet explicit_hosts
;
257 extensions::URLPatternSet scriptable_hosts
;
260 struct ExtensionMsg_Loaded_Params
{
261 ExtensionMsg_Loaded_Params();
262 ~ExtensionMsg_Loaded_Params();
263 ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
,
264 bool include_tab_permissions
);
266 // Creates a new extension from the data in this object.
267 scoped_refptr
<extensions::Extension
> ConvertToExtension(
268 std::string
* error
) const;
270 // The subset of the extension manifest data we send to renderers.
271 linked_ptr
<base::DictionaryValue
> manifest
;
273 // The location the extension was installed from.
274 extensions::Manifest::Location location
;
276 // The path the extension was loaded from. This is used in the renderer only
277 // to generate the extension ID for extensions that are loaded unpacked.
280 // The extension's active and withheld permissions.
281 ExtensionMsg_PermissionSetStruct active_permissions
;
282 ExtensionMsg_PermissionSetStruct withheld_permissions
;
283 std::map
<int, ExtensionMsg_PermissionSetStruct
> tab_specific_permissions
;
285 // We keep this separate so that it can be used in logging.
288 // Send creation flags so extension is initialized identically.
292 struct ExtensionHostMsg_AutomationQuerySelector_Error
{
293 enum Value
{ kNone
, kNoMainFrame
, kNoDocument
, kNodeDestroyed
};
295 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone
) {}
303 struct ParamTraits
<URLPattern
> {
304 typedef URLPattern param_type
;
305 static void Write(Message
* m
, const param_type
& p
);
306 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
307 static void Log(const param_type
& p
, std::string
* l
);
311 struct ParamTraits
<extensions::URLPatternSet
> {
312 typedef extensions::URLPatternSet param_type
;
313 static void Write(Message
* m
, const param_type
& p
);
314 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
315 static void Log(const param_type
& p
, std::string
* l
);
319 struct ParamTraits
<extensions::APIPermission::ID
> {
320 typedef extensions::APIPermission::ID param_type
;
321 static void Write(Message
* m
, const param_type
& p
);
322 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
323 static void Log(const param_type
& p
, std::string
* l
);
327 struct ParamTraits
<extensions::APIPermissionSet
> {
328 typedef extensions::APIPermissionSet param_type
;
329 static void Write(Message
* m
, const param_type
& p
);
330 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
331 static void Log(const param_type
& p
, std::string
* l
);
335 struct ParamTraits
<extensions::ManifestPermissionSet
> {
336 typedef extensions::ManifestPermissionSet param_type
;
337 static void Write(Message
* m
, const param_type
& p
);
338 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
339 static void Log(const param_type
& p
, std::string
* l
);
343 struct ParamTraits
<HostID
> {
344 typedef HostID param_type
;
345 static void Write(Message
* m
, const param_type
& p
);
346 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
347 static void Log(const param_type
& p
, std::string
* l
);
351 struct ParamTraits
<ExtensionMsg_PermissionSetStruct
> {
352 typedef ExtensionMsg_PermissionSetStruct param_type
;
353 static void Write(Message
* m
, const param_type
& p
);
354 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
355 static void Log(const param_type
& p
, std::string
* l
);
359 struct ParamTraits
<ExtensionMsg_Loaded_Params
> {
360 typedef ExtensionMsg_Loaded_Params param_type
;
361 static void Write(Message
* m
, const param_type
& p
);
362 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
363 static void Log(const param_type
& p
, std::string
* l
);
368 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
370 IPC_ENUM_TRAITS_MAX_VALUE(
371 ExtensionHostMsg_AutomationQuerySelector_Error::Value
,
372 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed
)
374 IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error
)
375 IPC_STRUCT_TRAITS_MEMBER(value
)
376 IPC_STRUCT_TRAITS_END()
378 // Parameters structure for ExtensionMsg_UpdatePermissions.
379 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
380 IPC_STRUCT_MEMBER(std::string
, extension_id
)
381 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, active_permissions
)
382 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, withheld_permissions
)
385 // Messages sent from the browser to the renderer.
387 // The browser sends this message in response to all extension api calls. The
388 // response data (if any) is one of the base::Value subclasses, wrapped as the
389 // first element in a ListValue.
390 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
391 int /* request_id */,
393 base::ListValue
/* response wrapper (see comment above) */,
394 std::string
/* error */)
396 // This message is optionally routed. If used as a control message, it will
397 // call a javascript function |function_name| from module |module_name| in
398 // every registered context in the target process. If routed, it will be
399 // restricted to the contexts that are part of the target RenderView.
401 // If |extension_id| is non-empty, the function will be invoked only in
402 // contexts owned by the extension. |args| is a list of primitive Value types
403 // that are passed to the function.
404 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
405 std::string
/* extension_id */,
406 std::string
/* module_name */,
407 std::string
/* function_name */,
408 base::ListValue
/* args */,
409 bool /* delivered as part of a user gesture */)
411 // Tell the renderer process all known extension function names.
412 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
413 std::vector
<std::string
>)
415 // Set the top-level frame to the provided name.
416 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName
,
417 std::string
/* frame_name */)
419 // Tell the renderer process the platforms system font.
420 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
421 std::string
/* font_family */,
422 std::string
/* font_size */)
424 // Marks an extension as 'active' in an extension process. 'Active' extensions
425 // have more privileges than other extension content that might end up running
426 // in the process (e.g. because of iframes or content scripts).
427 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
428 std::string
/* extension_id */)
430 // Notifies the renderer that extensions were loaded in the browser.
431 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
432 std::vector
<ExtensionMsg_Loaded_Params
>)
434 // Notifies the renderer that an extension was unloaded in the browser.
435 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
438 // Updates the scripting whitelist for extensions in the render process. This is
439 // only used for testing.
440 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
442 extensions::ExtensionsClient::ScriptingWhitelist
)
444 // Notification that renderer should run some JavaScript code.
445 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
446 ExtensionMsg_ExecuteCode_Params
)
448 // Notification that the user scripts have been updated. It has one
449 // SharedMemoryHandle argument consisting of the pickled script data. This
450 // handle is valid in the context of the renderer.
451 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
452 // programmatically-defined scripts. Otherwise, the handle refers to all
453 // hosts' statically defined scripts. So far, only extension-hosts support
454 // statically defined scripts; WebUI-hosts don't.
455 // If |changed_hosts| is not empty, only the host in that set will
456 // be updated. Otherwise, all hosts that have scripts in the shared memory
457 // region will be updated. Note that the empty set => all hosts case is not
458 // supported for per-extension programmatically-defined script regions; in such
459 // regions, the owner is expected to list itself as the only changed host.
460 IPC_MESSAGE_CONTROL3(ExtensionMsg_UpdateUserScripts
,
461 base::SharedMemoryHandle
,
463 std::set
<HostID
> /* changed hosts */)
465 // Trigger to execute declarative content script under browser control.
466 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript
,
467 int /* tab identifier */,
468 extensions::ExtensionId
/* extension identifier */,
469 int /* script identifier */,
470 GURL
/* page URL where script should be injected */)
472 // Tell the render view which browser window it's being attached to.
473 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
474 int /* id of browser window */)
476 // Tell the render view what its tab ID is.
477 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
480 // Tell the renderer to update an extension's permission set.
481 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
482 ExtensionMsg_UpdatePermissions_Params
)
484 // Tell the render view about new tab-specific permissions for an extension.
485 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdateTabSpecificPermissions
,
487 std::string
/* extension_id */,
488 extensions::URLPatternSet
/* hosts */,
489 bool /* update origin whitelist */,
492 // Tell the render view to clear tab-specific permissions for some extensions.
493 IPC_MESSAGE_CONTROL3(ExtensionMsg_ClearTabSpecificPermissions
,
494 std::vector
<std::string
> /* extension_ids */,
495 bool /* update origin whitelist */,
498 // Tell the renderer which type this view is.
499 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
500 extensions::ViewType
/* view_type */)
502 // Deliver a message sent with ExtensionHostMsg_PostMessage.
503 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
504 bool /* webrequest_used */)
506 // Ask the lazy background page if it is ready to be suspended. This is sent
507 // when the page is considered idle. The renderer will reply with the same
508 // sequence_id so that we can tell which message it is responding to.
509 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
510 std::string
/* extension_id */,
511 uint64
/* sequence_id */)
513 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
514 // the lazy background page becoming active again, we are ready to unload. This
515 // message tells the page to dispatch the suspend event.
516 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
517 std::string
/* extension_id */)
519 // The browser changed its mind about suspending this extension.
520 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
521 std::string
/* extension_id */)
523 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
524 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
525 std::string
/* state */,
526 int32
/* callback_id */)
528 // Dispatch the Port.onConnect event for message channels.
529 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
530 int /* target_port_id */,
531 std::string
/* channel_name */,
532 ExtensionMsg_TabConnectionInfo
/* source */,
533 ExtensionMsg_ExternalConnectionInfo
,
534 std::string
/* tls_channel_id */)
536 // Deliver a message sent with ExtensionHostMsg_PostMessage.
537 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
538 int /* target_port_id */,
541 // Dispatch the Port.onDisconnect event for message channels.
542 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
544 std::string
/* error_message */)
546 // Informs the renderer what channel (dev, beta, stable, etc) is running.
547 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
550 // Adds a logging message to the renderer's root frame DevTools console.
551 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
552 content::ConsoleMessageLevel
/* level */,
553 std::string
/* message */)
555 // Notify the renderer that its window has closed.
556 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
558 // Notify the renderer that an extension wants notifications when certain
559 // searches match the active page. This message replaces the old set of
560 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
561 // each tab to keep the browser updated about changes.
562 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
563 std::vector
<std::string
> /* CSS selectors */)
565 // Send by the browser to indicate a Blob handle has been transferred to the
566 // renderer. This is sent after the actual extension response, and depends on
567 // the sequential nature of IPCs so that the blob has already been caught.
568 // This is a separate control message, so that the renderer process will send
569 // an acknowledgement even if the RenderView has closed or navigated away.
570 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
571 std::vector
<std::string
> /* blob_uuids */)
573 // Messages sent from the renderer to the browser.
575 // A renderer sends this message when an extension process starts an API
576 // request. The browser will always respond with a ExtensionMsg_Response.
577 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
578 ExtensionHostMsg_Request_Params
)
580 // A renderer sends this message when an extension process starts an API
581 // request. The browser will always respond with a ExtensionMsg_Response.
582 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
583 int /* routing_id */,
584 ExtensionHostMsg_Request_Params
)
586 // Notify the browser that the given extension added a listener to an event.
587 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener
,
588 std::string
/* extension_id */,
589 GURL
/* listener_url */,
590 std::string
/* name */)
592 // Notify the browser that the given extension removed a listener from an
594 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener
,
595 std::string
/* extension_id */,
596 GURL
/* listener_url */,
597 std::string
/* name */)
599 // Notify the browser that the given extension added a listener to an event from
600 // a lazy background page.
601 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
602 std::string
/* extension_id */,
603 std::string
/* name */)
605 // Notify the browser that the given extension is no longer interested in
606 // receiving the given event from a lazy background page.
607 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
608 std::string
/* extension_id */,
609 std::string
/* name */)
611 // Notify the browser that the given extension added a listener to instances of
612 // the named event that satisfy the filter.
613 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
614 std::string
/* extension_id */,
615 std::string
/* name */,
616 base::DictionaryValue
/* filter */,
619 // Notify the browser that the given extension is no longer interested in
620 // instances of the named event that satisfy the filter.
621 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
622 std::string
/* extension_id */,
623 std::string
/* name */,
624 base::DictionaryValue
/* filter */,
627 // Notify the browser that an event has finished being dispatched.
628 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck
, int /* message_id */)
630 // Open a channel to all listening contexts owned by the extension with
631 // the given ID. This always returns a valid port ID which can be used for
632 // sending messages. If an error occurred, the opener will be notified
634 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
635 int /* routing_id */,
636 ExtensionMsg_ExternalConnectionInfo
,
637 std::string
/* channel_name */,
638 bool /* include_tls_channel_id */,
641 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
642 int /* routing_id */,
643 std::string
/* source_extension_id */,
644 std::string
/* native_app_name */,
647 // Get a port handle to the given tab. The handle can be used for sending
648 // messages to the extension.
649 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
650 int /* routing_id */,
651 ExtensionMsg_TabTargetConnectionInfo
,
652 std::string
/* extension_id */,
653 std::string
/* channel_name */,
656 // Send a message to an extension process. The handle is the value returned
657 // by ViewHostMsg_OpenChannelTo*.
658 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
662 // Send a message to an extension process. The handle is the value returned
663 // by ViewHostMsg_OpenChannelTo*.
664 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
666 std::string
/* error_message */)
668 // Used to get the extension message bundle.
669 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
670 std::string
/* extension id */,
671 SubstitutionMap
/* message bundle */)
673 // Sent from the renderer to the browser to return the script running result.
675 ExtensionHostMsg_ExecuteCodeFinished
,
676 int /* request id */,
677 std::string
/* error; empty implies success */,
678 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
679 base::ListValue
/* result of the script */)
681 // Sent from the renderer to the browser to notify that content scripts are
682 // running in the renderer that the IPC originated from.
683 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
685 GURL
/* url of the _topmost_ frame */)
687 // Sent from the renderer to the browser to request permission for a script
689 // If request id is -1, this signals that the request has already ran, and this
690 // merely serves as a notification. This happens when the feature to disable
691 // scripts running without user consent is not enabled.
692 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
693 std::string
/* extension id */,
694 extensions::UserScript::InjectionType
/* script type */,
695 int64
/* request id */)
697 // Sent from the browser to the renderer in reply to a
698 // RequestScriptInjectionPermission message, granting permission for a script
700 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
701 int64
/* request id */)
703 // Sent by the renderer when a web page is checking if its app is installed.
704 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
705 GURL
/* requestor_url */,
706 int32
/* return_route_id */,
707 int32
/* callback_id */)
709 // Optional Ack message sent to the browser to notify that the response to a
710 // function has been processed.
711 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
712 int /* request_id */)
714 // Response to ExtensionMsg_ShouldSuspend.
715 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
716 std::string
/* extension_id */,
717 uint64
/* sequence_id */)
719 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
720 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
721 std::string
/* extension_id */)
723 // Informs the browser to increment the keepalive count for the lazy background
724 // page, keeping it alive.
725 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
727 // Informs the browser there is one less thing keeping the lazy background page
729 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
731 // Fetches a globally unique ID (for the lifetime of the browser) from the
733 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
736 // Resumes resource requests for a newly created app window.
737 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
739 // Sent by the renderer when the draggable regions are updated.
740 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
741 std::vector
<extensions::DraggableRegion
> /* regions */)
743 // Sent by the renderer to log an API action to the extension activity log.
744 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
745 std::string
/* extension_id */,
746 ExtensionHostMsg_APIActionOrEvent_Params
)
748 // Sent by the renderer to log an event to the extension activity log.
749 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
750 std::string
/* extension_id */,
751 ExtensionHostMsg_APIActionOrEvent_Params
)
753 // Sent by the renderer to log a DOM action to the extension activity log.
754 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
755 std::string
/* extension_id */,
756 ExtensionHostMsg_DOMAction_Params
)
758 // Notifies the browser process that a tab has started or stopped matching
759 // certain conditions. This message is sent in response to several events:
761 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
762 // * A new page is loaded. This will be sent after
763 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
765 // * Something changed on an existing frame causing the set of matching searches
767 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
768 std::vector
<std::string
> /* Matching CSS selectors */)
770 // Sent by the renderer when it has received a Blob handle from the browser.
771 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
772 std::vector
<std::string
> /* blob_uuids */)
774 // Tells listeners that a detailed message was reported to the console by
776 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded
,
777 base::string16
/* message */,
778 base::string16
/* source */,
779 extensions::StackTrace
/* stack trace */,
780 int32
/* severity level */)
782 // Sent when a query selector request is made from the automation API.
783 // acc_obj_id is the accessibility tree ID of the starting element.
784 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector
,
785 int /* request_id */,
786 int /* acc_obj_id */,
787 base::string16
/* selector */)
789 // Result of a query selector request.
790 // result_acc_obj_id is the accessibility tree ID of the result element; 0
791 // indicates no result.
792 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result
,
793 int /* request_id */,
794 ExtensionHostMsg_AutomationQuerySelector_Error
/* error */,
795 int /* result_acc_obj_id */)