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/view_type.h"
26 #include "ipc/ipc_message_macros.h"
29 #define IPC_MESSAGE_START ExtensionMsgStart
31 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType
, extensions::VIEW_TYPE_LAST
)
32 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType
,
33 content::SocketPermissionRequest::OPERATION_TYPE_LAST
)
35 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
36 // ExtensionHostMsg_AddEventToActivityLog.
37 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params
)
39 IPC_STRUCT_MEMBER(std::string
, api_call
)
42 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
44 // Extra logging information.
45 IPC_STRUCT_MEMBER(std::string
, extra
)
48 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
49 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params
)
51 IPC_STRUCT_MEMBER(GURL
, url
)
54 IPC_STRUCT_MEMBER(base::string16
, url_title
)
57 IPC_STRUCT_MEMBER(std::string
, api_call
)
60 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
62 // Type of DOM API call.
63 IPC_STRUCT_MEMBER(int, call_type
)
66 // Parameters structure for ExtensionHostMsg_Request.
67 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params
)
69 IPC_STRUCT_MEMBER(std::string
, name
)
71 // List of message arguments.
72 IPC_STRUCT_MEMBER(base::ListValue
, arguments
)
74 // Extension ID this request was sent from. This can be empty, in the case
75 // where we expose APIs to normal web pages using the extension function
77 IPC_STRUCT_MEMBER(std::string
, extension_id
)
79 // URL of the frame the request was sent from. This isn't necessarily an
80 // extension url. Extension requests can also originate from content scripts,
81 // in which case extension_id will indicate the ID of the associated
82 // extension. Or, they can originate from hosted apps or normal web pages.
83 IPC_STRUCT_MEMBER(GURL
, source_url
)
85 // The id of the tab that sent this request, or -1 if there is no source tab.
86 IPC_STRUCT_MEMBER(int, source_tab_id
)
88 // Unique request id to match requests and responses.
89 IPC_STRUCT_MEMBER(int, request_id
)
91 // True if request has a callback specified.
92 IPC_STRUCT_MEMBER(bool, has_callback
)
94 // True if request is executed in response to an explicit user gesture.
95 IPC_STRUCT_MEMBER(bool, user_gesture
)
98 // Allows an extension to execute code in a tab.
99 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params
)
100 // The extension API request id, for responding.
101 IPC_STRUCT_MEMBER(int, request_id
)
103 // The ID of the requesting extension. To know which isolated world to
104 // execute the code inside of.
105 IPC_STRUCT_MEMBER(std::string
, extension_id
)
107 // Whether the code is JavaScript or CSS.
108 IPC_STRUCT_MEMBER(bool, is_javascript
)
110 // String of code to execute.
111 IPC_STRUCT_MEMBER(std::string
, code
)
113 // The webview guest source who calls to execute code.
114 IPC_STRUCT_MEMBER(GURL
, webview_src
)
116 // Whether to inject into all frames, or only the root frame.
117 IPC_STRUCT_MEMBER(bool, all_frames
)
119 // Whether to inject into about:blank (sub)frames.
120 IPC_STRUCT_MEMBER(bool, match_about_blank
)
122 // When to inject the code.
123 IPC_STRUCT_MEMBER(int, run_at
)
125 // Whether to execute code in the main world (as opposed to an isolated
127 IPC_STRUCT_MEMBER(bool, in_main_world
)
129 // Whether the request is coming from a <webview>.
130 IPC_STRUCT_MEMBER(bool, is_web_view
)
132 // Whether the caller is interested in the result value. Manifest-declared
133 // content scripts and executeScript() calls without a response callback
134 // are examples of when this will be false.
135 IPC_STRUCT_MEMBER(bool, wants_result
)
137 // The URL of the file that was injected, if any.
138 IPC_STRUCT_MEMBER(GURL
, file_url
)
140 // Whether the code to be executed should be associated with a user gesture.
141 IPC_STRUCT_MEMBER(bool, user_gesture
)
144 // Struct containing the data for external connections to extensions. Used to
145 // handle the IPCs initiated by both connect() and onConnect().
146 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
147 // The ID of the extension that is the target of the request.
148 IPC_STRUCT_MEMBER(std::string
, target_id
)
150 // The ID of the extension that initiated the request. May be empty if it
151 // wasn't initiated by an extension.
152 IPC_STRUCT_MEMBER(std::string
, source_id
)
154 // The URL of the frame that initiated the request.
155 IPC_STRUCT_MEMBER(GURL
, source_url
)
158 // Parameters structure for ExtensionMsg_UpdatePermissions.
159 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
160 IPC_STRUCT_MEMBER(int /* UpdateExtensionPermissionsInfo::REASON */, reason_id
)
161 IPC_STRUCT_MEMBER(std::string
, extension_id
)
162 IPC_STRUCT_MEMBER(extensions::APIPermissionSet
, apis
)
163 IPC_STRUCT_MEMBER(extensions::ManifestPermissionSet
, manifest_permissions
)
164 IPC_STRUCT_MEMBER(extensions::URLPatternSet
, explicit_hosts
)
165 IPC_STRUCT_MEMBER(extensions::URLPatternSet
, scriptable_hosts
)
168 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
169 IPC_STRUCT_TRAITS_MEMBER(draggable
)
170 IPC_STRUCT_TRAITS_MEMBER(bounds
)
171 IPC_STRUCT_TRAITS_END()
173 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
174 IPC_STRUCT_TRAITS_MEMBER(type
)
175 IPC_STRUCT_TRAITS_MEMBER(host
)
176 IPC_STRUCT_TRAITS_MEMBER(port
)
177 IPC_STRUCT_TRAITS_END()
179 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
180 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
181 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
182 IPC_STRUCT_TRAITS_END()
184 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
185 IPC_STRUCT_TRAITS_MEMBER(entry())
186 IPC_STRUCT_TRAITS_END()
188 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
189 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
190 IPC_STRUCT_TRAITS_MEMBER(product_id())
191 IPC_STRUCT_TRAITS_END()
193 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
194 IPC_STRUCT_TRAITS_MEMBER(permission())
195 IPC_STRUCT_TRAITS_END()
197 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
198 IPC_STRUCT_TRAITS_MEMBER(data
)
199 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
200 IPC_STRUCT_TRAITS_END()
202 // Singly-included section for custom IPC traits.
203 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
204 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
206 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
207 // to typedef it to avoid that.
208 // Substitution map for l10n messages.
209 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
211 // Map of extensions IDs to the executing script paths.
212 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
214 struct ExtensionMsg_Loaded_Params
{
215 ExtensionMsg_Loaded_Params();
216 ~ExtensionMsg_Loaded_Params();
217 explicit ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
);
219 // Creates a new extension from the data in this object.
220 scoped_refptr
<extensions::Extension
> ConvertToExtension(
221 std::string
* error
) const;
223 // The subset of the extension manifest data we send to renderers.
224 linked_ptr
<base::DictionaryValue
> manifest
;
226 // The location the extension was installed from.
227 extensions::Manifest::Location location
;
229 // The path the extension was loaded from. This is used in the renderer only
230 // to generate the extension ID for extensions that are loaded unpacked.
233 // The extension's active permissions.
234 extensions::APIPermissionSet apis
;
235 extensions::ManifestPermissionSet manifest_permissions
;
236 extensions::URLPatternSet explicit_hosts
;
237 extensions::URLPatternSet scriptable_hosts
;
239 // We keep this separate so that it can be used in logging.
242 // Send creation flags so extension is initialized identically.
249 struct ParamTraits
<URLPattern
> {
250 typedef URLPattern param_type
;
251 static void Write(Message
* m
, const param_type
& p
);
252 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
253 static void Log(const param_type
& p
, std::string
* l
);
257 struct ParamTraits
<extensions::URLPatternSet
> {
258 typedef extensions::URLPatternSet param_type
;
259 static void Write(Message
* m
, const param_type
& p
);
260 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
261 static void Log(const param_type
& p
, std::string
* l
);
265 struct ParamTraits
<extensions::APIPermission::ID
> {
266 typedef extensions::APIPermission::ID param_type
;
267 static void Write(Message
* m
, const param_type
& p
);
268 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
269 static void Log(const param_type
& p
, std::string
* l
);
273 struct ParamTraits
<extensions::APIPermissionSet
> {
274 typedef extensions::APIPermissionSet param_type
;
275 static void Write(Message
* m
, const param_type
& p
);
276 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
277 static void Log(const param_type
& p
, std::string
* l
);
281 struct ParamTraits
<extensions::ManifestPermissionSet
> {
282 typedef extensions::ManifestPermissionSet param_type
;
283 static void Write(Message
* m
, const param_type
& p
);
284 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
285 static void Log(const param_type
& p
, std::string
* l
);
289 struct ParamTraits
<ExtensionMsg_Loaded_Params
> {
290 typedef ExtensionMsg_Loaded_Params param_type
;
291 static void Write(Message
* m
, const param_type
& p
);
292 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
293 static void Log(const param_type
& p
, std::string
* l
);
298 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
300 // Messages sent from the browser to the renderer.
302 // The browser sends this message in response to all extension api calls. The
303 // response data (if any) is one of the base::Value subclasses, wrapped as the
304 // first element in a ListValue.
305 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
306 int /* request_id */,
308 base::ListValue
/* response wrapper (see comment above) */,
309 std::string
/* error */)
311 // This message is optionally routed. If used as a control message, it will
312 // call a javascript function |function_name| from module |module_name| in
313 // every registered context in the target process. If routed, it will be
314 // restricted to the contexts that are part of the target RenderView.
316 // If |extension_id| is non-empty, the function will be invoked only in
317 // contexts owned by the extension. |args| is a list of primitive Value types
318 // that are passed to the function.
319 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
320 std::string
/* extension_id */,
321 std::string
/* module_name */,
322 std::string
/* function_name */,
323 base::ListValue
/* args */,
324 bool /* delivered as part of a user gesture */)
326 // Tell the renderer process all known extension function names.
327 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
328 std::vector
<std::string
>)
330 // Tell the renderer process the platforms system font.
331 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
332 std::string
/* font_family */,
333 std::string
/* font_size */)
335 // Marks an extension as 'active' in an extension process. 'Active' extensions
336 // have more privileges than other extension content that might end up running
337 // in the process (e.g. because of iframes or content scripts).
338 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
339 std::string
/* extension_id */)
341 // Notifies the renderer that extensions were loaded in the browser.
342 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
343 std::vector
<ExtensionMsg_Loaded_Params
>)
345 // Notifies the renderer that an extension was unloaded in the browser.
346 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
349 // Updates the scripting whitelist for extensions in the render process. This is
350 // only used for testing.
351 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
353 extensions::ExtensionsClient::ScriptingWhitelist
)
355 // Notification that renderer should run some JavaScript code.
356 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
357 ExtensionMsg_ExecuteCode_Params
)
359 // Notification that the user scripts have been updated. It has one
360 // SharedMemoryHandle argument consisting of the pickled script data. This
361 // handle is valid in the context of the renderer.
362 // If |changed_extensions| is not empty, only the extensions in that set will
363 // be updated. Otherwise, all extensions will be updated.
364 IPC_MESSAGE_CONTROL2(ExtensionMsg_UpdateUserScripts
,
365 base::SharedMemoryHandle
,
366 std::set
<std::string
> /* changed extensions */)
368 // Tell the render view which browser window it's being attached to.
369 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
370 int /* id of browser window */)
372 // Tell the render view what its tab ID is.
373 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
376 // Tell the renderer to update an extension's permission set.
377 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
378 ExtensionMsg_UpdatePermissions_Params
)
380 // Tell the renderer about new tab-specific permissions for an extension.
381 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions
,
382 int32
/* page_id (only relevant for the target tab) */,
384 std::string
/* extension_id */,
385 extensions::URLPatternSet
/* hosts */)
387 // Tell the renderer to clear tab-specific permissions for some extensions.
388 IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions
,
390 std::vector
<std::string
> /* extension_ids */)
392 // Tell the renderer which type this view is.
393 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
394 extensions::ViewType
/* view_type */)
396 // Deliver a message sent with ExtensionHostMsg_PostMessage.
397 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
398 bool /* webrequest_used */)
400 // Ask the lazy background page if it is ready to be suspended. This is sent
401 // when the page is considered idle. The renderer will reply with the same
402 // sequence_id so that we can tell which message it is responding to.
403 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
404 std::string
/* extension_id */,
405 int /* sequence_id */)
407 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
408 // the lazy background page becoming active again, we are ready to unload. This
409 // message tells the page to dispatch the suspend event.
410 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
411 std::string
/* extension_id */)
413 // The browser changed its mind about suspending this extension.
414 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
415 std::string
/* extension_id */)
417 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
418 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
419 std::string
/* state */,
420 int32
/* callback_id */)
422 // Dispatch the Port.onConnect event for message channels.
423 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
424 int /* target_port_id */,
425 std::string
/* channel_name */,
426 base::DictionaryValue
/* source_tab */,
427 ExtensionMsg_ExternalConnectionInfo
,
428 std::string
/* tls_channel_id */)
430 // Deliver a message sent with ExtensionHostMsg_PostMessage.
431 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
432 int /* target_port_id */,
435 // Dispatch the Port.onDisconnect event for message channels.
436 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
438 std::string
/* error_message */)
440 // Informs the renderer what channel (dev, beta, stable, etc) is running.
441 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
444 // Adds a logging message to the renderer's root frame DevTools console.
445 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
446 content::ConsoleMessageLevel
/* level */,
447 std::string
/* message */)
449 // Notify the renderer that its window has closed.
450 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
452 // Notify the renderer that an extension wants notifications when certain
453 // searches match the active page. This message replaces the old set of
454 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
455 // each tab to keep the browser updated about changes.
456 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
457 std::vector
<std::string
> /* CSS selectors */)
459 // Send by the browser to indicate a Blob handle has been transferred to the
460 // renderer. This is sent after the actual extension response, and depends on
461 // the sequential nature of IPCs so that the blob has already been caught.
462 // This is a separate control message, so that the renderer process will send
463 // an acknowledgement even if the RenderView has closed or navigated away.
464 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
465 std::vector
<std::string
> /* blob_uuids */)
467 // Messages sent from the renderer to the browser.
469 // A renderer sends this message when an extension process starts an API
470 // request. The browser will always respond with a ExtensionMsg_Response.
471 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
472 ExtensionHostMsg_Request_Params
)
474 // A renderer sends this message when an extension process starts an API
475 // request. The browser will always respond with a ExtensionMsg_Response.
476 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
477 int /* routing_id */,
478 ExtensionHostMsg_Request_Params
)
480 // Notify the browser that the given extension added a listener to an event.
481 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddListener
,
482 std::string
/* extension_id */,
483 std::string
/* name */)
485 // Notify the browser that the given extension removed a listener from an
487 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveListener
,
488 std::string
/* extension_id */,
489 std::string
/* name */)
491 // Notify the browser that the given extension added a listener to an event from
492 // a lazy background page.
493 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
494 std::string
/* extension_id */,
495 std::string
/* name */)
497 // Notify the browser that the given extension is no longer interested in
498 // receiving the given event from a lazy background page.
499 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
500 std::string
/* extension_id */,
501 std::string
/* name */)
503 // Notify the browser that the given extension added a listener to instances of
504 // the named event that satisfy the filter.
505 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
506 std::string
/* extension_id */,
507 std::string
/* name */,
508 base::DictionaryValue
/* filter */,
511 // Notify the browser that the given extension is no longer interested in
512 // instances of the named event that satisfy the filter.
513 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
514 std::string
/* extension_id */,
515 std::string
/* name */,
516 base::DictionaryValue
/* filter */,
519 // Notify the browser that an event has finished being dispatched.
520 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
522 // Open a channel to all listening contexts owned by the extension with
523 // the given ID. This always returns a valid port ID which can be used for
524 // sending messages. If an error occurred, the opener will be notified
526 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
527 int /* routing_id */,
528 ExtensionMsg_ExternalConnectionInfo
,
529 std::string
/* channel_name */,
530 bool /* include_tls_channel_id */,
533 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
534 int /* routing_id */,
535 std::string
/* source_extension_id */,
536 std::string
/* native_app_name */,
539 // Get a port handle to the given tab. The handle can be used for sending
540 // messages to the extension.
541 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
542 int /* routing_id */,
544 std::string
/* extension_id */,
545 std::string
/* channel_name */,
548 // Send a message to an extension process. The handle is the value returned
549 // by ViewHostMsg_OpenChannelTo*.
550 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
554 // Send a message to an extension process. The handle is the value returned
555 // by ViewHostMsg_OpenChannelTo*.
556 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
558 std::string
/* error_message */)
560 // Used to get the extension message bundle.
561 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
562 std::string
/* extension id */,
563 SubstitutionMap
/* message bundle */)
565 // Sent from the renderer to the browser to return the script running result.
567 ExtensionHostMsg_ExecuteCodeFinished
,
568 int /* request id */,
569 std::string
/* error; empty implies success */,
570 int32
/* page_id the code executed on. May be -1 if unsuccessful */,
571 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
572 base::ListValue
/* result of the script */)
574 // Sent from the renderer to the browser to notify that content scripts are
575 // running in the renderer that the IPC originated from.
576 // Note that the page_id is for the parent (or more accurately the topmost)
577 // frame (e.g. if executing in an iframe this is the page ID of the parent,
578 // unless the parent is an iframe... etc).
579 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting
,
581 int32
/* page_id of the _topmost_ frame */,
582 GURL
/* url of the _topmost_ frame */)
584 // Sent from the renderer to the browser to request permission for a content
585 // script to execute on a given page.
586 // If request id is -1, this signals that the request has already ran, and this
587 // merely serves as a notification. This happens when the feature to disable
588 // scripts running without user consent is not enabled.
589 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestContentScriptPermission
,
590 std::string
/* extension id */,
592 int /* request id */)
594 // Sent from the browser to the renderer in reply to a
595 // RequestContentScriptPermission message, granting permission for a content
597 IPC_MESSAGE_ROUTED1(ExtensionMsg_GrantContentScriptPermission
,
598 int /* request id */)
600 // Sent by the renderer when a web page is checking if its app is installed.
601 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
602 GURL
/* requestor_url */,
603 int32
/* return_route_id */,
604 int32
/* callback_id */)
606 // Optional Ack message sent to the browser to notify that the response to a
607 // function has been processed.
608 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
609 int /* request_id */)
611 // Response to ExtensionMsg_ShouldSuspend.
612 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
613 std::string
/* extension_id */,
614 int /* sequence_id */)
616 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
617 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
618 std::string
/* extension_id */)
620 // Informs the browser to increment the keepalive count for the lazy background
621 // page, keeping it alive.
622 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
624 // Informs the browser there is one less thing keeping the lazy background page
626 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
628 // Fetches a globally unique ID (for the lifetime of the browser) from the
630 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
633 // Resumes resource requests for a newly created app window.
634 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
636 // Sent by the renderer when the draggable regions are updated.
637 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
638 std::vector
<extensions::DraggableRegion
> /* regions */)
640 // Sent by the renderer to log an API action to the extension activity log.
641 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
642 std::string
/* extension_id */,
643 ExtensionHostMsg_APIActionOrEvent_Params
)
645 // Sent by the renderer to log an event to the extension activity log.
646 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
647 std::string
/* extension_id */,
648 ExtensionHostMsg_APIActionOrEvent_Params
)
650 // Sent by the renderer to log a DOM action to the extension activity log.
651 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
652 std::string
/* extension_id */,
653 ExtensionHostMsg_DOMAction_Params
)
655 // Notifies the browser process that a tab has started or stopped matching
656 // certain conditions. This message is sent in response to several events:
658 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
659 // * A new page is loaded. This will be sent after
660 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
662 // * Something changed on an existing frame causing the set of matching searches
664 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
665 std::vector
<std::string
> /* Matching CSS selectors */)
667 // Sent by the renderer when it has received a Blob handle from the browser.
668 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
669 std::vector
<std::string
> /* blob_uuids */)