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 information about the destination of tab.connect().
162 IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo
)
163 // The destination tab's ID.
164 IPC_STRUCT_MEMBER(int, tab_id
)
166 // Frame ID of the destination. -1 for all frames, 0 for main frame and
167 // positive if the destination is a specific child frame.
168 IPC_STRUCT_MEMBER(int, frame_id
)
171 // Struct containing the data for external connections to extensions. Used to
172 // handle the IPCs initiated by both connect() and onConnect().
173 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo
)
174 // The ID of the extension that is the target of the request.
175 IPC_STRUCT_MEMBER(std::string
, target_id
)
177 // The ID of the extension that initiated the request. May be empty if it
178 // wasn't initiated by an extension.
179 IPC_STRUCT_MEMBER(std::string
, source_id
)
181 // The URL of the frame that initiated the request.
182 IPC_STRUCT_MEMBER(GURL
, source_url
)
184 // The ID of the frame that is the target of the request.
185 IPC_STRUCT_MEMBER(int, target_frame_id
)
187 // The process ID of the webview that initiated the request.
188 IPC_STRUCT_MEMBER(int, guest_process_id
)
191 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion
)
192 IPC_STRUCT_TRAITS_MEMBER(draggable
)
193 IPC_STRUCT_TRAITS_MEMBER(bounds
)
194 IPC_STRUCT_TRAITS_END()
196 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest
)
197 IPC_STRUCT_TRAITS_MEMBER(type
)
198 IPC_STRUCT_TRAITS_MEMBER(host
)
199 IPC_STRUCT_TRAITS_MEMBER(port
)
200 IPC_STRUCT_TRAITS_END()
202 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry
)
203 IPC_STRUCT_TRAITS_MEMBER(pattern_
)
204 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_
)
205 IPC_STRUCT_TRAITS_END()
207 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData
)
208 IPC_STRUCT_TRAITS_MEMBER(entry())
209 IPC_STRUCT_TRAITS_END()
211 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame
)
212 IPC_STRUCT_TRAITS_MEMBER(line_number
)
213 IPC_STRUCT_TRAITS_MEMBER(column_number
)
214 IPC_STRUCT_TRAITS_MEMBER(source
)
215 IPC_STRUCT_TRAITS_MEMBER(function
)
216 IPC_STRUCT_TRAITS_END()
218 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData
)
219 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
220 IPC_STRUCT_TRAITS_MEMBER(product_id())
221 IPC_STRUCT_TRAITS_END()
223 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData
)
224 IPC_STRUCT_TRAITS_MEMBER(permission())
225 IPC_STRUCT_TRAITS_END()
227 IPC_STRUCT_TRAITS_BEGIN(extensions::Message
)
228 IPC_STRUCT_TRAITS_MEMBER(data
)
229 IPC_STRUCT_TRAITS_MEMBER(user_gesture
)
230 IPC_STRUCT_TRAITS_END()
232 // Singly-included section for custom IPC traits.
233 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
234 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
236 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
237 // to typedef it to avoid that.
238 // Substitution map for l10n messages.
239 typedef std::map
<std::string
, std::string
> SubstitutionMap
;
241 // Map of extensions IDs to the executing script paths.
242 typedef std::map
<std::string
, std::set
<std::string
> > ExecutingScriptsMap
;
244 struct ExtensionMsg_PermissionSetStruct
{
245 ExtensionMsg_PermissionSetStruct();
246 explicit ExtensionMsg_PermissionSetStruct(
247 const extensions::PermissionSet
& permissions
);
248 ~ExtensionMsg_PermissionSetStruct();
250 scoped_refptr
<const extensions::PermissionSet
> ToPermissionSet() const;
252 extensions::APIPermissionSet apis
;
253 extensions::ManifestPermissionSet manifest_permissions
;
254 extensions::URLPatternSet explicit_hosts
;
255 extensions::URLPatternSet scriptable_hosts
;
258 struct ExtensionMsg_Loaded_Params
{
259 ExtensionMsg_Loaded_Params();
260 ~ExtensionMsg_Loaded_Params();
261 explicit ExtensionMsg_Loaded_Params(const extensions::Extension
* extension
);
263 // Creates a new extension from the data in this object.
264 scoped_refptr
<extensions::Extension
> ConvertToExtension(
265 std::string
* error
) const;
267 // The subset of the extension manifest data we send to renderers.
268 linked_ptr
<base::DictionaryValue
> manifest
;
270 // The location the extension was installed from.
271 extensions::Manifest::Location location
;
273 // The path the extension was loaded from. This is used in the renderer only
274 // to generate the extension ID for extensions that are loaded unpacked.
277 // The extension's active and withheld permissions.
278 ExtensionMsg_PermissionSetStruct active_permissions
;
279 ExtensionMsg_PermissionSetStruct withheld_permissions
;
281 // We keep this separate so that it can be used in logging.
284 // Send creation flags so extension is initialized identically.
288 struct ExtensionHostMsg_AutomationQuerySelector_Error
{
289 enum Value
{ kNone
, kNoMainFrame
, kNoDocument
, kNodeDestroyed
};
291 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone
) {}
299 struct ParamTraits
<URLPattern
> {
300 typedef URLPattern 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::URLPatternSet
> {
308 typedef extensions::URLPatternSet param_type
;
309 static void Write(Message
* m
, const param_type
& p
);
310 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
311 static void Log(const param_type
& p
, std::string
* l
);
315 struct ParamTraits
<extensions::APIPermission::ID
> {
316 typedef extensions::APIPermission::ID param_type
;
317 static void Write(Message
* m
, const param_type
& p
);
318 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
319 static void Log(const param_type
& p
, std::string
* l
);
323 struct ParamTraits
<extensions::APIPermissionSet
> {
324 typedef extensions::APIPermissionSet param_type
;
325 static void Write(Message
* m
, const param_type
& p
);
326 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
327 static void Log(const param_type
& p
, std::string
* l
);
331 struct ParamTraits
<extensions::ManifestPermissionSet
> {
332 typedef extensions::ManifestPermissionSet param_type
;
333 static void Write(Message
* m
, const param_type
& p
);
334 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* r
);
335 static void Log(const param_type
& p
, std::string
* l
);
339 struct ParamTraits
<ExtensionMsg_PermissionSetStruct
> {
340 typedef ExtensionMsg_PermissionSetStruct param_type
;
341 static void Write(Message
* m
, const param_type
& p
);
342 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
343 static void Log(const param_type
& p
, std::string
* l
);
347 struct ParamTraits
<ExtensionMsg_Loaded_Params
> {
348 typedef ExtensionMsg_Loaded_Params param_type
;
349 static void Write(Message
* m
, const param_type
& p
);
350 static bool Read(const Message
* m
, PickleIterator
* iter
, param_type
* p
);
351 static void Log(const param_type
& p
, std::string
* l
);
356 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
358 IPC_ENUM_TRAITS_MAX_VALUE(
359 ExtensionHostMsg_AutomationQuerySelector_Error::Value
,
360 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed
)
362 IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error
)
363 IPC_STRUCT_TRAITS_MEMBER(value
)
364 IPC_STRUCT_TRAITS_END()
366 // Parameters structure for ExtensionMsg_UpdatePermissions.
367 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params
)
368 IPC_STRUCT_MEMBER(std::string
, extension_id
)
369 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, active_permissions
)
370 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct
, withheld_permissions
)
373 // Messages sent from the browser to the renderer.
375 // The browser sends this message in response to all extension api calls. The
376 // response data (if any) is one of the base::Value subclasses, wrapped as the
377 // first element in a ListValue.
378 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response
,
379 int /* request_id */,
381 base::ListValue
/* response wrapper (see comment above) */,
382 std::string
/* error */)
384 // This message is optionally routed. If used as a control message, it will
385 // call a javascript function |function_name| from module |module_name| in
386 // every registered context in the target process. If routed, it will be
387 // restricted to the contexts that are part of the target RenderView.
389 // If |extension_id| is non-empty, the function will be invoked only in
390 // contexts owned by the extension. |args| is a list of primitive Value types
391 // that are passed to the function.
392 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke
,
393 std::string
/* extension_id */,
394 std::string
/* module_name */,
395 std::string
/* function_name */,
396 base::ListValue
/* args */,
397 bool /* delivered as part of a user gesture */)
399 // Tell the renderer process all known extension function names.
400 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames
,
401 std::vector
<std::string
>)
403 // Set the top-level frame to the provided name.
404 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName
,
405 std::string
/* frame_name */)
407 // Tell the renderer process the platforms system font.
408 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont
,
409 std::string
/* font_family */,
410 std::string
/* font_size */)
412 // Marks an extension as 'active' in an extension process. 'Active' extensions
413 // have more privileges than other extension content that might end up running
414 // in the process (e.g. because of iframes or content scripts).
415 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension
,
416 std::string
/* extension_id */)
418 // Notifies the renderer that extensions were loaded in the browser.
419 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded
,
420 std::vector
<ExtensionMsg_Loaded_Params
>)
422 // Notifies the renderer that an extension was unloaded in the browser.
423 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded
,
426 // Updates the scripting whitelist for extensions in the render process. This is
427 // only used for testing.
428 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist
,
430 extensions::ExtensionsClient::ScriptingWhitelist
)
432 // Notification that renderer should run some JavaScript code.
433 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode
,
434 ExtensionMsg_ExecuteCode_Params
)
436 // Notification that the user scripts have been updated. It has one
437 // SharedMemoryHandle argument consisting of the pickled script data. This
438 // handle is valid in the context of the renderer.
439 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
440 // programmatically-defined scripts. Otherwise, the handle refers to all
441 // extensions' statically defined scripts.
442 // If |changed_extensions| is not empty, only the extensions in that set will
443 // be updated. Otherwise, all extensions that have scripts in the shared memory
444 // region will be updated. Note that the empty set => all extensions case is not
445 // supported for per-extension programmatically-defined script regions; in such
446 // regions, the owner is expected to list itself as the only changed extension.
447 IPC_MESSAGE_CONTROL3(ExtensionMsg_UpdateUserScripts
,
448 base::SharedMemoryHandle
,
449 extensions::ExtensionId
/* owner */,
450 std::set
<std::string
> /* changed extensions */)
452 // Trigger to execute declarative content script under browser control.
453 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript
,
454 int /* tab identifier */,
455 extensions::ExtensionId
/* extension identifier */,
456 int /* script identifier */,
457 GURL
/* page URL where script should be injected */)
459 // Tell the render view which browser window it's being attached to.
460 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId
,
461 int /* id of browser window */)
463 // Tell the render view what its tab ID is.
464 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId
,
467 // Tell the renderer to update an extension's permission set.
468 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions
,
469 ExtensionMsg_UpdatePermissions_Params
)
471 // Tell the render view about new tab-specific permissions for an extension.
472 IPC_MESSAGE_ROUTED3(ExtensionMsg_UpdateTabSpecificPermissions
,
474 std::string
/* extension_id */,
475 extensions::URLPatternSet
/* hosts */)
477 // Tell the render view to clear tab-specific permissions for some extensions.
478 IPC_MESSAGE_ROUTED1(ExtensionMsg_ClearTabSpecificPermissions
,
479 std::vector
<std::string
> /* extension_ids */)
481 // Tell the renderer which type this view is.
482 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType
,
483 extensions::ViewType
/* view_type */)
485 // Deliver a message sent with ExtensionHostMsg_PostMessage.
486 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI
,
487 bool /* webrequest_used */)
489 // Ask the lazy background page if it is ready to be suspended. This is sent
490 // when the page is considered idle. The renderer will reply with the same
491 // sequence_id so that we can tell which message it is responding to.
492 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend
,
493 std::string
/* extension_id */,
494 uint64
/* sequence_id */)
496 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
497 // the lazy background page becoming active again, we are ready to unload. This
498 // message tells the page to dispatch the suspend event.
499 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend
,
500 std::string
/* extension_id */)
502 // The browser changed its mind about suspending this extension.
503 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend
,
504 std::string
/* extension_id */)
506 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
507 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse
,
508 std::string
/* state */,
509 int32
/* callback_id */)
511 // Dispatch the Port.onConnect event for message channels.
512 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect
,
513 int /* target_port_id */,
514 std::string
/* channel_name */,
515 ExtensionMsg_TabConnectionInfo
/* source */,
516 ExtensionMsg_ExternalConnectionInfo
,
517 std::string
/* tls_channel_id */)
519 // Deliver a message sent with ExtensionHostMsg_PostMessage.
520 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage
,
521 int /* target_port_id */,
524 // Dispatch the Port.onDisconnect event for message channels.
525 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect
,
527 std::string
/* error_message */)
529 // Informs the renderer what channel (dev, beta, stable, etc) is running.
530 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel
,
533 // Adds a logging message to the renderer's root frame DevTools console.
534 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole
,
535 content::ConsoleMessageLevel
/* level */,
536 std::string
/* message */)
538 // Notify the renderer that its window has closed.
539 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed
)
541 // Notify the renderer that an extension wants notifications when certain
542 // searches match the active page. This message replaces the old set of
543 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
544 // each tab to keep the browser updated about changes.
545 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages
,
546 std::vector
<std::string
> /* CSS selectors */)
548 // Send by the browser to indicate a Blob handle has been transferred to the
549 // renderer. This is sent after the actual extension response, and depends on
550 // the sequential nature of IPCs so that the blob has already been caught.
551 // This is a separate control message, so that the renderer process will send
552 // an acknowledgement even if the RenderView has closed or navigated away.
553 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs
,
554 std::vector
<std::string
> /* blob_uuids */)
556 // The ACK for ExtensionHostMsg_CreateMimeHandlerViewGuest.
557 IPC_MESSAGE_CONTROL1(ExtensionMsg_CreateMimeHandlerViewGuestACK
,
558 int /* element_instance_id */)
560 // Once a MimeHandlerView guest's JavaScript onload function has been called,
561 // this IPC is sent to the container to notify it.
562 IPC_MESSAGE_CONTROL1(ExtensionMsg_MimeHandlerViewGuestOnLoadCompleted
,
563 int /* element_instance_id */)
565 // Once a RenderView proxy has been created for the guest in the embedder render
566 // process, this IPC informs the embedder of the proxy's routing ID.
567 IPC_MESSAGE_CONTROL2(ExtensionMsg_GuestAttached
,
568 int /* element_instance_id */,
569 int /* source_routing_id */)
571 // This IPC tells the browser process to detach the provided
572 // |element_instance_id| from a GuestViewBase if it is attached to one.
573 // In other words, routing of input and graphics will no longer flow through
574 // the container associated with the provided ID.
575 IPC_MESSAGE_CONTROL1(ExtensionMsg_GuestDetached
,
576 int /* element_instance_id*/)
578 // Messages sent from the renderer to the browser.
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_ROUTED1(ExtensionHostMsg_Request
,
583 ExtensionHostMsg_Request_Params
)
585 // A renderer sends this message when an extension process starts an API
586 // request. The browser will always respond with a ExtensionMsg_Response.
587 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread
,
588 int /* routing_id */,
589 ExtensionHostMsg_Request_Params
)
591 // Notify the browser that the given extension added a listener to an event.
592 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener
,
593 std::string
/* extension_id */,
594 GURL
/* listener_url */,
595 std::string
/* name */)
597 // Notify the browser that the given extension removed a listener from an
599 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener
,
600 std::string
/* extension_id */,
601 GURL
/* listener_url */,
602 std::string
/* name */)
604 // Notify the browser that the given extension added a listener to an event from
605 // a lazy background page.
606 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener
,
607 std::string
/* extension_id */,
608 std::string
/* name */)
610 // Notify the browser that the given extension is no longer interested in
611 // receiving the given event from a lazy background page.
612 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener
,
613 std::string
/* extension_id */,
614 std::string
/* name */)
616 // Notify the browser that the given extension added a listener to instances of
617 // the named event that satisfy the filter.
618 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener
,
619 std::string
/* extension_id */,
620 std::string
/* name */,
621 base::DictionaryValue
/* filter */,
624 // Notify the browser that the given extension is no longer interested in
625 // instances of the named event that satisfy the filter.
626 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener
,
627 std::string
/* extension_id */,
628 std::string
/* name */,
629 base::DictionaryValue
/* filter */,
632 // Notify the browser that an event has finished being dispatched.
633 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck
)
635 // Open a channel to all listening contexts owned by the extension with
636 // the given ID. This always returns a valid port ID which can be used for
637 // sending messages. If an error occurred, the opener will be notified
639 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension
,
640 int /* routing_id */,
641 ExtensionMsg_ExternalConnectionInfo
,
642 std::string
/* channel_name */,
643 bool /* include_tls_channel_id */,
646 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp
,
647 int /* routing_id */,
648 std::string
/* source_extension_id */,
649 std::string
/* native_app_name */,
652 // Get a port handle to the given tab. The handle can be used for sending
653 // messages to the extension.
654 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab
,
655 int /* routing_id */,
656 ExtensionMsg_TabTargetConnectionInfo
,
657 std::string
/* extension_id */,
658 std::string
/* channel_name */,
661 // Send a message to an extension process. The handle is the value returned
662 // by ViewHostMsg_OpenChannelTo*.
663 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage
,
667 // Send a message to an extension process. The handle is the value returned
668 // by ViewHostMsg_OpenChannelTo*.
669 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel
,
671 std::string
/* error_message */)
673 // Used to get the extension message bundle.
674 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle
,
675 std::string
/* extension id */,
676 SubstitutionMap
/* message bundle */)
678 // Sent from the renderer to the browser to return the script running result.
680 ExtensionHostMsg_ExecuteCodeFinished
,
681 int /* request id */,
682 std::string
/* error; empty implies success */,
683 GURL
/* URL of the code executed on. May be empty if unsuccessful. */,
684 base::ListValue
/* result of the script */)
686 // Sent from the renderer to the browser to notify that content scripts are
687 // running in the renderer that the IPC originated from.
688 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting
,
690 GURL
/* url of the _topmost_ frame */)
692 // Sent from the renderer to the browser to request permission for a script
694 // If request id is -1, this signals that the request has already ran, and this
695 // merely serves as a notification. This happens when the feature to disable
696 // scripts running without user consent is not enabled.
697 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission
,
698 std::string
/* extension id */,
699 extensions::UserScript::InjectionType
/* script type */,
700 int64
/* request id */)
702 // Sent from the browser to the renderer in reply to a
703 // RequestScriptInjectionPermission message, granting permission for a script
705 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection
,
706 int64
/* request id */)
708 // Sent by the renderer when a web page is checking if its app is installed.
709 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState
,
710 GURL
/* requestor_url */,
711 int32
/* return_route_id */,
712 int32
/* callback_id */)
714 // Optional Ack message sent to the browser to notify that the response to a
715 // function has been processed.
716 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck
,
717 int /* request_id */)
719 // Response to ExtensionMsg_ShouldSuspend.
720 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck
,
721 std::string
/* extension_id */,
722 uint64
/* sequence_id */)
724 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
725 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck
,
726 std::string
/* extension_id */)
728 // Informs the browser to increment the keepalive count for the lazy background
729 // page, keeping it alive.
730 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount
)
732 // Informs the browser there is one less thing keeping the lazy background page
734 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount
)
736 // Fetches a globally unique ID (for the lifetime of the browser) from the
738 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID
,
741 // Resumes resource requests for a newly created app window.
742 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests
, int /* route_id */)
744 // Sent by the renderer when the draggable regions are updated.
745 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions
,
746 std::vector
<extensions::DraggableRegion
> /* regions */)
748 // Sent by the renderer to log an API action to the extension activity log.
749 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog
,
750 std::string
/* extension_id */,
751 ExtensionHostMsg_APIActionOrEvent_Params
)
753 // Sent by the renderer to log an event to the extension activity log.
754 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog
,
755 std::string
/* extension_id */,
756 ExtensionHostMsg_APIActionOrEvent_Params
)
758 // Sent by the renderer to log a DOM action to the extension activity log.
759 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog
,
760 std::string
/* extension_id */,
761 ExtensionHostMsg_DOMAction_Params
)
763 // Notifies the browser process that a tab has started or stopped matching
764 // certain conditions. This message is sent in response to several events:
766 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
767 // * A new page is loaded. This will be sent after
768 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
770 // * Something changed on an existing frame causing the set of matching searches
772 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange
,
773 std::vector
<std::string
> /* Matching CSS selectors */)
775 // Sent by the renderer when it has received a Blob handle from the browser.
776 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck
,
777 std::vector
<std::string
> /* blob_uuids */)
779 // Informs of updated frame names.
780 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_FrameNameChanged
,
781 bool /* is_top_level */,
782 std::string
/* name */)
784 // Tells listeners that a detailed message was reported to the console by
786 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded
,
787 base::string16
/* message */,
788 base::string16
/* source */,
789 extensions::StackTrace
/* stack trace */,
790 int32
/* severity level */)
792 // Sent by the renderer to set initialization parameters of a Browser Plugin
793 // that is identified by |element_instance_id|.
794 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AttachGuest
,
795 int /* routing_id */,
796 int /* element_instance_id */,
797 int /* guest_instance_id */,
798 base::DictionaryValue
/* attach_params */)
800 // Tells the browser to create a mime handler guest view for a plugin.
801 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_CreateMimeHandlerViewGuest
,
802 int /* render_frame_id */,
803 std::string
/* view_id */,
804 int /* element_instance_id */,
805 gfx::Size
/* element_size */)
807 // Sent when a query selector request is made from the automation API.
808 // acc_obj_id is the accessibility tree ID of the starting element.
809 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector
,
810 int /* request_id */,
811 int /* acc_obj_id */,
812 base::string16
/* selector */)
814 // Result of a query selector request.
815 // result_acc_obj_id is the accessibility tree ID of the result element; 0
816 // indicates no result.
817 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result
,
818 int /* request_id */,
819 ExtensionHostMsg_AutomationQuerySelector_Error
/* error */,
820 int /* result_acc_obj_id */)