Fix sort order of unlaunched apps on app list start page.
[chromium-blink-merge.git] / extensions / common / extension_messages.h
blobaee505c44a9d4b8a71a52d1648c842b9b56a2ced
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 ExtensionMsg_Loaded_Params(const extensions::Extension* extension,
262 bool include_tab_permissions);
264 // Creates a new extension from the data in this object.
265 scoped_refptr<extensions::Extension> ConvertToExtension(
266 std::string* error) const;
268 // The subset of the extension manifest data we send to renderers.
269 linked_ptr<base::DictionaryValue> manifest;
271 // The location the extension was installed from.
272 extensions::Manifest::Location location;
274 // The path the extension was loaded from. This is used in the renderer only
275 // to generate the extension ID for extensions that are loaded unpacked.
276 base::FilePath path;
278 // The extension's active and withheld permissions.
279 ExtensionMsg_PermissionSetStruct active_permissions;
280 ExtensionMsg_PermissionSetStruct withheld_permissions;
281 std::map<int, ExtensionMsg_PermissionSetStruct> tab_specific_permissions;
283 // We keep this separate so that it can be used in logging.
284 std::string id;
286 // Send creation flags so extension is initialized identically.
287 int creation_flags;
290 struct ExtensionHostMsg_AutomationQuerySelector_Error {
291 enum Value { kNone, kNoMainFrame, kNoDocument, kNodeDestroyed };
293 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone) {}
295 Value value;
298 namespace IPC {
300 template <>
301 struct ParamTraits<URLPattern> {
302 typedef URLPattern param_type;
303 static void Write(Message* m, const param_type& p);
304 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
305 static void Log(const param_type& p, std::string* l);
308 template <>
309 struct ParamTraits<extensions::URLPatternSet> {
310 typedef extensions::URLPatternSet param_type;
311 static void Write(Message* m, const param_type& p);
312 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
313 static void Log(const param_type& p, std::string* l);
316 template <>
317 struct ParamTraits<extensions::APIPermission::ID> {
318 typedef extensions::APIPermission::ID param_type;
319 static void Write(Message* m, const param_type& p);
320 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
321 static void Log(const param_type& p, std::string* l);
324 template <>
325 struct ParamTraits<extensions::APIPermissionSet> {
326 typedef extensions::APIPermissionSet param_type;
327 static void Write(Message* m, const param_type& p);
328 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
329 static void Log(const param_type& p, std::string* l);
332 template <>
333 struct ParamTraits<extensions::ManifestPermissionSet> {
334 typedef extensions::ManifestPermissionSet param_type;
335 static void Write(Message* m, const param_type& p);
336 static bool Read(const Message* m, PickleIterator* iter, param_type* r);
337 static void Log(const param_type& p, std::string* l);
340 template <>
341 struct ParamTraits<ExtensionMsg_PermissionSetStruct> {
342 typedef ExtensionMsg_PermissionSetStruct param_type;
343 static void Write(Message* m, const param_type& p);
344 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
345 static void Log(const param_type& p, std::string* l);
348 template <>
349 struct ParamTraits<ExtensionMsg_Loaded_Params> {
350 typedef ExtensionMsg_Loaded_Params param_type;
351 static void Write(Message* m, const param_type& p);
352 static bool Read(const Message* m, PickleIterator* iter, param_type* p);
353 static void Log(const param_type& p, std::string* l);
356 } // namespace IPC
358 #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
360 IPC_ENUM_TRAITS_MAX_VALUE(
361 ExtensionHostMsg_AutomationQuerySelector_Error::Value,
362 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed)
364 IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error)
365 IPC_STRUCT_TRAITS_MEMBER(value)
366 IPC_STRUCT_TRAITS_END()
368 // Parameters structure for ExtensionMsg_UpdatePermissions.
369 IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params)
370 IPC_STRUCT_MEMBER(std::string, extension_id)
371 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, active_permissions)
372 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, withheld_permissions)
373 IPC_STRUCT_END()
375 // Messages sent from the browser to the renderer.
377 // The browser sends this message in response to all extension api calls. The
378 // response data (if any) is one of the base::Value subclasses, wrapped as the
379 // first element in a ListValue.
380 IPC_MESSAGE_ROUTED4(ExtensionMsg_Response,
381 int /* request_id */,
382 bool /* success */,
383 base::ListValue /* response wrapper (see comment above) */,
384 std::string /* error */)
386 // This message is optionally routed. If used as a control message, it will
387 // call a javascript function |function_name| from module |module_name| in
388 // every registered context in the target process. If routed, it will be
389 // restricted to the contexts that are part of the target RenderView.
391 // If |extension_id| is non-empty, the function will be invoked only in
392 // contexts owned by the extension. |args| is a list of primitive Value types
393 // that are passed to the function.
394 IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke,
395 std::string /* extension_id */,
396 std::string /* module_name */,
397 std::string /* function_name */,
398 base::ListValue /* args */,
399 bool /* delivered as part of a user gesture */)
401 // Tell the renderer process all known extension function names.
402 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames,
403 std::vector<std::string>)
405 // Set the top-level frame to the provided name.
406 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName,
407 std::string /* frame_name */)
409 // Tell the renderer process the platforms system font.
410 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont,
411 std::string /* font_family */,
412 std::string /* font_size */)
414 // Marks an extension as 'active' in an extension process. 'Active' extensions
415 // have more privileges than other extension content that might end up running
416 // in the process (e.g. because of iframes or content scripts).
417 IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension,
418 std::string /* extension_id */)
420 // Notifies the renderer that extensions were loaded in the browser.
421 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
422 std::vector<ExtensionMsg_Loaded_Params>)
424 // Notifies the renderer that an extension was unloaded in the browser.
425 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded,
426 std::string)
428 // Updates the scripting whitelist for extensions in the render process. This is
429 // only used for testing.
430 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
431 // extension ids
432 extensions::ExtensionsClient::ScriptingWhitelist)
434 // Notification that renderer should run some JavaScript code.
435 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode,
436 ExtensionMsg_ExecuteCode_Params)
438 // Notification that the user scripts have been updated. It has one
439 // SharedMemoryHandle argument consisting of the pickled script data. This
440 // handle is valid in the context of the renderer.
441 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
442 // programmatically-defined scripts. Otherwise, the handle refers to all
443 // extensions' statically defined scripts.
444 // If |changed_extensions| is not empty, only the extensions in that set will
445 // be updated. Otherwise, all extensions that have scripts in the shared memory
446 // region will be updated. Note that the empty set => all extensions case is not
447 // supported for per-extension programmatically-defined script regions; in such
448 // regions, the owner is expected to list itself as the only changed extension.
449 IPC_MESSAGE_CONTROL3(ExtensionMsg_UpdateUserScripts,
450 base::SharedMemoryHandle,
451 extensions::ExtensionId /* owner */,
452 std::set<std::string> /* changed extensions */)
454 // Trigger to execute declarative content script under browser control.
455 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript,
456 int /* tab identifier */,
457 extensions::ExtensionId /* extension identifier */,
458 int /* script identifier */,
459 GURL /* page URL where script should be injected */)
461 // Tell the render view which browser window it's being attached to.
462 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId,
463 int /* id of browser window */)
465 // Tell the render view what its tab ID is.
466 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId,
467 int /* id of tab */)
469 // Tell the renderer to update an extension's permission set.
470 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions,
471 ExtensionMsg_UpdatePermissions_Params)
473 // Tell the render view about new tab-specific permissions for an extension.
474 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdateTabSpecificPermissions,
475 GURL /* url */,
476 std::string /* extension_id */,
477 extensions::URLPatternSet /* hosts */,
478 bool /* update origin whitelist */,
479 int /* tab_id */)
481 // Tell the render view to clear tab-specific permissions for some extensions.
482 IPC_MESSAGE_CONTROL3(ExtensionMsg_ClearTabSpecificPermissions,
483 std::vector<std::string> /* extension_ids */,
484 bool /* update origin whitelist */,
485 int /* tab_id */)
487 // Tell the renderer which type this view is.
488 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
489 extensions::ViewType /* view_type */)
491 // Deliver a message sent with ExtensionHostMsg_PostMessage.
492 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI,
493 bool /* webrequest_used */)
495 // Ask the lazy background page if it is ready to be suspended. This is sent
496 // when the page is considered idle. The renderer will reply with the same
497 // sequence_id so that we can tell which message it is responding to.
498 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend,
499 std::string /* extension_id */,
500 uint64 /* sequence_id */)
502 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
503 // the lazy background page becoming active again, we are ready to unload. This
504 // message tells the page to dispatch the suspend event.
505 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend,
506 std::string /* extension_id */)
508 // The browser changed its mind about suspending this extension.
509 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend,
510 std::string /* extension_id */)
512 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
513 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
514 std::string /* state */,
515 int32 /* callback_id */)
517 // Dispatch the Port.onConnect event for message channels.
518 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
519 int /* target_port_id */,
520 std::string /* channel_name */,
521 ExtensionMsg_TabConnectionInfo /* source */,
522 ExtensionMsg_ExternalConnectionInfo,
523 std::string /* tls_channel_id */)
525 // Deliver a message sent with ExtensionHostMsg_PostMessage.
526 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
527 int /* target_port_id */,
528 extensions::Message)
530 // Dispatch the Port.onDisconnect event for message channels.
531 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
532 int /* port_id */,
533 std::string /* error_message */)
535 // Informs the renderer what channel (dev, beta, stable, etc) is running.
536 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel,
537 int /* channel */)
539 // Adds a logging message to the renderer's root frame DevTools console.
540 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole,
541 content::ConsoleMessageLevel /* level */,
542 std::string /* message */)
544 // Notify the renderer that its window has closed.
545 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
547 // Notify the renderer that an extension wants notifications when certain
548 // searches match the active page. This message replaces the old set of
549 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
550 // each tab to keep the browser updated about changes.
551 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
552 std::vector<std::string> /* CSS selectors */)
554 // Send by the browser to indicate a Blob handle has been transferred to the
555 // renderer. This is sent after the actual extension response, and depends on
556 // the sequential nature of IPCs so that the blob has already been caught.
557 // This is a separate control message, so that the renderer process will send
558 // an acknowledgement even if the RenderView has closed or navigated away.
559 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
560 std::vector<std::string> /* blob_uuids */)
562 // Messages sent from the renderer to the browser.
564 // A renderer sends this message when an extension process starts an API
565 // request. The browser will always respond with a ExtensionMsg_Response.
566 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request,
567 ExtensionHostMsg_Request_Params)
569 // A renderer sends this message when an extension process starts an API
570 // request. The browser will always respond with a ExtensionMsg_Response.
571 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
572 int /* routing_id */,
573 ExtensionHostMsg_Request_Params)
575 // Notify the browser that the given extension added a listener to an event.
576 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener,
577 std::string /* extension_id */,
578 GURL /* listener_url */,
579 std::string /* name */)
581 // Notify the browser that the given extension removed a listener from an
582 // event.
583 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener,
584 std::string /* extension_id */,
585 GURL /* listener_url */,
586 std::string /* name */)
588 // Notify the browser that the given extension added a listener to an event from
589 // a lazy background page.
590 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
591 std::string /* extension_id */,
592 std::string /* name */)
594 // Notify the browser that the given extension is no longer interested in
595 // receiving the given event from a lazy background page.
596 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
597 std::string /* extension_id */,
598 std::string /* name */)
600 // Notify the browser that the given extension added a listener to instances of
601 // the named event that satisfy the filter.
602 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener,
603 std::string /* extension_id */,
604 std::string /* name */,
605 base::DictionaryValue /* filter */,
606 bool /* lazy */)
608 // Notify the browser that the given extension is no longer interested in
609 // instances of the named event that satisfy the filter.
610 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener,
611 std::string /* extension_id */,
612 std::string /* name */,
613 base::DictionaryValue /* filter */,
614 bool /* lazy */)
616 // Notify the browser that an event has finished being dispatched.
617 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
619 // Open a channel to all listening contexts owned by the extension with
620 // the given ID. This always returns a valid port ID which can be used for
621 // sending messages. If an error occurred, the opener will be notified
622 // asynchronously.
623 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension,
624 int /* routing_id */,
625 ExtensionMsg_ExternalConnectionInfo,
626 std::string /* channel_name */,
627 bool /* include_tls_channel_id */,
628 int /* port_id */)
630 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp,
631 int /* routing_id */,
632 std::string /* source_extension_id */,
633 std::string /* native_app_name */,
634 int /* port_id */)
636 // Get a port handle to the given tab. The handle can be used for sending
637 // messages to the extension.
638 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab,
639 int /* routing_id */,
640 ExtensionMsg_TabTargetConnectionInfo,
641 std::string /* extension_id */,
642 std::string /* channel_name */,
643 int /* port_id */)
645 // Send a message to an extension process. The handle is the value returned
646 // by ViewHostMsg_OpenChannelTo*.
647 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
648 int /* port_id */,
649 extensions::Message)
651 // Send a message to an extension process. The handle is the value returned
652 // by ViewHostMsg_OpenChannelTo*.
653 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
654 int /* port_id */,
655 std::string /* error_message */)
657 // Used to get the extension message bundle.
658 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
659 std::string /* extension id */,
660 SubstitutionMap /* message bundle */)
662 // Sent from the renderer to the browser to return the script running result.
663 IPC_MESSAGE_ROUTED4(
664 ExtensionHostMsg_ExecuteCodeFinished,
665 int /* request id */,
666 std::string /* error; empty implies success */,
667 GURL /* URL of the code executed on. May be empty if unsuccessful. */,
668 base::ListValue /* result of the script */)
670 // Sent from the renderer to the browser to notify that content scripts are
671 // running in the renderer that the IPC originated from.
672 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
673 ExecutingScriptsMap,
674 GURL /* url of the _topmost_ frame */)
676 // Sent from the renderer to the browser to request permission for a script
677 // injection.
678 // If request id is -1, this signals that the request has already ran, and this
679 // merely serves as a notification. This happens when the feature to disable
680 // scripts running without user consent is not enabled.
681 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission,
682 std::string /* extension id */,
683 extensions::UserScript::InjectionType /* script type */,
684 int64 /* request id */)
686 // Sent from the browser to the renderer in reply to a
687 // RequestScriptInjectionPermission message, granting permission for a script
688 // script to run.
689 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection,
690 int64 /* request id */)
692 // Sent by the renderer when a web page is checking if its app is installed.
693 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
694 GURL /* requestor_url */,
695 int32 /* return_route_id */,
696 int32 /* callback_id */)
698 // Optional Ack message sent to the browser to notify that the response to a
699 // function has been processed.
700 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
701 int /* request_id */)
703 // Response to ExtensionMsg_ShouldSuspend.
704 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
705 std::string /* extension_id */,
706 uint64 /* sequence_id */)
708 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
709 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
710 std::string /* extension_id */)
712 // Informs the browser to increment the keepalive count for the lazy background
713 // page, keeping it alive.
714 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
716 // Informs the browser there is one less thing keeping the lazy background page
717 // alive.
718 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
720 // Fetches a globally unique ID (for the lifetime of the browser) from the
721 // browser process.
722 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
723 int /* unique_id */)
725 // Resumes resource requests for a newly created app window.
726 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */)
728 // Sent by the renderer when the draggable regions are updated.
729 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
730 std::vector<extensions::DraggableRegion> /* regions */)
732 // Sent by the renderer to log an API action to the extension activity log.
733 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
734 std::string /* extension_id */,
735 ExtensionHostMsg_APIActionOrEvent_Params)
737 // Sent by the renderer to log an event to the extension activity log.
738 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
739 std::string /* extension_id */,
740 ExtensionHostMsg_APIActionOrEvent_Params)
742 // Sent by the renderer to log a DOM action to the extension activity log.
743 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
744 std::string /* extension_id */,
745 ExtensionHostMsg_DOMAction_Params)
747 // Notifies the browser process that a tab has started or stopped matching
748 // certain conditions. This message is sent in response to several events:
750 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
751 // * A new page is loaded. This will be sent after
752 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
753 // main frame.
754 // * Something changed on an existing frame causing the set of matching searches
755 // to change.
756 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
757 std::vector<std::string> /* Matching CSS selectors */)
759 // Sent by the renderer when it has received a Blob handle from the browser.
760 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck,
761 std::vector<std::string> /* blob_uuids */)
763 // Informs of updated frame names.
764 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_FrameNameChanged,
765 bool /* is_top_level */,
766 std::string /* name */)
768 // Tells listeners that a detailed message was reported to the console by
769 // WebKit.
770 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
771 base::string16 /* message */,
772 base::string16 /* source */,
773 extensions::StackTrace /* stack trace */,
774 int32 /* severity level */)
776 // Sent when a query selector request is made from the automation API.
777 // acc_obj_id is the accessibility tree ID of the starting element.
778 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector,
779 int /* request_id */,
780 int /* acc_obj_id */,
781 base::string16 /* selector */)
783 // Result of a query selector request.
784 // result_acc_obj_id is the accessibility tree ID of the result element; 0
785 // indicates no result.
786 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result,
787 int /* request_id */,
788 ExtensionHostMsg_AutomationQuerySelector_Error /* error */,
789 int /* result_acc_obj_id */)