Don't show supervised user as "already on this device" while they're being imported.
[chromium-blink-merge.git] / extensions / common / extension_messages.h
blob5dc4981682a69cf7c788e8d78db5569c7d076357
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 all frames, or only the root frame.
125 IPC_STRUCT_MEMBER(bool, all_frames)
127 // Whether to inject into about:blank (sub)frames.
128 IPC_STRUCT_MEMBER(bool, match_about_blank)
130 // When to inject the code.
131 IPC_STRUCT_MEMBER(int, run_at)
133 // Whether to execute code in the main world (as opposed to an isolated
134 // world).
135 IPC_STRUCT_MEMBER(bool, in_main_world)
137 // Whether the request is coming from a <webview>.
138 IPC_STRUCT_MEMBER(bool, is_web_view)
140 // Whether the caller is interested in the result value. Manifest-declared
141 // content scripts and executeScript() calls without a response callback
142 // are examples of when this will be false.
143 IPC_STRUCT_MEMBER(bool, wants_result)
145 // The URL of the file that was injected, if any.
146 IPC_STRUCT_MEMBER(GURL, file_url)
148 // Whether the code to be executed should be associated with a user gesture.
149 IPC_STRUCT_MEMBER(bool, user_gesture)
150 IPC_STRUCT_END()
152 // Struct containing information about the sender of connect() calls that
153 // originate from a tab.
154 IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo)
155 // The tab from where the connection was created.
156 IPC_STRUCT_MEMBER(base::DictionaryValue, tab)
158 // The ID of the frame that initiated the connection.
159 // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
160 IPC_STRUCT_MEMBER(int, frame_id)
161 IPC_STRUCT_END()
163 // Struct containing information about the destination of tab.connect().
164 IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo)
165 // The destination tab's ID.
166 IPC_STRUCT_MEMBER(int, tab_id)
168 // Frame ID of the destination. -1 for all frames, 0 for main frame and
169 // positive if the destination is a specific child frame.
170 IPC_STRUCT_MEMBER(int, frame_id)
171 IPC_STRUCT_END()
173 // Struct containing the data for external connections to extensions. Used to
174 // handle the IPCs initiated by both connect() and onConnect().
175 IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo)
176 // The ID of the extension that is the target of the request.
177 IPC_STRUCT_MEMBER(std::string, target_id)
179 // The ID of the extension that initiated the request. May be empty if it
180 // wasn't initiated by an extension.
181 IPC_STRUCT_MEMBER(std::string, source_id)
183 // The URL of the frame that initiated the request.
184 IPC_STRUCT_MEMBER(GURL, source_url)
186 // The ID of the frame that is the target of the request.
187 IPC_STRUCT_MEMBER(int, target_frame_id)
189 // The process ID of the webview that initiated the request.
190 IPC_STRUCT_MEMBER(int, guest_process_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, 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, 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, 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, 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, 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, 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, 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, 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 // Adds a logging message to the renderer's root frame DevTools console.
554 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole,
555 content::ConsoleMessageLevel /* level */,
556 std::string /* message */)
558 // Notify the renderer that its window has closed.
559 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
561 // Notify the renderer that an extension wants notifications when certain
562 // searches match the active page. This message replaces the old set of
563 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
564 // each tab to keep the browser updated about changes.
565 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
566 std::vector<std::string> /* CSS selectors */)
568 // Send by the browser to indicate a Blob handle has been transferred to the
569 // renderer. This is sent after the actual extension response, and depends on
570 // the sequential nature of IPCs so that the blob has already been caught.
571 // This is a separate control message, so that the renderer process will send
572 // an acknowledgement even if the RenderView has closed or navigated away.
573 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
574 std::vector<std::string> /* blob_uuids */)
576 // Messages sent from the renderer to the browser.
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_ROUTED1(ExtensionHostMsg_Request,
581 ExtensionHostMsg_Request_Params)
583 // A renderer sends this message when an extension process starts an API
584 // request. The browser will always respond with a ExtensionMsg_Response.
585 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
586 int /* routing_id */,
587 ExtensionHostMsg_Request_Params)
589 // Notify the browser that the given extension added a listener to an event.
590 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener,
591 std::string /* extension_id */,
592 GURL /* listener_url */,
593 std::string /* name */)
595 // Notify the browser that the given extension removed a listener from an
596 // event.
597 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener,
598 std::string /* extension_id */,
599 GURL /* listener_url */,
600 std::string /* name */)
602 // Notify the browser that the given extension added a listener to an event from
603 // a lazy background page.
604 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
605 std::string /* extension_id */,
606 std::string /* name */)
608 // Notify the browser that the given extension is no longer interested in
609 // receiving the given event from a lazy background page.
610 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
611 std::string /* extension_id */,
612 std::string /* name */)
614 // Notify the browser that the given extension added a listener to instances of
615 // the named event that satisfy the filter.
616 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener,
617 std::string /* extension_id */,
618 std::string /* name */,
619 base::DictionaryValue /* filter */,
620 bool /* lazy */)
622 // Notify the browser that the given extension is no longer interested in
623 // instances of the named event that satisfy the filter.
624 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener,
625 std::string /* extension_id */,
626 std::string /* name */,
627 base::DictionaryValue /* filter */,
628 bool /* lazy */)
630 // Notify the browser that an event has finished being dispatched.
631 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
633 // Open a channel to all listening contexts owned by the extension with
634 // the given ID. This always returns a valid port ID which can be used for
635 // sending messages. If an error occurred, the opener will be notified
636 // asynchronously.
637 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension,
638 int /* routing_id */,
639 ExtensionMsg_ExternalConnectionInfo,
640 std::string /* channel_name */,
641 bool /* include_tls_channel_id */,
642 int /* port_id */)
644 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp,
645 int /* routing_id */,
646 std::string /* source_extension_id */,
647 std::string /* native_app_name */,
648 int /* port_id */)
650 // Get a port handle to the given tab. The handle can be used for sending
651 // messages to the extension.
652 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab,
653 int /* routing_id */,
654 ExtensionMsg_TabTargetConnectionInfo,
655 std::string /* extension_id */,
656 std::string /* channel_name */,
657 int /* port_id */)
659 // Send a message to an extension process. The handle is the value returned
660 // by ViewHostMsg_OpenChannelTo*.
661 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
662 int /* port_id */,
663 extensions::Message)
665 // Send a message to an extension process. The handle is the value returned
666 // by ViewHostMsg_OpenChannelTo*.
667 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
668 int /* port_id */,
669 std::string /* error_message */)
671 // Used to get the extension message bundle.
672 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
673 std::string /* extension id */,
674 SubstitutionMap /* message bundle */)
676 // Sent from the renderer to the browser to return the script running result.
677 IPC_MESSAGE_ROUTED4(
678 ExtensionHostMsg_ExecuteCodeFinished,
679 int /* request id */,
680 std::string /* error; empty implies success */,
681 GURL /* URL of the code executed on. May be empty if unsuccessful. */,
682 base::ListValue /* result of the script */)
684 // Sent from the renderer to the browser to notify that content scripts are
685 // running in the renderer that the IPC originated from.
686 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
687 ExecutingScriptsMap,
688 GURL /* url of the _topmost_ frame */)
690 // Sent from the renderer to the browser to request permission for a script
691 // injection.
692 // If request id is -1, this signals that the request has already ran, and this
693 // merely serves as a notification. This happens when the feature to disable
694 // scripts running without user consent is not enabled.
695 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission,
696 std::string /* extension id */,
697 extensions::UserScript::InjectionType /* script type */,
698 int64 /* request id */)
700 // Sent from the browser to the renderer in reply to a
701 // RequestScriptInjectionPermission message, granting permission for a script
702 // script to run.
703 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection,
704 int64 /* request id */)
706 // Sent by the renderer when a web page is checking if its app is installed.
707 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
708 GURL /* requestor_url */,
709 int32 /* return_route_id */,
710 int32 /* callback_id */)
712 // Optional Ack message sent to the browser to notify that the response to a
713 // function has been processed.
714 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
715 int /* request_id */)
717 // Response to ExtensionMsg_ShouldSuspend.
718 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
719 std::string /* extension_id */,
720 uint64 /* sequence_id */)
722 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
723 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
724 std::string /* extension_id */)
726 // Informs the browser to increment the keepalive count for the lazy background
727 // page, keeping it alive.
728 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
730 // Informs the browser there is one less thing keeping the lazy background page
731 // alive.
732 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
734 // Fetches a globally unique ID (for the lifetime of the browser) from the
735 // browser process.
736 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
737 int /* unique_id */)
739 // Resumes resource requests for a newly created app window.
740 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */)
742 // Sent by the renderer when the draggable regions are updated.
743 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
744 std::vector<extensions::DraggableRegion> /* regions */)
746 // Sent by the renderer to log an API action to the extension activity log.
747 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
748 std::string /* extension_id */,
749 ExtensionHostMsg_APIActionOrEvent_Params)
751 // Sent by the renderer to log an event to the extension activity log.
752 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
753 std::string /* extension_id */,
754 ExtensionHostMsg_APIActionOrEvent_Params)
756 // Sent by the renderer to log a DOM action to the extension activity log.
757 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
758 std::string /* extension_id */,
759 ExtensionHostMsg_DOMAction_Params)
761 // Notifies the browser process that a tab has started or stopped matching
762 // certain conditions. This message is sent in response to several events:
764 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
765 // * A new page is loaded. This will be sent after
766 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
767 // main frame.
768 // * Something changed on an existing frame causing the set of matching searches
769 // to change.
770 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
771 std::vector<std::string> /* Matching CSS selectors */)
773 // Sent by the renderer when it has received a Blob handle from the browser.
774 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck,
775 std::vector<std::string> /* blob_uuids */)
777 // Tells listeners that a detailed message was reported to the console by
778 // WebKit.
779 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
780 base::string16 /* message */,
781 base::string16 /* source */,
782 extensions::StackTrace /* stack trace */,
783 int32 /* severity level */)
785 // Sent when a query selector request is made from the automation API.
786 // acc_obj_id is the accessibility tree ID of the starting element.
787 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector,
788 int /* request_id */,
789 int /* acc_obj_id */,
790 base::string16 /* selector */)
792 // Result of a query selector request.
793 // result_acc_obj_id is the accessibility tree ID of the result element; 0
794 // indicates no result.
795 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result,
796 int /* request_id */,
797 ExtensionHostMsg_AutomationQuerySelector_Error /* error */,
798 int /* result_acc_obj_id */)