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 information about the sender of connect() calls that
151 // originate from a tab.
152 IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo
)
153 // The tab from where the connection was created.
154 IPC_STRUCT_MEMBER(base::DictionaryValue
, tab
)
156 // The ID of the frame that initiated the connection.
157 // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
158 IPC_STRUCT_MEMBER(int, frame_id
)
161 // Struct containing the data for external connections to extensions. Used to
162 // handle the IPCs initiated by both connect() and onConnect().
163 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
164 // The ID of the extension that is the target of the request.
165 IPC_STRUCT_MEMBER(std::string
, target_id
)
167 // The ID of the extension that initiated the request. May be empty if it
168 // wasn't initiated by an extension.
169 IPC_STRUCT_MEMBER(std::string
, source_id
)
171 // The URL of the frame that initiated the request.
172 IPC_STRUCT_MEMBER(GURL
, source_url
)
175 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
176 IPC_STRUCT_TRAITS_MEMBER(draggable
)
177 IPC_STRUCT_TRAITS_MEMBER(bounds
)
178 IPC_STRUCT_TRAITS_END()
180 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
181 IPC_STRUCT_TRAITS_MEMBER(type
)
182 IPC_STRUCT_TRAITS_MEMBER(host
)
183 IPC_STRUCT_TRAITS_MEMBER(port
)
184 IPC_STRUCT_TRAITS_END()
186 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
187 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
188 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
189 IPC_STRUCT_TRAITS_END()
191 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
192 IPC_STRUCT_TRAITS_MEMBER(entry())
193 IPC_STRUCT_TRAITS_END()
195 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame
)
196 IPC_STRUCT_TRAITS_MEMBER(line_number
)
197 IPC_STRUCT_TRAITS_MEMBER(column_number
)
198 IPC_STRUCT_TRAITS_MEMBER(source
)
199 IPC_STRUCT_TRAITS_MEMBER(function
)
200 IPC_STRUCT_TRAITS_END()
202 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
203 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
204 IPC_STRUCT_TRAITS_MEMBER(product_id())
205 IPC_STRUCT_TRAITS_END()
207 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
208 IPC_STRUCT_TRAITS_MEMBER(permission())
209 IPC_STRUCT_TRAITS_END()
211 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
212 IPC_STRUCT_TRAITS_MEMBER(data
)
213 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
214 IPC_STRUCT_TRAITS_END()
216 // Singly-included section for custom IPC traits.
217 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
218 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
220 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
221 // to typedef it to avoid that.
222 // Substitution map for l10n messages.
223 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
225 // Map of extensions IDs to the executing script paths.
226 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
228 struct ExtensionMsg_PermissionSetStruct
{
229 ExtensionMsg_PermissionSetStruct();
230 explicit ExtensionMsg_PermissionSetStruct(
231 const extensions::PermissionSet
& permissions
);
232 ~ExtensionMsg_PermissionSetStruct();
234 scoped_refptr
<const extensions::PermissionSet
> ToPermissionSet() const;
236 extensions::APIPermissionSet apis
;
237 extensions::ManifestPermissionSet manifest_permissions
;
238 extensions::URLPatternSet explicit_hosts
;
239 extensions::URLPatternSet scriptable_hosts
;
242 struct ExtensionMsg_Loaded_Params
{
243 ExtensionMsg_Loaded_Params();
244 ~ExtensionMsg_Loaded_Params();
245 explicit ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
);
247 // Creates a new extension from the data in this object.
248 scoped_refptr
<extensions::Extension
> ConvertToExtension(
249 std::string
* error
) const;
251 // The subset of the extension manifest data we send to renderers.
252 linked_ptr
<base::DictionaryValue
> manifest
;
254 // The location the extension was installed from.
255 extensions::Manifest::Location location
;
257 // The path the extension was loaded from. This is used in the renderer only
258 // to generate the extension ID for extensions that are loaded unpacked.
261 // The extension's active and withheld permissions.
262 ExtensionMsg_PermissionSetStruct active_permissions
;
263 ExtensionMsg_PermissionSetStruct withheld_permissions
;
265 // We keep this separate so that it can be used in logging.
268 // Send creation flags so extension is initialized identically.
272 struct ExtensionHostMsg_AutomationQuerySelector_Error
{
273 enum Value
{ kNone
, kNoMainFrame
, kNoDocument
, kNodeDestroyed
};
275 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone
) {}
283 struct ParamTraits
<URLPattern
> {
284 typedef URLPattern param_type
;
285 static void Write(Message
* m
, const param_type
& p
);
286 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
287 static void Log(const param_type
& p
, std::string
* l
);
291 struct ParamTraits
<extensions::URLPatternSet
> {
292 typedef extensions::URLPatternSet param_type
;
293 static void Write(Message
* m
, const param_type
& p
);
294 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
295 static void Log(const param_type
& p
, std::string
* l
);
299 struct ParamTraits
<extensions::APIPermission::ID
> {
300 typedef extensions::APIPermission::ID param_type
;
301 static void Write(Message
* m
, const param_type
& p
);
302 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
303 static void Log(const param_type
& p
, std::string
* l
);
307 struct ParamTraits
<extensions::APIPermissionSet
> {
308 typedef extensions::APIPermissionSet param_type
;
309 static void Write(Message
* m
, const param_type
& p
);
310 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
311 static void Log(const param_type
& p
, std::string
* l
);
315 struct ParamTraits
<extensions::ManifestPermissionSet
> {
316 typedef extensions::ManifestPermissionSet param_type
;
317 static void Write(Message
* m
, const param_type
& p
);
318 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
319 static void Log(const param_type
& p
, std::string
* l
);
323 struct ParamTraits
<ExtensionMsg_PermissionSetStruct
> {
324 typedef ExtensionMsg_PermissionSetStruct param_type
;
325 static void Write(Message
* m
, const param_type
& p
);
326 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
327 static void Log(const param_type
& p
, std::string
* l
);
331 struct ParamTraits
<ExtensionMsg_Loaded_Params
> {
332 typedef ExtensionMsg_Loaded_Params param_type
;
333 static void Write(Message
* m
, const param_type
& p
);
334 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
335 static void Log(const param_type
& p
, std::string
* l
);
340 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
342 IPC_ENUM_TRAITS_MAX_VALUE(
343 ExtensionHostMsg_AutomationQuerySelector_Error::Value
,
344 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed
)
346 IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error
)
347 IPC_STRUCT_TRAITS_MEMBER(value
)
348 IPC_STRUCT_TRAITS_END()
350 // Parameters structure for ExtensionMsg_UpdatePermissions.
351 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
352 IPC_STRUCT_MEMBER(std::string
, extension_id
)
353 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, active_permissions
)
354 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, withheld_permissions
)
357 // Messages sent from the browser to the renderer.
359 // The browser sends this message in response to all extension api calls. The
360 // response data (if any) is one of the base::Value subclasses, wrapped as the
361 // first element in a ListValue.
362 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
363 int /* request_id */,
365 base::ListValue
/* response wrapper (see comment above) */,
366 std::string
/* error */)
368 // This message is optionally routed. If used as a control message, it will
369 // call a javascript function |function_name| from module |module_name| in
370 // every registered context in the target process. If routed, it will be
371 // restricted to the contexts that are part of the target RenderView.
373 // If |extension_id| is non-empty, the function will be invoked only in
374 // contexts owned by the extension. |args| is a list of primitive Value types
375 // that are passed to the function.
376 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
377 std::string
/* extension_id */,
378 std::string
/* module_name */,
379 std::string
/* function_name */,
380 base::ListValue
/* args */,
381 bool /* delivered as part of a user gesture */)
383 // Tell the renderer process all known extension function names.
384 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
385 std::vector
<std::string
>)
387 // Set the top-level frame to the provided name.
388 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName
,
389 std::string
/* frame_name */)
391 // Tell the renderer process the platforms system font.
392 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
393 std::string
/* font_family */,
394 std::string
/* font_size */)
396 // Marks an extension as 'active' in an extension process. 'Active' extensions
397 // have more privileges than other extension content that might end up running
398 // in the process (e.g. because of iframes or content scripts).
399 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
400 std::string
/* extension_id */)
402 // Notifies the renderer that extensions were loaded in the browser.
403 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
404 std::vector
<ExtensionMsg_Loaded_Params
>)
406 // Notifies the renderer that an extension was unloaded in the browser.
407 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
410 // Updates the scripting whitelist for extensions in the render process. This is
411 // only used for testing.
412 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
414 extensions::ExtensionsClient::ScriptingWhitelist
)
416 // Notification that renderer should run some JavaScript code.
417 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
418 ExtensionMsg_ExecuteCode_Params
)
420 // Notification that the user scripts have been updated. It has one
421 // SharedMemoryHandle argument consisting of the pickled script data. This
422 // handle is valid in the context of the renderer.
423 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
424 // programmatically-defined scripts. Otherwise, the handle refers to all
425 // extensions' statically defined scripts.
426 // If |changed_extensions| is not empty, only the extensions in that set will
427 // be updated. Otherwise, all extensions that have scripts in the shared memory
428 // region will be updated. Note that the empty set => all extensions case is not
429 // supported for per-extension programmatically-defined script regions; in such
430 // regions, the owner is expected to list itself as the only changed extension.
431 IPC_MESSAGE_CONTROL3(ExtensionMsg_UpdateUserScripts
,
432 base::SharedMemoryHandle
,
433 extensions::ExtensionId
/* owner */,
434 std::set
<std::string
> /* changed extensions */)
436 // Trigger to execute declarative content script under browser control.
437 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript
,
438 int /* tab identifier */,
439 extensions::ExtensionId
/* extension identifier */,
440 int /* script identifier */,
441 GURL
/* page URL where script should be injected */)
443 // Tell the render view which browser window it's being attached to.
444 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
445 int /* id of browser window */)
447 // Tell the render view what its tab ID is.
448 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
451 // Tell the renderer to update an extension's permission set.
452 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
453 ExtensionMsg_UpdatePermissions_Params
)
455 // Tell the render view about new tab-specific permissions for an extension.
456 IPC_MESSAGE_ROUTED3(ExtensionMsg_UpdateTabSpecificPermissions
,
458 std::string
/* extension_id */,
459 extensions::URLPatternSet
/* hosts */)
461 // Tell the render view to clear tab-specific permissions for some extensions.
462 IPC_MESSAGE_ROUTED1(ExtensionMsg_ClearTabSpecificPermissions
,
463 std::vector
<std::string
> /* extension_ids */)
465 // Tell the renderer which type this view is.
466 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
467 extensions::ViewType
/* view_type */)
469 // Deliver a message sent with ExtensionHostMsg_PostMessage.
470 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
471 bool /* webrequest_used */)
473 // Ask the lazy background page if it is ready to be suspended. This is sent
474 // when the page is considered idle. The renderer will reply with the same
475 // sequence_id so that we can tell which message it is responding to.
476 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
477 std::string
/* extension_id */,
478 uint64
/* sequence_id */)
480 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
481 // the lazy background page becoming active again, we are ready to unload. This
482 // message tells the page to dispatch the suspend event.
483 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
484 std::string
/* extension_id */)
486 // The browser changed its mind about suspending this extension.
487 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
488 std::string
/* extension_id */)
490 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
491 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
492 std::string
/* state */,
493 int32
/* callback_id */)
495 // Dispatch the Port.onConnect event for message channels.
496 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
497 int /* target_port_id */,
498 std::string
/* channel_name */,
499 ExtensionMsg_TabConnectionInfo
/* source */,
500 ExtensionMsg_ExternalConnectionInfo
,
501 std::string
/* tls_channel_id */)
503 // Deliver a message sent with ExtensionHostMsg_PostMessage.
504 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
505 int /* target_port_id */,
508 // Dispatch the Port.onDisconnect event for message channels.
509 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
511 std::string
/* error_message */)
513 // Informs the renderer what channel (dev, beta, stable, etc) is running.
514 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
517 // Adds a logging message to the renderer's root frame DevTools console.
518 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
519 content::ConsoleMessageLevel
/* level */,
520 std::string
/* message */)
522 // Notify the renderer that its window has closed.
523 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
525 // Notify the renderer that an extension wants notifications when certain
526 // searches match the active page. This message replaces the old set of
527 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
528 // each tab to keep the browser updated about changes.
529 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
530 std::vector
<std::string
> /* CSS selectors */)
532 // Send by the browser to indicate a Blob handle has been transferred to the
533 // renderer. This is sent after the actual extension response, and depends on
534 // the sequential nature of IPCs so that the blob has already been caught.
535 // This is a separate control message, so that the renderer process will send
536 // an acknowledgement even if the RenderView has closed or navigated away.
537 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
538 std::vector
<std::string
> /* blob_uuids */)
540 // The ACK for ExtensionHostMsg_CreateMimeHandlerViewGuest.
541 IPC_MESSAGE_CONTROL1(ExtensionMsg_CreateMimeHandlerViewGuestACK
,
542 int /* element_instance_id */)
544 // Once a RenderView proxy has been created for the guest in the embedder render
545 // process, this IPC informs the embedder of the proxy's routing ID.
546 IPC_MESSAGE_ROUTED2(ExtensionMsg_GuestAttached
,
547 int /* element_instance_id */,
548 int /* source_routing_id */)
550 // Messages sent from the renderer to the browser.
552 // A renderer sends this message when an extension process starts an API
553 // request. The browser will always respond with a ExtensionMsg_Response.
554 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request
,
555 ExtensionHostMsg_Request_Params
)
557 // A renderer sends this message when an extension process starts an API
558 // request. The browser will always respond with a ExtensionMsg_Response.
559 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
560 int /* routing_id */,
561 ExtensionHostMsg_Request_Params
)
563 // Notify the browser that the given extension added a listener to an event.
564 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener
,
565 std::string
/* extension_id */,
566 GURL
/* listener_url */,
567 std::string
/* name */)
569 // Notify the browser that the given extension removed a listener from an
571 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener
,
572 std::string
/* extension_id */,
573 GURL
/* listener_url */,
574 std::string
/* name */)
576 // Notify the browser that the given extension added a listener to an event from
577 // a lazy background page.
578 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
579 std::string
/* extension_id */,
580 std::string
/* name */)
582 // Notify the browser that the given extension is no longer interested in
583 // receiving the given event from a lazy background page.
584 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
585 std::string
/* extension_id */,
586 std::string
/* name */)
588 // Notify the browser that the given extension added a listener to instances of
589 // the named event that satisfy the filter.
590 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
591 std::string
/* extension_id */,
592 std::string
/* name */,
593 base::DictionaryValue
/* filter */,
596 // Notify the browser that the given extension is no longer interested in
597 // instances of the named event that satisfy the filter.
598 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
599 std::string
/* extension_id */,
600 std::string
/* name */,
601 base::DictionaryValue
/* filter */,
604 // Notify the browser that an event has finished being dispatched.
605 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
607 // Open a channel to all listening contexts owned by the extension with
608 // the given ID. This always returns a valid port ID which can be used for
609 // sending messages. If an error occurred, the opener will be notified
611 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
612 int /* routing_id */,
613 ExtensionMsg_ExternalConnectionInfo
,
614 std::string
/* channel_name */,
615 bool /* include_tls_channel_id */,
618 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
619 int /* routing_id */,
620 std::string
/* source_extension_id */,
621 std::string
/* native_app_name */,
624 // Get a port handle to the given tab. The handle can be used for sending
625 // messages to the extension.
626 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
627 int /* routing_id */,
629 std::string
/* extension_id */,
630 std::string
/* channel_name */,
633 // Send a message to an extension process. The handle is the value returned
634 // by ViewHostMsg_OpenChannelTo*.
635 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
639 // Send a message to an extension process. The handle is the value returned
640 // by ViewHostMsg_OpenChannelTo*.
641 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
643 std::string
/* error_message */)
645 // Used to get the extension message bundle.
646 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
647 std::string
/* extension id */,
648 SubstitutionMap
/* message bundle */)
650 // Sent from the renderer to the browser to return the script running result.
652 ExtensionHostMsg_ExecuteCodeFinished
,
653 int /* request id */,
654 std::string
/* error; empty implies success */,
655 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
656 base::ListValue
/* result of the script */)
658 // Sent from the renderer to the browser to notify that content scripts are
659 // running in the renderer that the IPC originated from.
660 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
662 GURL
/* url of the _topmost_ frame */)
664 // Sent from the renderer to the browser to request permission for a script
666 // If request id is -1, this signals that the request has already ran, and this
667 // merely serves as a notification. This happens when the feature to disable
668 // scripts running without user consent is not enabled.
669 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
670 std::string
/* extension id */,
671 extensions::UserScript::InjectionType
/* script type */,
672 int64
/* request id */)
674 // Sent from the browser to the renderer in reply to a
675 // RequestScriptInjectionPermission message, granting permission for a script
677 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
678 int64
/* request id */)
680 // Sent by the renderer when a web page is checking if its app is installed.
681 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
682 GURL
/* requestor_url */,
683 int32
/* return_route_id */,
684 int32
/* callback_id */)
686 // Optional Ack message sent to the browser to notify that the response to a
687 // function has been processed.
688 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
689 int /* request_id */)
691 // Response to ExtensionMsg_ShouldSuspend.
692 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
693 std::string
/* extension_id */,
694 uint64
/* sequence_id */)
696 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
697 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
698 std::string
/* extension_id */)
700 // Informs the browser to increment the keepalive count for the lazy background
701 // page, keeping it alive.
702 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
704 // Informs the browser there is one less thing keeping the lazy background page
706 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
708 // Fetches a globally unique ID (for the lifetime of the browser) from the
710 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
713 // Resumes resource requests for a newly created app window.
714 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
716 // Sent by the renderer when the draggable regions are updated.
717 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
718 std::vector
<extensions::DraggableRegion
> /* regions */)
720 // Sent by the renderer to log an API action to the extension activity log.
721 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
722 std::string
/* extension_id */,
723 ExtensionHostMsg_APIActionOrEvent_Params
)
725 // Sent by the renderer to log an event to the extension activity log.
726 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
727 std::string
/* extension_id */,
728 ExtensionHostMsg_APIActionOrEvent_Params
)
730 // Sent by the renderer to log a DOM action to the extension activity log.
731 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
732 std::string
/* extension_id */,
733 ExtensionHostMsg_DOMAction_Params
)
735 // Notifies the browser process that a tab has started or stopped matching
736 // certain conditions. This message is sent in response to several events:
738 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
739 // * A new page is loaded. This will be sent after
740 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
742 // * Something changed on an existing frame causing the set of matching searches
744 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
745 std::vector
<std::string
> /* Matching CSS selectors */)
747 // Sent by the renderer when it has received a Blob handle from the browser.
748 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
749 std::vector
<std::string
> /* blob_uuids */)
751 // Informs of updated frame names.
752 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_FrameNameChanged
,
753 bool /* is_top_level */,
754 std::string
/* name */)
756 // Tells listeners that a detailed message was reported to the console by
758 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded
,
759 base::string16
/* message */,
760 base::string16
/* source */,
761 extensions::StackTrace
/* stack trace */,
762 int32
/* severity level */)
764 // Sent by the renderer to set initialization parameters of a Browser Plugin
765 // that is identified by |element_instance_id|.
766 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AttachGuest
,
767 int /* routing_id */,
768 int /* element_instance_id */,
769 int /* guest_instance_id */,
770 base::DictionaryValue
/* attach_params */)
772 // Tells the browser to create a mime handler guest view for a plugin.
773 IPC_MESSAGE_CONTROL5(ExtensionHostMsg_CreateMimeHandlerViewGuest
,
774 int /* render_frame_id */,
775 std::string
/* embedder_url */,
776 std::string
/* content_url */,
777 std::string
/* mime_type */,
778 int /* element_instance_id */)
780 // Sent when a query selector request is made from the automation API.
781 // acc_obj_id is the accessibility tree ID of the starting element.
782 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector
,
783 int /* request_id */,
784 int /* acc_obj_id */,
785 base::string16
/* selector */)
787 // Result of a query selector request.
788 // result_acc_obj_id is the accessibility tree ID of the result element; 0
789 // indicates no result.
790 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result
,
791 int /* request_id */,
792 ExtensionHostMsg_AutomationQuerySelector_Error
/* error */,
793 int /* result_acc_obj_id */)