Renamed NQP to EEPAndroid
[chromium-blink-merge.git] / extensions / common / extension_messages.h
blob49aee480fc40573b2ac61d690fcb2b241684883e
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/host_id.h"
20 #include "extensions/common/permissions/media_galleries_permission_data.h"
21 #include "extensions/common/permissions/permission_set.h"
22 #include "extensions/common/permissions/socket_permission_data.h"
23 #include "extensions/common/permissions/usb_device_permission_data.h"
24 #include "extensions/common/stack_frame.h"
25 #include "extensions/common/url_pattern.h"
26 #include "extensions/common/url_pattern_set.h"
27 #include "extensions/common/user_script.h"
28 #include "extensions/common/view_type.h"
29 #include "ipc/ipc_message_macros.h"
30 #include "ui/gfx/ipc/gfx_param_traits.h"
31 #include "url/gurl.h"
33 #define IPC_MESSAGE_START ExtensionMsgStart
35 IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType, extensions::VIEW_TYPE_LAST)
36 IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType,
37 content::SocketPermissionRequest::OPERATION_TYPE_LAST)
39 IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType,
40 extensions::UserScript::INJECTION_TYPE_LAST)
42 IPC_ENUM_TRAITS_MAX_VALUE(HostID::HostType, HostID::HOST_TYPE_LAST)
44 // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
45 // ExtensionHostMsg_AddEventToActivityLog.
46 IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params)
47 // API name.
48 IPC_STRUCT_MEMBER(std::string, api_call)
50 // List of arguments.
51 IPC_STRUCT_MEMBER(base::ListValue, arguments)
53 // Extra logging information.
54 IPC_STRUCT_MEMBER(std::string, extra)
55 IPC_STRUCT_END()
57 // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
58 IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params)
59 // URL of the page.
60 IPC_STRUCT_MEMBER(GURL, url)
62 // Title of the page.
63 IPC_STRUCT_MEMBER(base::string16, url_title)
65 // API name.
66 IPC_STRUCT_MEMBER(std::string, api_call)
68 // List of arguments.
69 IPC_STRUCT_MEMBER(base::ListValue, arguments)
71 // Type of DOM API call.
72 IPC_STRUCT_MEMBER(int, call_type)
73 IPC_STRUCT_END()
75 // Parameters structure for ExtensionHostMsg_Request.
76 IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params)
77 // Message name.
78 IPC_STRUCT_MEMBER(std::string, name)
80 // List of message arguments.
81 IPC_STRUCT_MEMBER(base::ListValue, arguments)
83 // Extension ID this request was sent from. This can be empty, in the case
84 // where we expose APIs to normal web pages using the extension function
85 // system.
86 IPC_STRUCT_MEMBER(std::string, extension_id)
88 // URL of the frame the request was sent from. This isn't necessarily an
89 // extension url. Extension requests can also originate from content scripts,
90 // in which case extension_id will indicate the ID of the associated
91 // extension. Or, they can originate from hosted apps or normal web pages.
92 IPC_STRUCT_MEMBER(GURL, source_url)
94 // The id of the tab that sent this request, or -1 if there is no source tab.
95 IPC_STRUCT_MEMBER(int, source_tab_id)
97 // Unique request id to match requests and responses.
98 IPC_STRUCT_MEMBER(int, request_id)
100 // True if request has a callback specified.
101 IPC_STRUCT_MEMBER(bool, has_callback)
103 // True if request is executed in response to an explicit user gesture.
104 IPC_STRUCT_MEMBER(bool, user_gesture)
105 IPC_STRUCT_END()
107 // Allows an extension to execute code in a tab.
108 IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params)
109 // The extension API request id, for responding.
110 IPC_STRUCT_MEMBER(int, request_id)
112 // The ID of the requesting injection host.
113 IPC_STRUCT_MEMBER(HostID, host_id)
115 // Whether the code is JavaScript or CSS.
116 IPC_STRUCT_MEMBER(bool, is_javascript)
118 // String of code to execute.
119 IPC_STRUCT_MEMBER(std::string, code)
121 // The webview guest source who calls to execute code.
122 IPC_STRUCT_MEMBER(GURL, webview_src)
124 // Whether to inject into about:blank (sub)frames.
125 IPC_STRUCT_MEMBER(bool, match_about_blank)
127 // When to inject the code.
128 IPC_STRUCT_MEMBER(int, run_at)
130 // Whether to execute code in the main world (as opposed to an isolated
131 // world).
132 IPC_STRUCT_MEMBER(bool, in_main_world)
134 // Whether the request is coming from a <webview>.
135 IPC_STRUCT_MEMBER(bool, is_web_view)
137 // Whether the caller is interested in the result value. Manifest-declared
138 // content scripts and executeScript() calls without a response callback
139 // are examples of when this will be false.
140 IPC_STRUCT_MEMBER(bool, wants_result)
142 // The URL of the file that was injected, if any.
143 IPC_STRUCT_MEMBER(GURL, file_url)
145 // Whether the code to be executed should be associated with a user gesture.
146 IPC_STRUCT_MEMBER(bool, user_gesture)
147 IPC_STRUCT_END()
149 // Struct containing information about the sender of connect() calls that
150 // originate from a tab.
151 IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo)
152 // The tab from where the connection was created.
153 IPC_STRUCT_MEMBER(base::DictionaryValue, tab)
155 // The ID of the frame that initiated the connection.
156 // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
157 IPC_STRUCT_MEMBER(int, frame_id)
158 IPC_STRUCT_END()
160 // Struct containing information about the destination of tab.connect().
161 IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo)
162 // The destination tab's ID.
163 IPC_STRUCT_MEMBER(int, tab_id)
165 // Frame ID of the destination. -1 for all frames, 0 for main frame and
166 // positive if the destination is a specific child frame.
167 IPC_STRUCT_MEMBER(int, frame_id)
168 IPC_STRUCT_END()
170 // Struct containing the data for external connections to extensions. Used to
171 // handle the IPCs initiated by both connect() and onConnect().
172 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo)
173 // The ID of the extension that is the target of the request.
174 IPC_STRUCT_MEMBER(std::string, target_id)
176 // The ID of the extension that initiated the request. May be empty if it
177 // wasn't initiated by an extension.
178 IPC_STRUCT_MEMBER(std::string, source_id)
180 // The URL of the frame that initiated the request.
181 IPC_STRUCT_MEMBER(GURL, source_url)
183 // The ID of the frame that is the target of the request.
184 IPC_STRUCT_MEMBER(int, target_frame_id)
186 // The process ID of the webview that initiated the request.
187 IPC_STRUCT_MEMBER(int, guest_process_id)
189 // The render frame routing ID of the webview that initiated the request.
190 IPC_STRUCT_MEMBER(int, guest_render_frame_routing_id)
191 IPC_STRUCT_END()
193 IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion)
194 IPC_STRUCT_TRAITS_MEMBER(draggable)
195 IPC_STRUCT_TRAITS_MEMBER(bounds)
196 IPC_STRUCT_TRAITS_END()
198 IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest)
199 IPC_STRUCT_TRAITS_MEMBER(type)
200 IPC_STRUCT_TRAITS_MEMBER(host)
201 IPC_STRUCT_TRAITS_MEMBER(port)
202 IPC_STRUCT_TRAITS_END()
204 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry)
205 IPC_STRUCT_TRAITS_MEMBER(pattern_)
206 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_)
207 IPC_STRUCT_TRAITS_END()
209 IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData)
210 IPC_STRUCT_TRAITS_MEMBER(entry())
211 IPC_STRUCT_TRAITS_END()
213 IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame)
214 IPC_STRUCT_TRAITS_MEMBER(line_number)
215 IPC_STRUCT_TRAITS_MEMBER(column_number)
216 IPC_STRUCT_TRAITS_MEMBER(source)
217 IPC_STRUCT_TRAITS_MEMBER(function)
218 IPC_STRUCT_TRAITS_END()
220 IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData)
221 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
222 IPC_STRUCT_TRAITS_MEMBER(product_id())
223 IPC_STRUCT_TRAITS_END()
225 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData)
226 IPC_STRUCT_TRAITS_MEMBER(permission())
227 IPC_STRUCT_TRAITS_END()
229 IPC_STRUCT_TRAITS_BEGIN(extensions::Message)
230 IPC_STRUCT_TRAITS_MEMBER(data)
231 IPC_STRUCT_TRAITS_MEMBER(user_gesture)
232 IPC_STRUCT_TRAITS_END()
234 // Singly-included section for custom IPC traits.
235 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
236 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
238 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
239 // to typedef it to avoid that.
240 // Substitution map for l10n messages.
241 typedef std::map<std::string, std::string> SubstitutionMap;
243 // Map of extensions IDs to the executing script paths.
244 typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap;
246 struct ExtensionMsg_PermissionSetStruct {
247 ExtensionMsg_PermissionSetStruct();
248 explicit ExtensionMsg_PermissionSetStruct(
249 const extensions::PermissionSet& permissions);
250 ~ExtensionMsg_PermissionSetStruct();
252 scoped_refptr<const extensions::PermissionSet> ToPermissionSet() const;
254 extensions::APIPermissionSet apis;
255 extensions::ManifestPermissionSet manifest_permissions;
256 extensions::URLPatternSet explicit_hosts;
257 extensions::URLPatternSet scriptable_hosts;
260 struct ExtensionMsg_Loaded_Params {
261 ExtensionMsg_Loaded_Params();
262 ~ExtensionMsg_Loaded_Params();
263 ExtensionMsg_Loaded_Params(const extensions::Extension* extension,
264 bool include_tab_permissions);
266 // Creates a new extension from the data in this object.
267 scoped_refptr<extensions::Extension> ConvertToExtension(
268 std::string* error) const;
270 // The subset of the extension manifest data we send to renderers.
271 linked_ptr<base::DictionaryValue> manifest;
273 // The location the extension was installed from.
274 extensions::Manifest::Location location;
276 // The path the extension was loaded from. This is used in the renderer only
277 // to generate the extension ID for extensions that are loaded unpacked.
278 base::FilePath path;
280 // The extension's active and withheld permissions.
281 ExtensionMsg_PermissionSetStruct active_permissions;
282 ExtensionMsg_PermissionSetStruct withheld_permissions;
283 std::map<int, ExtensionMsg_PermissionSetStruct> tab_specific_permissions;
285 // We keep this separate so that it can be used in logging.
286 std::string id;
288 // Send creation flags so extension is initialized identically.
289 int creation_flags;
292 struct ExtensionHostMsg_AutomationQuerySelector_Error {
293 enum Value { kNone, kNoMainFrame, kNoDocument, kNodeDestroyed };
295 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone) {}
297 Value value;
300 namespace IPC {
302 template <>
303 struct ParamTraits<URLPattern> {
304 typedef URLPattern param_type;
305 static void Write(Message* m, const param_type& p);
306 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p);
307 static void Log(const param_type& p, std::string* l);
310 template <>
311 struct ParamTraits<extensions::URLPatternSet> {
312 typedef extensions::URLPatternSet param_type;
313 static void Write(Message* m, const param_type& p);
314 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p);
315 static void Log(const param_type& p, std::string* l);
318 template <>
319 struct ParamTraits<extensions::APIPermission::ID> {
320 typedef extensions::APIPermission::ID param_type;
321 static void Write(Message* m, const param_type& p);
322 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p);
323 static void Log(const param_type& p, std::string* l);
326 template <>
327 struct ParamTraits<extensions::APIPermissionSet> {
328 typedef extensions::APIPermissionSet param_type;
329 static void Write(Message* m, const param_type& p);
330 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
331 static void Log(const param_type& p, std::string* l);
334 template <>
335 struct ParamTraits<extensions::ManifestPermissionSet> {
336 typedef extensions::ManifestPermissionSet param_type;
337 static void Write(Message* m, const param_type& p);
338 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
339 static void Log(const param_type& p, std::string* l);
342 template <>
343 struct ParamTraits<HostID> {
344 typedef HostID param_type;
345 static void Write(Message* m, const param_type& p);
346 static bool Read(const Message* m, base::PickleIterator* iter, param_type* r);
347 static void Log(const param_type& p, std::string* l);
350 template <>
351 struct ParamTraits<ExtensionMsg_PermissionSetStruct> {
352 typedef ExtensionMsg_PermissionSetStruct param_type;
353 static void Write(Message* m, const param_type& p);
354 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p);
355 static void Log(const param_type& p, std::string* l);
358 template <>
359 struct ParamTraits<ExtensionMsg_Loaded_Params> {
360 typedef ExtensionMsg_Loaded_Params param_type;
361 static void Write(Message* m, const param_type& p);
362 static bool Read(const Message* m, base::PickleIterator* iter, param_type* p);
363 static void Log(const param_type& p, std::string* l);
366 } // namespace IPC
368 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
370 IPC_ENUM_TRAITS_MAX_VALUE(
371 ExtensionHostMsg_AutomationQuerySelector_Error::Value,
372 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed)
374 IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error)
375 IPC_STRUCT_TRAITS_MEMBER(value)
376 IPC_STRUCT_TRAITS_END()
378 // Parameters structure for ExtensionMsg_UpdatePermissions.
379 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params)
380 IPC_STRUCT_MEMBER(std::string, extension_id)
381 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, active_permissions)
382 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, withheld_permissions)
383 IPC_STRUCT_END()
385 // Messages sent from the browser to the renderer.
387 // The browser sends this message in response to all extension api calls. The
388 // response data (if any) is one of the base::Value subclasses, wrapped as the
389 // first element in a ListValue.
390 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response,
391 int /* request_id */,
392 bool /* success */,
393 base::ListValue /* response wrapper (see comment above) */,
394 std::string /* error */)
396 // This message is optionally routed. If used as a control message, it will
397 // call a javascript function |function_name| from module |module_name| in
398 // every registered context in the target process. If routed, it will be
399 // restricted to the contexts that are part of the target RenderView.
401 // If |extension_id| is non-empty, the function will be invoked only in
402 // contexts owned by the extension. |args| is a list of primitive Value types
403 // that are passed to the function.
404 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke,
405 std::string /* extension_id */,
406 std::string /* module_name */,
407 std::string /* function_name */,
408 base::ListValue /* args */,
409 bool /* delivered as part of a user gesture */)
411 // Tell the renderer process all known extension function names.
412 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames,
413 std::vector<std::string>)
415 // Set the top-level frame to the provided name.
416 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName,
417 std::string /* frame_name */)
419 // Tell the renderer process the platforms system font.
420 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont,
421 std::string /* font_family */,
422 std::string /* font_size */)
424 // Marks an extension as 'active' in an extension process. 'Active' extensions
425 // have more privileges than other extension content that might end up running
426 // in the process (e.g. because of iframes or content scripts).
427 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension,
428 std::string /* extension_id */)
430 // Notifies the renderer that extensions were loaded in the browser.
431 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
432 std::vector<ExtensionMsg_Loaded_Params>)
434 // Notifies the renderer that an extension was unloaded in the browser.
435 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded,
436 std::string)
438 // Updates the scripting whitelist for extensions in the render process. This is
439 // only used for testing.
440 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
441 // extension ids
442 extensions::ExtensionsClient::ScriptingWhitelist)
444 // Notification that renderer should run some JavaScript code.
445 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode,
446 ExtensionMsg_ExecuteCode_Params)
448 // Notification that the user scripts have been updated. It has one
449 // SharedMemoryHandle argument consisting of the pickled script data. This
450 // handle is valid in the context of the renderer.
451 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
452 // programmatically-defined scripts. Otherwise, the handle refers to all
453 // hosts' statically defined scripts. So far, only extension-hosts support
454 // statically defined scripts; WebUI-hosts don't.
455 // If |changed_hosts| is not empty, only the host in that set will
456 // be updated. Otherwise, all hosts that have scripts in the shared memory
457 // region will be updated. Note that the empty set => all hosts case is not
458 // supported for per-extension programmatically-defined script regions; in such
459 // regions, the owner is expected to list itself as the only changed host.
460 // If |whitelisted_only| is true, this process should only run whitelisted
461 // scripts and not all user scripts.
462 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateUserScripts,
463 base::SharedMemoryHandle,
464 HostID /* owner */,
465 std::set<HostID> /* changed hosts */,
466 bool /* whitelisted_only */)
468 // Trigger to execute declarative content script under browser control.
469 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript,
470 int /* tab identifier */,
471 extensions::ExtensionId /* extension identifier */,
472 int /* script identifier */,
473 GURL /* page URL where script should be injected */)
475 // Tell the render view which browser window it's being attached to.
476 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId,
477 int /* id of browser window */)
479 // Tell the render view what its tab ID is.
480 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId,
481 int /* id of tab */)
483 // Tell the renderer to update an extension's permission set.
484 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions,
485 ExtensionMsg_UpdatePermissions_Params)
487 // Tell the render view about new tab-specific permissions for an extension.
488 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdateTabSpecificPermissions,
489 GURL /* url */,
490 std::string /* extension_id */,
491 extensions::URLPatternSet /* hosts */,
492 bool /* update origin whitelist */,
493 int /* tab_id */)
495 // Tell the render view to clear tab-specific permissions for some extensions.
496 IPC_MESSAGE_CONTROL3(ExtensionMsg_ClearTabSpecificPermissions,
497 std::vector<std::string> /* extension_ids */,
498 bool /* update origin whitelist */,
499 int /* tab_id */)
501 // Tell the renderer which type this view is.
502 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
503 extensions::ViewType /* view_type */)
505 // Deliver a message sent with ExtensionHostMsg_PostMessage.
506 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI,
507 bool /* webrequest_used */)
509 // Ask the lazy background page if it is ready to be suspended. This is sent
510 // when the page is considered idle. The renderer will reply with the same
511 // sequence_id so that we can tell which message it is responding to.
512 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend,
513 std::string /* extension_id */,
514 uint64 /* sequence_id */)
516 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
517 // the lazy background page becoming active again, we are ready to unload. This
518 // message tells the page to dispatch the suspend event.
519 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend,
520 std::string /* extension_id */)
522 // The browser changed its mind about suspending this extension.
523 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend,
524 std::string /* extension_id */)
526 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
527 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
528 std::string /* state */,
529 int32 /* callback_id */)
531 // Dispatch the Port.onConnect event for message channels.
532 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
533 int /* target_port_id */,
534 std::string /* channel_name */,
535 ExtensionMsg_TabConnectionInfo /* source */,
536 ExtensionMsg_ExternalConnectionInfo,
537 std::string /* tls_channel_id */)
539 // Deliver a message sent with ExtensionHostMsg_PostMessage.
540 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
541 int /* target_port_id */,
542 extensions::Message)
544 // Dispatch the Port.onDisconnect event for message channels.
545 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
546 int /* port_id */,
547 std::string /* error_message */)
549 // Informs the renderer what channel (dev, beta, stable, etc) is running.
550 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel,
551 int /* channel */)
553 // Notify the renderer that its window has closed.
554 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
556 // Notify the renderer that an extension wants notifications when certain
557 // searches match the active page. This message replaces the old set of
558 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
559 // each tab to keep the browser updated about changes.
560 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
561 std::vector<std::string> /* CSS selectors */)
563 // Send by the browser to indicate a Blob handle has been transferred to the
564 // renderer. This is sent after the actual extension response, and depends on
565 // the sequential nature of IPCs so that the blob has already been caught.
566 // This is a separate control message, so that the renderer process will send
567 // an acknowledgement even if the RenderView has closed or navigated away.
568 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
569 std::vector<std::string> /* blob_uuids */)
571 // Messages sent from the renderer to the browser.
573 // A renderer sends this message when an extension process starts an API
574 // request. The browser will always respond with a ExtensionMsg_Response.
575 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request,
576 ExtensionHostMsg_Request_Params)
578 // A renderer sends this message when an extension process starts an API
579 // request. The browser will always respond with a ExtensionMsg_Response.
580 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
581 int /* routing_id */,
582 ExtensionHostMsg_Request_Params)
584 // Notify the browser that the given extension added a listener to an event.
585 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener,
586 std::string /* extension_id */,
587 GURL /* listener_url */,
588 std::string /* name */)
590 // Notify the browser that the given extension removed a listener from an
591 // event.
592 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener,
593 std::string /* extension_id */,
594 GURL /* listener_url */,
595 std::string /* name */)
597 // Notify the browser that the given extension added a listener to an event from
598 // a lazy background page.
599 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
600 std::string /* extension_id */,
601 std::string /* name */)
603 // Notify the browser that the given extension is no longer interested in
604 // receiving the given event from a lazy background page.
605 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
606 std::string /* extension_id */,
607 std::string /* name */)
609 // Notify the browser that the given extension added a listener to instances of
610 // the named event that satisfy the filter.
611 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener,
612 std::string /* extension_id */,
613 std::string /* name */,
614 base::DictionaryValue /* filter */,
615 bool /* lazy */)
617 // Notify the browser that the given extension is no longer interested in
618 // instances of the named event that satisfy the filter.
619 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener,
620 std::string /* extension_id */,
621 std::string /* name */,
622 base::DictionaryValue /* filter */,
623 bool /* lazy */)
625 // Notify the browser that an event has finished being dispatched.
626 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
628 // Open a channel to all listening contexts owned by the extension with
629 // the given ID. This always returns a valid port ID which can be used for
630 // sending messages. If an error occurred, the opener will be notified
631 // asynchronously.
632 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension,
633 int /* routing_id */,
634 ExtensionMsg_ExternalConnectionInfo,
635 std::string /* channel_name */,
636 bool /* include_tls_channel_id */,
637 int /* port_id */)
639 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp,
640 int /* routing_id */,
641 std::string /* source_extension_id */,
642 std::string /* native_app_name */,
643 int /* port_id */)
645 // Get a port handle to the given tab. The handle can be used for sending
646 // messages to the extension.
647 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToTab,
648 ExtensionMsg_TabTargetConnectionInfo,
649 std::string /* extension_id */,
650 std::string /* channel_name */,
651 int /* port_id */)
653 // Send a message to an extension process. The handle is the value returned
654 // by ViewHostMsg_OpenChannelTo*.
655 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
656 int /* port_id */,
657 extensions::Message)
659 // Send a message to an extension process. The handle is the value returned
660 // by ViewHostMsg_OpenChannelTo*.
661 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
662 int /* port_id */,
663 std::string /* error_message */)
665 // Used to get the extension message bundle.
666 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
667 std::string /* extension id */,
668 SubstitutionMap /* message bundle */)
670 // Sent from the renderer to the browser to return the script running result.
671 IPC_MESSAGE_ROUTED4(
672 ExtensionHostMsg_ExecuteCodeFinished,
673 int /* request id */,
674 std::string /* error; empty implies success */,
675 GURL /* URL of the code executed on. May be empty if unsuccessful. */,
676 base::ListValue /* result of the script */)
678 // Sent from the renderer to the browser to notify that content scripts are
679 // running in the renderer that the IPC originated from.
680 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
681 ExecutingScriptsMap,
682 GURL /* url of the _topmost_ frame */)
684 // Sent from the renderer to the browser to request permission for a script
685 // injection.
686 // If request id is -1, this signals that the request has already ran, and this
687 // merely serves as a notification. This happens when the feature to disable
688 // scripts running without user consent is not enabled.
689 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission,
690 std::string /* extension id */,
691 extensions::UserScript::InjectionType /* script type */,
692 int64 /* request id */)
694 // Sent from the browser to the renderer in reply to a
695 // RequestScriptInjectionPermission message, granting permission for a script
696 // script to run.
697 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection,
698 int64 /* request id */)
700 // Sent by the renderer when a web page is checking if its app is installed.
701 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
702 GURL /* requestor_url */,
703 int32 /* return_route_id */,
704 int32 /* callback_id */)
706 // Optional Ack message sent to the browser to notify that the response to a
707 // function has been processed.
708 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
709 int /* request_id */)
711 // Response to ExtensionMsg_ShouldSuspend.
712 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
713 std::string /* extension_id */,
714 uint64 /* sequence_id */)
716 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
717 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
718 std::string /* extension_id */)
720 // Informs the browser to increment the keepalive count for the lazy background
721 // page, keeping it alive.
722 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
724 // Informs the browser there is one less thing keeping the lazy background page
725 // alive.
726 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
728 // Fetches a globally unique ID (for the lifetime of the browser) from the
729 // browser process.
730 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
731 int /* unique_id */)
733 // Notify the browser that an app window is ready and can resume resource
734 // requests.
735 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_AppWindowReady, int /* route_id */)
737 // Sent by the renderer when the draggable regions are updated.
738 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
739 std::vector<extensions::DraggableRegion> /* regions */)
741 // Sent by the renderer to log an API action to the extension activity log.
742 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
743 std::string /* extension_id */,
744 ExtensionHostMsg_APIActionOrEvent_Params)
746 // Sent by the renderer to log an event to the extension activity log.
747 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
748 std::string /* extension_id */,
749 ExtensionHostMsg_APIActionOrEvent_Params)
751 // Sent by the renderer to log a DOM action to the extension activity log.
752 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
753 std::string /* extension_id */,
754 ExtensionHostMsg_DOMAction_Params)
756 // Notifies the browser process that a tab has started or stopped matching
757 // certain conditions. This message is sent in response to several events:
759 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
760 // * A new page is loaded. This will be sent after
761 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
762 // main frame.
763 // * Something changed on an existing frame causing the set of matching searches
764 // to change.
765 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
766 std::vector<std::string> /* Matching CSS selectors */)
768 // Sent by the renderer when it has received a Blob handle from the browser.
769 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck,
770 std::vector<std::string> /* blob_uuids */)
772 // Tells listeners that a detailed message was reported to the console by
773 // WebKit.
774 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
775 base::string16 /* message */,
776 base::string16 /* source */,
777 extensions::StackTrace /* stack trace */,
778 int32 /* severity level */)
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 */)