[Password Manager] Suppress UI when password generation is active
[chromium-blink-merge.git] / extensions / common / extension_messages.h
blob085e8d246902c1f2dc8460e2f2acd43d8d0f6498
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 the current tab is an extension page (we limit
431 // what other extensions can do on these pages).
432 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabExtensionOwner,
433 std::string /* extension_id */)
435 // Notifies the renderer that extensions were loaded in the browser.
436 IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
437 std::vector<ExtensionMsg_Loaded_Params>)
439 // Notifies the renderer that an extension was unloaded in the browser.
440 IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded,
441 std::string)
443 // Updates the scripting whitelist for extensions in the render process. This is
444 // only used for testing.
445 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
446 // extension ids
447 extensions::ExtensionsClient::ScriptingWhitelist)
449 // Notification that renderer should run some JavaScript code.
450 IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode,
451 ExtensionMsg_ExecuteCode_Params)
453 // Notification that the user scripts have been updated. It has one
454 // SharedMemoryHandle argument consisting of the pickled script data. This
455 // handle is valid in the context of the renderer.
456 // If |owner| is not empty, then the shared memory handle refers to |owner|'s
457 // programmatically-defined scripts. Otherwise, the handle refers to all
458 // hosts' statically defined scripts. So far, only extension-hosts support
459 // statically defined scripts; WebUI-hosts don't.
460 // If |changed_hosts| is not empty, only the host in that set will
461 // be updated. Otherwise, all hosts that have scripts in the shared memory
462 // region will be updated. Note that the empty set => all hosts case is not
463 // supported for per-extension programmatically-defined script regions; in such
464 // regions, the owner is expected to list itself as the only changed host.
465 // If |whitelisted_only| is true, this process should only run whitelisted
466 // scripts and not all user scripts.
467 IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateUserScripts,
468 base::SharedMemoryHandle,
469 HostID /* owner */,
470 std::set<HostID> /* changed hosts */,
471 bool /* whitelisted_only */)
473 // Trigger to execute declarative content script under browser control.
474 IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript,
475 int /* tab identifier */,
476 extensions::ExtensionId /* extension identifier */,
477 int /* script identifier */,
478 GURL /* page URL where script should be injected */)
480 // Tell the render view which browser window it's being attached to.
481 IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId,
482 int /* id of browser window */)
484 // Tell the render view what its tab ID is.
485 IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId,
486 int /* id of tab */)
488 // Tell the renderer to update an extension's permission set.
489 IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions,
490 ExtensionMsg_UpdatePermissions_Params)
492 // Tell the render view about new tab-specific permissions for an extension.
493 IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdateTabSpecificPermissions,
494 GURL /* url */,
495 std::string /* extension_id */,
496 extensions::URLPatternSet /* hosts */,
497 bool /* update origin whitelist */,
498 int /* tab_id */)
500 // Tell the render view to clear tab-specific permissions for some extensions.
501 IPC_MESSAGE_CONTROL3(ExtensionMsg_ClearTabSpecificPermissions,
502 std::vector<std::string> /* extension_ids */,
503 bool /* update origin whitelist */,
504 int /* tab_id */)
506 // Tell the renderer which type this view is.
507 IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
508 extensions::ViewType /* view_type */)
510 // Deliver a message sent with ExtensionHostMsg_PostMessage.
511 IPC_MESSAGE_CONTROL1(ExtensionMsg_UsingWebRequestAPI,
512 bool /* webrequest_used */)
514 // Ask the lazy background page if it is ready to be suspended. This is sent
515 // when the page is considered idle. The renderer will reply with the same
516 // sequence_id so that we can tell which message it is responding to.
517 IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend,
518 std::string /* extension_id */,
519 uint64 /* sequence_id */)
521 // If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
522 // the lazy background page becoming active again, we are ready to unload. This
523 // message tells the page to dispatch the suspend event.
524 IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend,
525 std::string /* extension_id */)
527 // The browser changed its mind about suspending this extension.
528 IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend,
529 std::string /* extension_id */)
531 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
532 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
533 std::string /* state */,
534 int32 /* callback_id */)
536 // Dispatch the Port.onConnect event for message channels.
537 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
538 int /* target_port_id */,
539 std::string /* channel_name */,
540 ExtensionMsg_TabConnectionInfo /* source */,
541 ExtensionMsg_ExternalConnectionInfo,
542 std::string /* tls_channel_id */)
544 // Deliver a message sent with ExtensionHostMsg_PostMessage.
545 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
546 int /* target_port_id */,
547 extensions::Message)
549 // Dispatch the Port.onDisconnect event for message channels.
550 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
551 int /* port_id */,
552 std::string /* error_message */)
554 // Informs the renderer what channel (dev, beta, stable, etc) is running.
555 IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel,
556 int /* channel */)
558 // Adds a logging message to the renderer's root frame DevTools console.
559 IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole,
560 content::ConsoleMessageLevel /* level */,
561 std::string /* message */)
563 // Notify the renderer that its window has closed.
564 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
566 // Notify the renderer that an extension wants notifications when certain
567 // searches match the active page. This message replaces the old set of
568 // searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
569 // each tab to keep the browser updated about changes.
570 IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
571 std::vector<std::string> /* CSS selectors */)
573 // Send by the browser to indicate a Blob handle has been transferred to the
574 // renderer. This is sent after the actual extension response, and depends on
575 // the sequential nature of IPCs so that the blob has already been caught.
576 // This is a separate control message, so that the renderer process will send
577 // an acknowledgement even if the RenderView has closed or navigated away.
578 IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
579 std::vector<std::string> /* blob_uuids */)
581 // Messages sent from the renderer to the browser.
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_ROUTED1(ExtensionHostMsg_Request,
586 ExtensionHostMsg_Request_Params)
588 // A renderer sends this message when an extension process starts an API
589 // request. The browser will always respond with a ExtensionMsg_Response.
590 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
591 int /* routing_id */,
592 ExtensionHostMsg_Request_Params)
594 // Notify the browser that the given extension added a listener to an event.
595 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddListener,
596 std::string /* extension_id */,
597 GURL /* listener_url */,
598 std::string /* name */)
600 // Notify the browser that the given extension removed a listener from an
601 // event.
602 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveListener,
603 std::string /* extension_id */,
604 GURL /* listener_url */,
605 std::string /* name */)
607 // Notify the browser that the given extension added a listener to an event from
608 // a lazy background page.
609 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
610 std::string /* extension_id */,
611 std::string /* name */)
613 // Notify the browser that the given extension is no longer interested in
614 // receiving the given event from a lazy background page.
615 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
616 std::string /* extension_id */,
617 std::string /* name */)
619 // Notify the browser that the given extension added a listener to instances of
620 // the named event that satisfy the filter.
621 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener,
622 std::string /* extension_id */,
623 std::string /* name */,
624 base::DictionaryValue /* filter */,
625 bool /* lazy */)
627 // Notify the browser that the given extension is no longer interested in
628 // instances of the named event that satisfy the filter.
629 IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener,
630 std::string /* extension_id */,
631 std::string /* name */,
632 base::DictionaryValue /* filter */,
633 bool /* lazy */)
635 // Notify the browser that an event has finished being dispatched.
636 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
638 // Open a channel to all listening contexts owned by the extension with
639 // the given ID. This always returns a valid port ID which can be used for
640 // sending messages. If an error occurred, the opener will be notified
641 // asynchronously.
642 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtension,
643 int /* routing_id */,
644 ExtensionMsg_ExternalConnectionInfo,
645 std::string /* channel_name */,
646 bool /* include_tls_channel_id */,
647 int /* port_id */)
649 IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp,
650 int /* routing_id */,
651 std::string /* source_extension_id */,
652 std::string /* native_app_name */,
653 int /* port_id */)
655 // Get a port handle to the given tab. The handle can be used for sending
656 // messages to the extension.
657 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab,
658 int /* routing_id */,
659 ExtensionMsg_TabTargetConnectionInfo,
660 std::string /* extension_id */,
661 std::string /* channel_name */,
662 int /* port_id */)
664 // Send a message to an extension process. The handle is the value returned
665 // by ViewHostMsg_OpenChannelTo*.
666 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
667 int /* port_id */,
668 extensions::Message)
670 // Send a message to an extension process. The handle is the value returned
671 // by ViewHostMsg_OpenChannelTo*.
672 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
673 int /* port_id */,
674 std::string /* error_message */)
676 // Used to get the extension message bundle.
677 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
678 std::string /* extension id */,
679 SubstitutionMap /* message bundle */)
681 // Sent from the renderer to the browser to return the script running result.
682 IPC_MESSAGE_ROUTED4(
683 ExtensionHostMsg_ExecuteCodeFinished,
684 int /* request id */,
685 std::string /* error; empty implies success */,
686 GURL /* URL of the code executed on. May be empty if unsuccessful. */,
687 base::ListValue /* result of the script */)
689 // Sent from the renderer to the browser to notify that content scripts are
690 // running in the renderer that the IPC originated from.
691 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
692 ExecutingScriptsMap,
693 GURL /* url of the _topmost_ frame */)
695 // Sent from the renderer to the browser to request permission for a script
696 // injection.
697 // If request id is -1, this signals that the request has already ran, and this
698 // merely serves as a notification. This happens when the feature to disable
699 // scripts running without user consent is not enabled.
700 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_RequestScriptInjectionPermission,
701 std::string /* extension id */,
702 extensions::UserScript::InjectionType /* script type */,
703 int64 /* request id */)
705 // Sent from the browser to the renderer in reply to a
706 // RequestScriptInjectionPermission message, granting permission for a script
707 // script to run.
708 IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection,
709 int64 /* request id */)
711 // Sent by the renderer when a web page is checking if its app is installed.
712 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
713 GURL /* requestor_url */,
714 int32 /* return_route_id */,
715 int32 /* callback_id */)
717 // Optional Ack message sent to the browser to notify that the response to a
718 // function has been processed.
719 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
720 int /* request_id */)
722 // Response to ExtensionMsg_ShouldSuspend.
723 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
724 std::string /* extension_id */,
725 uint64 /* sequence_id */)
727 // Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
728 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
729 std::string /* extension_id */)
731 // Informs the browser to increment the keepalive count for the lazy background
732 // page, keeping it alive.
733 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
735 // Informs the browser there is one less thing keeping the lazy background page
736 // alive.
737 IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
739 // Fetches a globally unique ID (for the lifetime of the browser) from the
740 // browser process.
741 IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
742 int /* unique_id */)
744 // Resumes resource requests for a newly created app window.
745 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */)
747 // Sent by the renderer when the draggable regions are updated.
748 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
749 std::vector<extensions::DraggableRegion> /* regions */)
751 // Sent by the renderer to log an API action to the extension activity log.
752 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
753 std::string /* extension_id */,
754 ExtensionHostMsg_APIActionOrEvent_Params)
756 // Sent by the renderer to log an event to the extension activity log.
757 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
758 std::string /* extension_id */,
759 ExtensionHostMsg_APIActionOrEvent_Params)
761 // Sent by the renderer to log a DOM action to the extension activity log.
762 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
763 std::string /* extension_id */,
764 ExtensionHostMsg_DOMAction_Params)
766 // Notifies the browser process that a tab has started or stopped matching
767 // certain conditions. This message is sent in response to several events:
769 // * ExtensionMsg_WatchPages was received, updating the set of conditions.
770 // * A new page is loaded. This will be sent after
771 // FrameHostMsg_DidCommitProvisionalLoad. Currently this only fires for the
772 // main frame.
773 // * Something changed on an existing frame causing the set of matching searches
774 // to change.
775 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
776 std::vector<std::string> /* Matching CSS selectors */)
778 // Sent by the renderer when it has received a Blob handle from the browser.
779 IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck,
780 std::vector<std::string> /* blob_uuids */)
782 // Tells listeners that a detailed message was reported to the console by
783 // WebKit.
784 IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
785 base::string16 /* message */,
786 base::string16 /* source */,
787 extensions::StackTrace /* stack trace */,
788 int32 /* severity level */)
790 // Sent when a query selector request is made from the automation API.
791 // acc_obj_id is the accessibility tree ID of the starting element.
792 IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector,
793 int /* request_id */,
794 int /* acc_obj_id */,
795 base::string16 /* selector */)
797 // Result of a query selector request.
798 // result_acc_obj_id is the accessibility tree ID of the result element; 0
799 // indicates no result.
800 IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result,
801 int /* request_id */,
802 ExtensionHostMsg_AutomationQuerySelector_Error /* error */,
803 int /* result_acc_obj_id */)