Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / extensions / common / extension_messages.h
blobba980508291c6aa5df98354820f2f3aa0d68d6a5
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.
8 #include <string>
9 #include <vector>
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"
30 #include "url/gurl.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)
44 // API name.
45 IPC_STRUCT_MEMBER(std::string, api_call)
47 // List of arguments.
48 IPC_STRUCT_MEMBER(base::ListValue, arguments)
50 // Extra logging information.
51 IPC_STRUCT_MEMBER(std::string, extra)
52 IPC_STRUCT_END()
54 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
55 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params)
56 // URL of the page.
57 IPC_STRUCT_MEMBER(GURL, url)
59 // Title of the page.
60 IPC_STRUCT_MEMBER(base::string16, url_title)
62 // API name.
63 IPC_STRUCT_MEMBER(std::string, api_call)
65 // List of arguments.
66 IPC_STRUCT_MEMBER(base::ListValue, arguments)
68 // Type of DOM API call.
69 IPC_STRUCT_MEMBER(int, call_type)
70 IPC_STRUCT_END()
72 // Parameters structure for ExtensionHostMsg_Request.
73 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params)
74 // Message name.
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
82 // system.
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)
102 IPC_STRUCT_END()
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
132 // world).
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)
148 IPC_STRUCT_END()
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)
159 IPC_STRUCT_END()
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)
169 IPC_STRUCT_END()
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)
189 IPC_STRUCT_END()
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.
275 base::FilePath path;
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.
282 std::string id;
284 // Send creation flags so extension is initialized identically.
285 int creation_flags;
288 struct ExtensionHostMsg_AutomationQuerySelector_Error {
289 enum Value { kNone, kNoMainFrame, kNoDocument, kNodeDestroyed };
291 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone) {}
293 Value value;
296 namespace IPC {
298 template <>
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);
306 template <>
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);
314 template <>
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);
322 template <>
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);
330 template <>
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);
338 template <>
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);
346 template <>
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);
354 } // namespace IPC
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)
371 IPC_STRUCT_END()
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 */,
380 bool /* success */,
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,
424 std::string)
426 // Updates the scripting whitelist for extensions in the render process. This is
427 // only used for testing.
428 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
429 // extension ids
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,
465 int /* id of tab */)
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,
473 GURL /* url */,
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 */,
522 extensions::Message)
524 // Dispatch the Port.onDisconnect event for message channels.
525 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
526 int /* port_id */,
527 std::string /* error_message */)
529 // Informs the renderer what channel (dev, beta, stable, etc) is running.
530 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel,
531 int /* channel */)
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
598 // event.
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 */,
622 bool /* lazy */)
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 */,
630 bool /* lazy */)
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
638 // asynchronously.
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 */,
644 int /* port_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 */,
650 int /* port_id */)
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 */,
659 int /* port_id */)
661 // Send a message to an extension process. The handle is the value returned
662 // by ViewHostMsg_OpenChannelTo*.
663 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
664 int /* port_id */,
665 extensions::Message)
667 // Send a message to an extension process. The handle is the value returned
668 // by ViewHostMsg_OpenChannelTo*.
669 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
670 int /* port_id */,
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.
679 IPC_MESSAGE_ROUTED4(
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,
689 ExecutingScriptsMap,
690 GURL /* url of the _topmost_ frame */)
692 // Sent from the renderer to the browser to request permission for a script
693 // injection.
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
704 // script to run.
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
733 // alive.
734 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
736 // Fetches a globally unique ID (for the lifetime of the browser) from the
737 // browser process.
738 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
739 int /* unique_id */)
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
769 // main frame.
770 // * Something changed on an existing frame causing the set of matching searches
771 // to change.
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
785 // WebKit.
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 */)