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 // Tell the render view which browser window it's being attached to.
410 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
411 int /* id of browser window */)
413 // Tell the render view what its tab ID is.
414 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
417 // Tell the renderer to update an extension's permission set.
418 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
419 ExtensionMsg_UpdatePermissions_Params
)
421 // Tell the renderer about new tab-specific permissions for an extension.
422 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions
,
425 std::string
/* extension_id */,
426 extensions::URLPatternSet
/* hosts */)
428 // Tell the renderer to clear tab-specific permissions for some extensions.
429 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions
,
431 std::vector
<std::string
> /* extension_ids */)
433 // Tell the renderer which type this view is.
434 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
435 extensions::ViewType
/* view_type */)
437 // Deliver a message sent with ExtensionHostMsg_PostMessage.
438 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
439 bool /* webrequest_used */)
441 // Ask the lazy background page if it is ready to be suspended. This is sent
442 // when the page is considered idle. The renderer will reply with the same
443 // sequence_id so that we can tell which message it is responding to.
444 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
445 std::string
/* extension_id */,
446 uint64
/* sequence_id */)
448 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
449 // the lazy background page becoming active again, we are ready to unload. This
450 // message tells the page to dispatch the suspend event.
451 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
452 std::string
/* extension_id */)
454 // The browser changed its mind about suspending this extension.
455 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
456 std::string
/* extension_id */)
458 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
459 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
460 std::string
/* state */,
461 int32
/* callback_id */)
463 // Dispatch the Port.onConnect event for message channels.
464 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
465 int /* target_port_id */,
466 std::string
/* channel_name */,
467 base::DictionaryValue
/* source_tab */,
468 ExtensionMsg_ExternalConnectionInfo
,
469 std::string
/* tls_channel_id */)
471 // Deliver a message sent with ExtensionHostMsg_PostMessage.
472 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
473 int /* target_port_id */,
476 // Dispatch the Port.onDisconnect event for message channels.
477 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
479 std::string
/* error_message */)
481 // Informs the renderer what channel (dev, beta, stable, etc) is running.
482 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
485 // Adds a logging message to the renderer's root frame DevTools console.
486 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
487 content::ConsoleMessageLevel
/* level */,
488 std::string
/* message */)
490 // Notify the renderer that its window has closed.
491 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
493 // Notify the renderer that an extension wants notifications when certain
494 // searches match the active page. This message replaces the old set of
495 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
496 // each tab to keep the browser updated about changes.
497 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
498 std::vector
<std::string
> /* CSS selectors */)
500 // Send by the browser to indicate a Blob handle has been transferred to the
501 // renderer. This is sent after the actual extension response, and depends on
502 // the sequential nature of IPCs so that the blob has already been caught.
503 // This is a separate control message, so that the renderer process will send
504 // an acknowledgement even if the RenderView has closed or navigated away.
505 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
506 std::vector
<std::string
> /* blob_uuids */)
508 // Messages sent from the renderer to the browser.
510 // A renderer sends this message when an extension process starts an API
511 // request. The browser will always respond with a ExtensionMsg_Response.
512 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
513 ExtensionHostMsg_Request_Params
)
515 // A renderer sends this message when an extension process starts an API
516 // request. The browser will always respond with a ExtensionMsg_Response.
517 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
518 int /* routing_id */,
519 ExtensionHostMsg_Request_Params
)
521 // Notify the browser that the given extension added a listener to an event.
522 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener
,
523 std::string
/* extension_id */,
524 GURL
/* listener_url */,
525 std::string
/* name */)
527 // Notify the browser that the given extension removed a listener from an
529 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener
,
530 std::string
/* extension_id */,
531 GURL
/* listener_url */,
532 std::string
/* name */)
534 // Notify the browser that the given extension added a listener to an event from
535 // a lazy background page.
536 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
537 std::string
/* extension_id */,
538 std::string
/* name */)
540 // Notify the browser that the given extension is no longer interested in
541 // receiving the given event from a lazy background page.
542 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
543 std::string
/* extension_id */,
544 std::string
/* name */)
546 // Notify the browser that the given extension added a listener to instances of
547 // the named event that satisfy the filter.
548 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
549 std::string
/* extension_id */,
550 std::string
/* name */,
551 base::DictionaryValue
/* filter */,
554 // Notify the browser that the given extension is no longer interested in
555 // instances of the named event that satisfy the filter.
556 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
557 std::string
/* extension_id */,
558 std::string
/* name */,
559 base::DictionaryValue
/* filter */,
562 // Notify the browser that an event has finished being dispatched.
563 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
565 // Open a channel to all listening contexts owned by the extension with
566 // the given ID. This always returns a valid port ID which can be used for
567 // sending messages. If an error occurred, the opener will be notified
569 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
570 int /* routing_id */,
571 ExtensionMsg_ExternalConnectionInfo
,
572 std::string
/* channel_name */,
573 bool /* include_tls_channel_id */,
576 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
577 int /* routing_id */,
578 std::string
/* source_extension_id */,
579 std::string
/* native_app_name */,
582 // Get a port handle to the given tab. The handle can be used for sending
583 // messages to the extension.
584 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
585 int /* routing_id */,
587 std::string
/* extension_id */,
588 std::string
/* channel_name */,
591 // Send a message to an extension process. The handle is the value returned
592 // by ViewHostMsg_OpenChannelTo*.
593 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
597 // Send a message to an extension process. The handle is the value returned
598 // by ViewHostMsg_OpenChannelTo*.
599 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
601 std::string
/* error_message */)
603 // Used to get the extension message bundle.
604 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
605 std::string
/* extension id */,
606 SubstitutionMap
/* message bundle */)
608 // Sent from the renderer to the browser to return the script running result.
610 ExtensionHostMsg_ExecuteCodeFinished
,
611 int /* request id */,
612 std::string
/* error; empty implies success */,
613 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
614 base::ListValue
/* result of the script */)
616 // Sent from the renderer to the browser to notify that content scripts are
617 // running in the renderer that the IPC originated from.
618 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
620 GURL
/* url of the _topmost_ frame */)
622 // Sent from the renderer to the browser to request permission for a script
624 // If request id is -1, this signals that the request has already ran, and this
625 // merely serves as a notification. This happens when the feature to disable
626 // scripts running without user consent is not enabled.
627 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
628 std::string
/* extension id */,
629 extensions::UserScript::InjectionType
/* script type */,
630 int64
/* request id */)
632 // Sent from the browser to the renderer in reply to a
633 // RequestScriptInjectionPermission message, granting permission for a script
635 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
636 int64
/* request id */)
638 // Sent by the renderer when a web page is checking if its app is installed.
639 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
640 GURL
/* requestor_url */,
641 int32
/* return_route_id */,
642 int32
/* callback_id */)
644 // Optional Ack message sent to the browser to notify that the response to a
645 // function has been processed.
646 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
647 int /* request_id */)
649 // Response to ExtensionMsg_ShouldSuspend.
650 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
651 std::string
/* extension_id */,
652 uint64
/* sequence_id */)
654 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
655 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
656 std::string
/* extension_id */)
658 // Informs the browser to increment the keepalive count for the lazy background
659 // page, keeping it alive.
660 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
662 // Informs the browser there is one less thing keeping the lazy background page
664 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
666 // Fetches a globally unique ID (for the lifetime of the browser) from the
668 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
671 // Resumes resource requests for a newly created app window.
672 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
674 // Sent by the renderer when the draggable regions are updated.
675 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
676 std::vector
<extensions::DraggableRegion
> /* regions */)
678 // Sent by the renderer to log an API action to the extension activity log.
679 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
680 std::string
/* extension_id */,
681 ExtensionHostMsg_APIActionOrEvent_Params
)
683 // Sent by the renderer to log an event to the extension activity log.
684 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
685 std::string
/* extension_id */,
686 ExtensionHostMsg_APIActionOrEvent_Params
)
688 // Sent by the renderer to log a DOM action to the extension activity log.
689 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
690 std::string
/* extension_id */,
691 ExtensionHostMsg_DOMAction_Params
)
693 // Notifies the browser process that a tab has started or stopped matching
694 // certain conditions. This message is sent in response to several events:
696 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
697 // * A new page is loaded. This will be sent after
698 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
700 // * Something changed on an existing frame causing the set of matching searches
702 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
703 std::vector
<std::string
> /* Matching CSS selectors */)
705 // Sent by the renderer when it has received a Blob handle from the browser.
706 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
707 std::vector
<std::string
> /* blob_uuids */)
709 // Informs of updated frame names.
710 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_FrameNameChanged
,
711 bool /* is_top_level */,
712 std::string
/* name */)
714 // Tells listeners that a detailed message was reported to the console by
716 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded
,
717 base::string16
/* message */,
718 base::string16
/* source */,
719 extensions::StackTrace
/* stack trace */,
720 int32
/* severity level */)
722 // Sent by the renderer to set initialization parameters of a Browser Plugin
723 // that is identified by |element_instance_id|.
724 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AttachGuest
,
725 int /* routing_id */,
726 int /* element_instance_id */,
727 int /* guest_instance_id */,
728 base::DictionaryValue
/* attach_params */)