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.
4
5// IPC messages for extensions.
6
7#ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
8#define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
9
10#include <stdint.h>
11
12#include <string>
13#include <vector>
14
15#include "base/macros.h"
16#include "base/memory/shared_memory.h"
17#include "base/values.h"
18#include "content/public/common/common_param_traits.h"
19#include "content/public/common/socket_permission_request.h"
20#include "extensions/common/api/messaging/message.h"
21#include "extensions/common/api/messaging/messaging_endpoint.h"
22#include "extensions/common/api/messaging/port_context.h"
23#include "extensions/common/api/messaging/port_id.h"
24#include "extensions/common/common_param_traits.h"
25#include "extensions/common/constants.h"
26#include "extensions/common/draggable_region.h"
27#include "extensions/common/event_filtering_info.h"
28#include "extensions/common/extension.h"
29#include "extensions/common/extensions_client.h"
30#include "extensions/common/host_id.h"
31#include "extensions/common/permissions/permission_set.h"
32#include "extensions/common/permissions/socket_permission_data.h"
33#include "extensions/common/permissions/usb_device_permission_data.h"
34#include "extensions/common/stack_frame.h"
35#include "extensions/common/url_pattern.h"
36#include "extensions/common/url_pattern_set.h"
37#include "extensions/common/user_script.h"
38#include "extensions/common/view_type.h"
39#include "ipc/ipc_message_macros.h"
40#include "url/gurl.h"
41
42#define IPC_MESSAGE_START ExtensionMsgStart
43
44IPC_ENUM_TRAITS_MAX_VALUE(extensions::CSSOrigin, extensions::CSS_ORIGIN_LAST)
45
46IPC_ENUM_TRAITS_MAX_VALUE(extensions::ViewType, extensions::VIEW_TYPE_LAST)
47IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType,
48 content::SocketPermissionRequest::OPERATION_TYPE_LAST)
49
50IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::InjectionType,
51 extensions::UserScript::INJECTION_TYPE_LAST)
52
53IPC_ENUM_TRAITS_MAX_VALUE(extensions::UserScript::RunLocation,
54 extensions::UserScript::RUN_LOCATION_LAST - 1)
55
56IPC_ENUM_TRAITS_MAX_VALUE(extensions::MessagingEndpoint::Type,
57 extensions::MessagingEndpoint::Type::kLast)
58
59IPC_ENUM_TRAITS_MAX_VALUE(HostID::HostType, HostID::HOST_TYPE_LAST)
60
61// Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
62// ExtensionHostMsg_AddEventToActivityLog.
63IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params)
64 // API name.
65 IPC_STRUCT_MEMBER(std::string, api_call)
66
67 // List of arguments.
68 IPC_STRUCT_MEMBER(base::ListValue, arguments)
69
70 // Extra logging information.
71 IPC_STRUCT_MEMBER(std::string, extra)
72IPC_STRUCT_END()
73
74// Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
75IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params)
76 // URL of the page.
77 IPC_STRUCT_MEMBER(GURL, url)
78
79 // Title of the page.
80 IPC_STRUCT_MEMBER(base::string16, url_title)
81
82 // API name.
83 IPC_STRUCT_MEMBER(std::string, api_call)
84
85 // List of arguments.
86 IPC_STRUCT_MEMBER(base::ListValue, arguments)
87
88 // Type of DOM API call.
89 IPC_STRUCT_MEMBER(int, call_type)
90IPC_STRUCT_END()
91
92// Parameters structure for ExtensionHostMsg_Request.
93IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params)
94 // Message name.
95 IPC_STRUCT_MEMBER(std::string, name)
96
97 // List of message arguments.
98 IPC_STRUCT_MEMBER(base::ListValue, arguments)
99
100 // Extension ID this request was sent from. This can be empty, in the case
101 // where we expose APIs to normal web pages using the extension function
102 // system.
103 IPC_STRUCT_MEMBER(std::string, extension_id)
104
105 // URL of the frame the request was sent from. This isn't necessarily an
106 // extension url. Extension requests can also originate from content scripts,
107 // in which case extension_id will indicate the ID of the associated
108 // extension. Or, they can originate from hosted apps or normal web pages.
109 IPC_STRUCT_MEMBER(GURL, source_url)
110
111 // Unique request id to match requests and responses.
112 IPC_STRUCT_MEMBER(int, request_id)
113
114 // True if request has a callback specified.
115 IPC_STRUCT_MEMBER(bool, has_callback)
116
117 // True if request is executed in response to an explicit user gesture.
118 IPC_STRUCT_MEMBER(bool, user_gesture)
119
120 // If this API call is for a service worker, then this is the worker thread
121 // id. Otherwise, this is kMainThreadId.
122 IPC_STRUCT_MEMBER(int, worker_thread_id)
123
124 // If this API call is for a service worker, then this is the service
125 // worker version id. Otherwise, this is set to
126 // blink::mojom::kInvalidServiceWorkerVersionId.
127 IPC_STRUCT_MEMBER(int64_t, service_worker_version_id)
128IPC_STRUCT_END()
129
130IPC_STRUCT_BEGIN(ExtensionMsg_DispatchEvent_Params)
131 // If this event is for a service worker, then this is the worker thread
132 // id. Otherwise, this is 0.
133 IPC_STRUCT_MEMBER(int, worker_thread_id)
134
135 // The id of the extension to dispatch the event to.
136 IPC_STRUCT_MEMBER(std::string, extension_id)
137
138 // The name of the event to dispatch.
139 IPC_STRUCT_MEMBER(std::string, event_name)
140
141 // The id of the event for use in the EventAck response message.
142 IPC_STRUCT_MEMBER(int, event_id)
143
144 // Whether or not the event is part of a user gesture.
145 IPC_STRUCT_MEMBER(bool, is_user_gesture)
146
147 // Additional filtering info for the event.
148 IPC_STRUCT_MEMBER(extensions::EventFilteringInfo, filtering_info)
149IPC_STRUCT_END()
150
151// Allows an extension to execute code in a tab.
152IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params)
153 // The extension API request id, for responding.
154 IPC_STRUCT_MEMBER(int, request_id)
155
156 // The ID of the requesting injection host.
157 IPC_STRUCT_MEMBER(HostID, host_id)
158
159 // Whether the code is JavaScript or CSS.
160 IPC_STRUCT_MEMBER(bool, is_javascript)
161
162 // String of code to execute.
163 IPC_STRUCT_MEMBER(std::string, code)
164
165 // The webview guest source who calls to execute code.
166 IPC_STRUCT_MEMBER(GURL, webview_src)
167
168 // Whether to inject into about:blank (sub)frames.
169 IPC_STRUCT_MEMBER(bool, match_about_blank)
170
171 // When to inject the code.
172 IPC_STRUCT_MEMBER(extensions::UserScript::RunLocation, run_at)
173
174 // Whether to execute code in the main world (as opposed to an isolated
175 // world).
176 IPC_STRUCT_MEMBER(bool, in_main_world)
177
178 // Whether the request is coming from a <webview>.
179 IPC_STRUCT_MEMBER(bool, is_web_view)
180
181 // Whether the caller is interested in the result value. Manifest-declared
182 // content scripts and executeScript() calls without a response callback
183 // are examples of when this will be false.
184 IPC_STRUCT_MEMBER(bool, wants_result)
185
186 // The URL of the file that was injected, if any.
187 IPC_STRUCT_MEMBER(GURL, file_url)
188
189 // Whether the code to be executed should be associated with a user gesture.
190 IPC_STRUCT_MEMBER(bool, user_gesture)
191
192 // The origin of the CSS.
193 IPC_STRUCT_MEMBER(base::Optional<extensions::CSSOrigin>, css_origin)
194
195 // The autogenerated key for the CSS injection.
196 IPC_STRUCT_MEMBER(base::Optional<std::string>, injection_key)
197IPC_STRUCT_END()
198
199// Struct containing information about the sender of connect() calls that
200// originate from a tab.
201IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo)
202 // The tab from where the connection was created.
203 IPC_STRUCT_MEMBER(base::DictionaryValue, tab)
204
205 // The ID of the frame that initiated the connection.
206 // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
207 IPC_STRUCT_MEMBER(int, frame_id)
208IPC_STRUCT_END()
209
210// Struct containing information about the destination of tab.connect().
211IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo)
212 // The destination tab's ID.
213 IPC_STRUCT_MEMBER(int, tab_id)
214
215 // Frame ID of the destination. -1 for all frames, 0 for main frame and
216 // positive if the destination is a specific child frame.
217 IPC_STRUCT_MEMBER(int, frame_id)
218IPC_STRUCT_END()
219
220IPC_STRUCT_TRAITS_BEGIN(extensions::MessagingEndpoint)
221 IPC_STRUCT_TRAITS_MEMBER(type)
222 IPC_STRUCT_TRAITS_MEMBER(extension_id)
223 IPC_STRUCT_TRAITS_MEMBER(native_app_name)
224IPC_STRUCT_TRAITS_END()
225
226// Struct containing the data for external connections to extensions. Used to
227// handle the IPCs initiated by both connect() and onConnect().
228IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo)
229 // The ID of the extension that is the target of the request.
230 IPC_STRUCT_MEMBER(std::string, target_id)
231
232 // Specifies the type and the ID of the endpoint that initiated the request.
233 IPC_STRUCT_MEMBER(extensions::MessagingEndpoint, source_endpoint)
234
235 // The URL of the frame that initiated the request.
236 IPC_STRUCT_MEMBER(GURL, source_url)
237
238 // The process ID of the webview that initiated the request.
239 IPC_STRUCT_MEMBER(int, guest_process_id)
240
241 // The render frame routing ID of the webview that initiated the request.
242 IPC_STRUCT_MEMBER(int, guest_render_frame_routing_id)
243IPC_STRUCT_END()
244
245IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion)
246 IPC_STRUCT_TRAITS_MEMBER(draggable)
247 IPC_STRUCT_TRAITS_MEMBER(bounds)
248IPC_STRUCT_TRAITS_END()
249
250IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest)
251 IPC_STRUCT_TRAITS_MEMBER(type)
252 IPC_STRUCT_TRAITS_MEMBER(host)
253 IPC_STRUCT_TRAITS_MEMBER(port)
254IPC_STRUCT_TRAITS_END()
255
256IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext::FrameContext)
257 IPC_STRUCT_TRAITS_MEMBER(routing_id)
258IPC_STRUCT_TRAITS_END()
259
260IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext::WorkerContext)
261 IPC_STRUCT_TRAITS_MEMBER(thread_id)
262 IPC_STRUCT_TRAITS_MEMBER(version_id)
263 IPC_STRUCT_TRAITS_MEMBER(extension_id)
264IPC_STRUCT_TRAITS_END()
265
266IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext)
267 IPC_STRUCT_TRAITS_MEMBER(frame)
268 IPC_STRUCT_TRAITS_MEMBER(worker)
269IPC_STRUCT_TRAITS_END()
270
271IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry)
272 IPC_STRUCT_TRAITS_MEMBER(pattern_)
273 IPC_STRUCT_TRAITS_MEMBER(match_subdomains_)
274IPC_STRUCT_TRAITS_END()
275
276IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData)
277 IPC_STRUCT_TRAITS_MEMBER(entry())
278IPC_STRUCT_TRAITS_END()
279
280IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame)
281 IPC_STRUCT_TRAITS_MEMBER(line_number)
282 IPC_STRUCT_TRAITS_MEMBER(column_number)
283 IPC_STRUCT_TRAITS_MEMBER(source)
284 IPC_STRUCT_TRAITS_MEMBER(function)
285IPC_STRUCT_TRAITS_END()
286
287IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData)
288 IPC_STRUCT_TRAITS_MEMBER(vendor_id())
289 IPC_STRUCT_TRAITS_MEMBER(product_id())
290 IPC_STRUCT_TRAITS_MEMBER(interface_class())
291IPC_STRUCT_TRAITS_END()
292
293IPC_STRUCT_TRAITS_BEGIN(extensions::Message)
294 IPC_STRUCT_TRAITS_MEMBER(data)
295 IPC_STRUCT_TRAITS_MEMBER(user_gesture)
296IPC_STRUCT_TRAITS_END()
297
298IPC_STRUCT_TRAITS_BEGIN(extensions::PortId)
299 IPC_STRUCT_TRAITS_MEMBER(context_id)
300 IPC_STRUCT_TRAITS_MEMBER(port_number)
301 IPC_STRUCT_TRAITS_MEMBER(is_opener)
302IPC_STRUCT_TRAITS_END()
303
304IPC_STRUCT_TRAITS_BEGIN(extensions::EventFilteringInfo)
305 IPC_STRUCT_TRAITS_MEMBER(url)
306 IPC_STRUCT_TRAITS_MEMBER(service_type)
307 IPC_STRUCT_TRAITS_MEMBER(instance_id)
308 IPC_STRUCT_TRAITS_MEMBER(window_type)
309 IPC_STRUCT_TRAITS_MEMBER(window_exposed_by_default)
310IPC_STRUCT_TRAITS_END()
311
312// Identifier containing info about a service worker, used in event listener
313// IPCs.
314IPC_STRUCT_BEGIN(ServiceWorkerIdentifier)
315 IPC_STRUCT_MEMBER(GURL, scope)
316 IPC_STRUCT_MEMBER(int64_t, version_id)
317 IPC_STRUCT_MEMBER(int, thread_id)
318IPC_STRUCT_END()
319
320// Singly-included section for custom IPC traits.
321#ifndef INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
322#define INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
323
324// IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
325// to typedef it to avoid that.
326// Substitution map for l10n messages.
327typedef std::map<std::string, std::string> SubstitutionMap;
328
329// Map of extensions IDs to the executing script paths.
330typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap;
331
332struct ExtensionMsg_PermissionSetStruct {
333 ExtensionMsg_PermissionSetStruct();
334 explicit ExtensionMsg_PermissionSetStruct(
335 const extensions::PermissionSet& permissions);
336 ~ExtensionMsg_PermissionSetStruct();
337
338 ExtensionMsg_PermissionSetStruct(ExtensionMsg_PermissionSetStruct&& other);
339 ExtensionMsg_PermissionSetStruct& operator=(
340 ExtensionMsg_PermissionSetStruct&& other);
341
342 std::unique_ptr<const extensions::PermissionSet> ToPermissionSet() const;
343
344 extensions::APIPermissionSet apis;
345 extensions::ManifestPermissionSet manifest_permissions;
346 extensions::URLPatternSet explicit_hosts;
347 extensions::URLPatternSet scriptable_hosts;
348
349 DISALLOW_COPY_AND_ASSIGN(ExtensionMsg_PermissionSetStruct);
350};
351
352struct ExtensionMsg_Loaded_Params {
353 ExtensionMsg_Loaded_Params();
354 ~ExtensionMsg_Loaded_Params();
355 ExtensionMsg_Loaded_Params(const extensions::Extension* extension,
356 bool include_tab_permissions);
357
358 ExtensionMsg_Loaded_Params(ExtensionMsg_Loaded_Params&& other);
359 ExtensionMsg_Loaded_Params& operator=(ExtensionMsg_Loaded_Params&& other);
360
361 // Creates a new extension from the data in this object.
362 scoped_refptr<extensions::Extension> ConvertToExtension(
363 std::string* error) const;
364
365 // The subset of the extension manifest data we send to renderers.
366 base::DictionaryValue manifest;
367
368 // The location the extension was installed from.
369 extensions::Manifest::Location location;
370
371 // The path the extension was loaded from. This is used in the renderer only
372 // to generate the extension ID for extensions that are loaded unpacked.
373 base::FilePath path;
374
375 // The extension's active and withheld permissions.
376 ExtensionMsg_PermissionSetStruct active_permissions;
377 ExtensionMsg_PermissionSetStruct withheld_permissions;
378 std::map<int, ExtensionMsg_PermissionSetStruct> tab_specific_permissions;
379
380 // Contains URLPatternSets defining which URLs an extension may not interact
381 // with by policy.
382 extensions::URLPatternSet policy_blocked_hosts;
383 extensions::URLPatternSet policy_allowed_hosts;
384
385 // If the extension uses the default list of blocked / allowed URLs.
386 bool uses_default_policy_blocked_allowed_hosts = true;
387
388 // We keep this separate so that it can be used in logging.
389 std::string id;
390
391 // Send creation flags so extension is initialized identically.
392 int creation_flags;
393
394 private:
395 DISALLOW_COPY_AND_ASSIGN(ExtensionMsg_Loaded_Params);
396};
397
398struct ExtensionHostMsg_AutomationQuerySelector_Error {
399 enum Value { kNone, kNoDocument, kNodeDestroyed };
400
401 ExtensionHostMsg_AutomationQuerySelector_Error() : value(kNone) {}
402
403 Value value;
404};
405
406namespace IPC {
407
408template <>
409struct ParamTraits<URLPattern> {
410 typedef URLPattern param_type;
411 static void Write(base::Pickle* m, const param_type& p);
412 static bool Read(const base::Pickle* m,
413 base::PickleIterator* iter,
414 param_type* p);
415 static void Log(const param_type& p, std::string* l);
416};
417
418template <>
419struct ParamTraits<extensions::URLPatternSet> {
420 typedef extensions::URLPatternSet param_type;
421 static void Write(base::Pickle* m, const param_type& p);
422 static bool Read(const base::Pickle* m,
423 base::PickleIterator* iter,
424 param_type* p);
425 static void Log(const param_type& p, std::string* l);
426};
427
428template <>
429struct ParamTraits<extensions::APIPermission::ID> {
430 typedef extensions::APIPermission::ID param_type;
431 static void Write(base::Pickle* m, const param_type& p);
432 static bool Read(const base::Pickle* m,
433 base::PickleIterator* iter,
434 param_type* p);
435 static void Log(const param_type& p, std::string* l);
436};
437
438template <>
439struct ParamTraits<extensions::APIPermissionSet> {
440 typedef extensions::APIPermissionSet param_type;
441 static void Write(base::Pickle* m, const param_type& p);
442 static bool Read(const base::Pickle* m,
443 base::PickleIterator* iter,
444 param_type* r);
445 static void Log(const param_type& p, std::string* l);
446};
447
448template <>
449struct ParamTraits<extensions::ManifestPermissionSet> {
450 typedef extensions::ManifestPermissionSet param_type;
451 static void Write(base::Pickle* m, const param_type& p);
452 static bool Read(const base::Pickle* m,
453 base::PickleIterator* iter,
454 param_type* r);
455 static void Log(const param_type& p, std::string* l);
456};
457
458template <>
459struct ParamTraits<HostID> {
460 typedef HostID param_type;
461 static void Write(base::Pickle* m, const param_type& p);
462 static bool Read(const base::Pickle* m,
463 base::PickleIterator* iter,
464 param_type* r);
465 static void Log(const param_type& p, std::string* l);
466};
467
468template <>
469struct ParamTraits<ExtensionMsg_PermissionSetStruct> {
470 typedef ExtensionMsg_PermissionSetStruct param_type;
471 static void Write(base::Pickle* m, const param_type& p);
472 static bool Read(const base::Pickle* m,
473 base::PickleIterator* iter,
474 param_type* p);
475 static void Log(const param_type& p, std::string* l);
476};
477
478template <>
479struct ParamTraits<ExtensionMsg_Loaded_Params> {
480 typedef ExtensionMsg_Loaded_Params param_type;
481 static void Write(base::Pickle* m, const param_type& p);
482 static bool Read(const base::Pickle* m,
483 base::PickleIterator* iter,
484 param_type* p);
485 static void Log(const param_type& p, std::string* l);
486};
487
488} // namespace IPC
489
490#endif // INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
491
492IPC_ENUM_TRAITS_MAX_VALUE(
493 ExtensionHostMsg_AutomationQuerySelector_Error::Value,
494 ExtensionHostMsg_AutomationQuerySelector_Error::kNodeDestroyed)
495
496IPC_STRUCT_TRAITS_BEGIN(ExtensionHostMsg_AutomationQuerySelector_Error)
497IPC_STRUCT_TRAITS_MEMBER(value)
498IPC_STRUCT_TRAITS_END()
499
500// Parameters structure for ExtensionMsg_UpdatePermissions.
501IPC_STRUCT_BEGIN(ExtensionMsg_UpdatePermissions_Params)
502 IPC_STRUCT_MEMBER(std::string, extension_id)
503 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, active_permissions)
504 IPC_STRUCT_MEMBER(ExtensionMsg_PermissionSetStruct, withheld_permissions)
505 IPC_STRUCT_MEMBER(extensions::URLPatternSet, policy_blocked_hosts)
506 IPC_STRUCT_MEMBER(extensions::URLPatternSet, policy_allowed_hosts)
507 IPC_STRUCT_MEMBER(bool, uses_default_policy_host_restrictions)
508IPC_STRUCT_END()
509
510// Parameters structure for ExtensionMsg_UpdateDefaultPolicyHostRestrictions.
511IPC_STRUCT_BEGIN(ExtensionMsg_UpdateDefaultPolicyHostRestrictions_Params)
512 IPC_STRUCT_MEMBER(extensions::URLPatternSet, default_policy_blocked_hosts)
513 IPC_STRUCT_MEMBER(extensions::URLPatternSet, default_policy_allowed_hosts)
514IPC_STRUCT_END()
515
516// Messages sent from the browser to the renderer:
517
518// The browser sends this message in response to all extension api calls. The
519// response data (if any) is one of the base::Value subclasses, wrapped as the
520// first element in a ListValue.
521IPC_MESSAGE_ROUTED4(ExtensionMsg_Response,
522 int /* request_id */,
523 bool /* success */,
524 base::ListValue /* response wrapper (see comment above) */,
525 std::string /* error */)
526
527// Sent to the renderer to dispatch an event to an extension.
528// Note: |event_args| is separate from the params to avoid having the message
529// take ownership.
530IPC_MESSAGE_CONTROL2(ExtensionMsg_DispatchEvent,
531 ExtensionMsg_DispatchEvent_Params /* params */,
532 base::ListValue /* event_args */)
533
534// This message is optionally routed. If used as a control message, it will
535// call a javascript function |function_name| from module |module_name| in
536// every registered context in the target process. If routed, it will be
537// restricted to the contexts that are part of the target RenderView.
538//
539// If |extension_id| is non-empty, the function will be invoked only in
540// contexts owned by the extension. |args| is a list of primitive Value types
541// that are passed to the function.
542IPC_MESSAGE_ROUTED4(ExtensionMsg_MessageInvoke,
543 std::string /* extension_id */,
544 std::string /* module_name */,
545 std::string /* function_name */,
546 base::ListValue /* args */)
547
548// Set the top-level frame to the provided name.
549IPC_MESSAGE_ROUTED1(ExtensionMsg_SetFrameName,
550 std::string /* frame_name */)
551
552// Tell the renderer process the platforms system font.
553IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont,
554 std::string /* font_family */,
555 std::string /* font_size */)
556
557// Marks an extension as 'active' in an extension process. 'Active' extensions
558// have more privileges than other extension content that might end up running
559// in the process (e.g. because of iframes or content scripts).
560IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension,
561 std::string /* extension_id */)
562
563// Notifies the renderer that extensions were loaded in the browser.
564IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
565 std::vector<ExtensionMsg_Loaded_Params>)
566
567// Notifies the renderer that an extension was unloaded in the browser.
568IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded,
569 std::string)
570
571// Updates the scripting whitelist for extensions in the render process. This is
572// only used for testing.
573IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
574 // extension ids
575 extensions::ExtensionsClient::ScriptingWhitelist)
576
577// Notification that renderer should run some JavaScript code.
578IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode,
579 ExtensionMsg_ExecuteCode_Params)
580
581// Notification that the user scripts have been updated. It has one
582// SharedMemoryHandle argument consisting of the pickled script data. This
583// handle is valid in the context of the renderer.
584// If |owner| is not empty, then the shared memory handle refers to |owner|'s
585// programmatically-defined scripts. Otherwise, the handle refers to all
586// hosts' statically defined scripts. So far, only extension-hosts support
587// statically defined scripts; WebUI-hosts don't.
588// If |changed_hosts| is not empty, only the host in that set will
589// be updated. Otherwise, all hosts that have scripts in the shared memory
590// region will be updated. Note that the empty set => all hosts case is not
591// supported for per-extension programmatically-defined script regions; in such
592// regions, the owner is expected to list itself as the only changed host.
593// If |whitelisted_only| is true, this process should only run whitelisted
594// scripts and not all user scripts.
595IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateUserScripts,
596 base::SharedMemoryHandle,
597 HostID /* owner */,
598 std::set<HostID> /* changed hosts */,
599 bool /* whitelisted_only */)
600
601// Trigger to execute declarative content script under browser control.
602IPC_MESSAGE_ROUTED4(ExtensionMsg_ExecuteDeclarativeScript,
603 int /* tab identifier */,
604 extensions::ExtensionId /* extension identifier */,
605 int /* script identifier */,
606 GURL /* page URL where script should be injected */)
607
608// Tell the render view which browser window it's being attached to.
609IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId,
610 int /* id of browser window */)
611
612// Tell the render view what its tab ID is.
613IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId,
614 int /* id of tab */)
615
616// Tell the renderer to update an extension's permission set.
617IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdatePermissions,
618 ExtensionMsg_UpdatePermissions_Params)
619
620// Tell the renderer to update an extension's policy_blocked_hosts set.
621IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdateDefaultPolicyHostRestrictions,
622 ExtensionMsg_UpdateDefaultPolicyHostRestrictions_Params)
623
624// Tell the render view about new tab-specific permissions for an extension.
625IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdateTabSpecificPermissions,
626 GURL /* url */,
627 std::string /* extension_id */,
628 extensions::URLPatternSet /* hosts */,
629 bool /* update origin whitelist */,
630 int /* tab_id */)
631
632// Tell the render view to clear tab-specific permissions for some extensions.
633IPC_MESSAGE_CONTROL3(ExtensionMsg_ClearTabSpecificPermissions,
634 std::vector<std::string> /* extension_ids */,
635 bool /* update origin whitelist */,
636 int /* tab_id */)
637
638// Tell the renderer which type this view is.
639IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
640 extensions::ViewType /* view_type */)
641
642// The browser's response to the ExtensionMsg_WakeEventPage IPC.
643IPC_MESSAGE_CONTROL2(ExtensionMsg_WakeEventPageResponse,
644 int /* request_id */,
645 bool /* success */)
646
647// Ask the lazy background page if it is ready to be suspended. This is sent
648// when the page is considered idle. The renderer will reply with the same
649// sequence_id so that we can tell which message it is responding to.
650IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend,
651 std::string /* extension_id */,
652 uint64_t /* sequence_id */)
653
654// If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
655// the lazy background page becoming active again, we are ready to unload. This
656// message tells the page to dispatch the suspend event.
657IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend,
658 std::string /* extension_id */)
659
660// The browser changed its mind about suspending this extension.
661IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend,
662 std::string /* extension_id */)
663
664// Response to the renderer for ExtensionHostMsg_GetAppInstallState.
665IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
666 std::string /* state */,
667 int32_t /* callback_id */)
668
669// Check whether the Port for extension messaging exists in a frame or a Service
670// Worker. If the port ID is unknown, the frame replies with
671// ExtensionHostMsg_CloseMessagePort.
672IPC_MESSAGE_ROUTED2(ExtensionMsg_ValidateMessagePort,
673 // For main thread, this is kMainThreadId.
674 int /* worker_thread_id */,
675 extensions::PortId /* port_id */)
676
677// Dispatch the Port.onConnect event for message channels.
678IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
679 // For main thread, this is kMainThreadId.
680 // TODO(lazyboy): Can this be base::Optional<int> instead?
681 int /* worker_thread_id */,
682 extensions::PortId /* target_port_id */,
683 std::string /* channel_name */,
684 ExtensionMsg_TabConnectionInfo /* source */,
685 ExtensionMsg_ExternalConnectionInfo)
686
687// Deliver a message sent with ExtensionHostMsg_PostMessage.
688IPC_MESSAGE_ROUTED3(ExtensionMsg_DeliverMessage,
689 // For main thread, this is kMainThreadId.
690 int /* worker_thread_id */,
691 extensions::PortId /* target_port_id */,
692 extensions::Message)
693
694// Dispatch the Port.onDisconnect event for message channels.
695IPC_MESSAGE_ROUTED3(ExtensionMsg_DispatchOnDisconnect,
696 // For main thread, this is kMainThreadId.
697 int /* worker_thread_id */,
698 extensions::PortId /* port_id */,
699 std::string /* error_message */)
700
701// Informs the renderer what channel (dev, beta, stable, etc) and user session
702// type is running.
703IPC_MESSAGE_CONTROL3(ExtensionMsg_SetSessionInfo,
704 version_info::Channel /* channel */,
705 extensions::FeatureSessionType /* session_type */,
706 bool /* is_lock_screen_context */)
707
708// Notify the renderer that its window has closed.
709IPC_MESSAGE_ROUTED1(ExtensionMsg_AppWindowClosed, bool /* send_onclosed */)
710
711// Notify the renderer that an extension wants notifications when certain
712// searches match the active page. This message replaces the old set of
713// searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
714// each tab to keep the browser updated about changes.
715IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
716 std::vector<std::string> /* CSS selectors */)
717
718// Send by the browser to indicate a Blob handle has been transferred to the
719// renderer. This is sent after the actual extension response, and depends on
720// the sequential nature of IPCs so that the blob has already been caught.
721// This is a separate control message, so that the renderer process will send
722// an acknowledgement even if the RenderView has closed or navigated away.
723IPC_MESSAGE_CONTROL1(ExtensionMsg_TransferBlobs,
724 std::vector<std::string> /* blob_uuids */)
725
726// Report the WebView partition ID to the WebView guest renderer process.
727IPC_MESSAGE_CONTROL1(ExtensionMsg_SetWebViewPartitionID,
728 std::string /* webview_partition_id */)
729
730// Enable or disable spatial navigation.
731IPC_MESSAGE_ROUTED1(ExtensionMsg_SetSpatialNavigationEnabled,
732 bool /* spatial_nav_enabled */)
733
734// Messages sent from the renderer to the browser:
735
736// A renderer sends this message when an extension process starts an API
737// request. The browser will always respond with a ExtensionMsg_Response.
738IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request,
739 ExtensionHostMsg_Request_Params)
740
741// A renderer sends this message when an extension process starts an API
742// request. The browser will always respond with a ExtensionMsg_Response.
743IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
744 int /* routing_id */,
745 ExtensionHostMsg_Request_Params)
746
747// A service worker thread sends this message when an extension service worker
748// starts an API request. The browser will always respond with a
749// ExtensionMsg_ResponseWorker. This message is for API requests that run on
750// the IO thread. It is defined here so it's handled by the same message
751// filter as ExtensionHostMsg_RequestForIOThread.
752IPC_MESSAGE_CONTROL1(ExtensionHostMsg_RequestWorkerForIOThread,
753 ExtensionHostMsg_Request_Params)
754
755// Notify the browser that the given extension added a listener to an event.
756IPC_MESSAGE_CONTROL5(ExtensionHostMsg_AddListener,
757 std::string /* extension_id */,
758 GURL /* listener_or_worker_scope_url */,
759 std::string /* name */,
760 int64_t /* service_worker_version_id */,
761 int /* worker_thread_id */)
762
763// Notify the browser that the given extension removed a listener from an
764// event.
765IPC_MESSAGE_CONTROL5(ExtensionHostMsg_RemoveListener,
766 std::string /* extension_id */,
767 GURL /* listener_or_worker_scope_url */,
768 std::string /* name */,
769 int64_t /* service_worker_version_id */,
770 int /* worker_thread_id */)
771
772// Notify the browser that the given extension added a listener to an event from
773// a lazy background page.
774IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
775 std::string /* extension_id */,
776 std::string /* name */)
777
778// Notify the browser that the given extension is no longer interested in
779// receiving the given event from a lazy background page.
780IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
781 std::string /* extension_id */,
782 std::string /* event_name */)
783
784// Notify the browser that the given extension added a listener to an event from
785// an extension service worker.
786IPC_MESSAGE_CONTROL3(ExtensionHostMsg_AddLazyServiceWorkerListener,
787 std::string /* extension_id */,
788 std::string /* name */,
789 GURL /* service_worker_scope */)
790
791// Notify the browser that the given extension is no longer interested in
792// receiving the given event from an extension service worker.
793IPC_MESSAGE_CONTROL3(ExtensionHostMsg_RemoveLazyServiceWorkerListener,
794 std::string /* extension_id */,
795 std::string /* name */,
796 GURL /* service_worker_scope */)
797
798// Notify the browser that the given extension added a listener to instances of
799// the named event that satisfy the filter.
800// If |sw_identifier| is specified, it implies that the listener is for a
801// service worker, and the param is used to identify the worker.
802IPC_MESSAGE_CONTROL5(
803 ExtensionHostMsg_AddFilteredListener,
804 std::string /* extension_id */,
805 std::string /* name */,
806 base::Optional<ServiceWorkerIdentifier> /* sw_identifier */,
807 base::DictionaryValue /* filter */,
808 bool /* lazy */)
809
810// Notify the browser that the given extension is no longer interested in
811// instances of the named event that satisfy the filter.
812// If |sw_identifier| is specified, it implies that the listener is for a
813// service worker, and the param is used to identify the worker.
814IPC_MESSAGE_CONTROL5(
815 ExtensionHostMsg_RemoveFilteredListener,
816 std::string /* extension_id */,
817 std::string /* name */,
818 base::Optional<ServiceWorkerIdentifier> /* sw_identifier */,
819 base::DictionaryValue /* filter */,
820 bool /* lazy */)
821
822// Notify the browser that an event has finished being dispatched.
823IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
824
825// Open a channel to all listening contexts owned by the extension with
826// the given ID. This responds asynchronously with ExtensionMsg_AssignPortId.
827// If an error occurred, the opener will be notified asynchronously.
828IPC_MESSAGE_CONTROL4(ExtensionHostMsg_OpenChannelToExtension,
829 extensions::PortContext /* source_context */,
830 ExtensionMsg_ExternalConnectionInfo,
831 std::string /* channel_name */,
832 extensions::PortId /* port_id */)
833
834IPC_MESSAGE_CONTROL3(ExtensionHostMsg_OpenChannelToNativeApp,
835 extensions::PortContext /* source_context */,
836 std::string /* native_app_name */,
837 extensions::PortId /* port_id */)
838
839// Get a port handle to the given tab. The handle can be used for sending
840// messages to the extension.
841IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToTab,
842 extensions::PortContext /* source_context */,
843 ExtensionMsg_TabTargetConnectionInfo,
844 std::string /* extension_id */,
845 std::string /* channel_name */,
846 extensions::PortId /* port_id */)
847
848// Sent in response to ExtensionMsg_DispatchOnConnect when the port is accepted.
849// The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
850IPC_MESSAGE_CONTROL2(ExtensionHostMsg_OpenMessagePort,
851 extensions::PortContext /* port_context */,
852 extensions::PortId /* port_id */)
853
854// Sent in response to ExtensionMsg_DispatchOnConnect and whenever the port is
855// closed. The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
856IPC_MESSAGE_CONTROL3(ExtensionHostMsg_CloseMessagePort,
857 extensions::PortContext /* port_context */,
858 extensions::PortId /* port_id */,
859 bool /* force_close */)
860
861// Send a message to an extension process. The handle is the value returned
862// by ExtensionHostMsg_OpenChannelTo*.
863IPC_MESSAGE_CONTROL2(ExtensionHostMsg_PostMessage,
864 extensions::PortId /* port_id */,
865 extensions::Message)
866
867// Used to get the extension message bundle.
868IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
869 std::string /* extension id */,
870 SubstitutionMap /* message bundle */)
871
872// Sent from the renderer to the browser to return the script running result.
873IPC_MESSAGE_ROUTED4(
874 ExtensionHostMsg_ExecuteCodeFinished,
875 int /* request id */,
876 std::string /* error; empty implies success */,
877 GURL /* URL of the code executed on. May be empty if unsuccessful. */,
878 base::ListValue /* result of the script */)
879
880// Sent from the renderer to the browser to notify that content scripts are
881// running in the renderer that the IPC originated from.
882IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
883 ExecutingScriptsMap,
884 GURL /* url of the _topmost_ frame */)
885
886// Sent from the renderer to the browser to request permission for a script
887// injection.
888// If request id is -1, this signals that the request has already ran, and this
889// merely serves as a notification. This happens when the feature to disable
890// scripts running without user consent is not enabled.
891IPC_MESSAGE_ROUTED4(ExtensionHostMsg_RequestScriptInjectionPermission,
892 std::string /* extension id */,
893 extensions::UserScript::InjectionType /* script type */,
894 extensions::UserScript::RunLocation /* run location */,
895 int64_t /* request id */)
896
897// Sent from the browser to the renderer in reply to a
898// RequestScriptInjectionPermission message, granting permission for a script
899// script to run.
900IPC_MESSAGE_ROUTED1(ExtensionMsg_PermitScriptInjection,
901 int64_t /* request id */)
902
903// Sent by the renderer when a web page is checking if its app is installed.
904IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
905 GURL /* requestor_url */,
906 int32_t /* return_route_id */,
907 int32_t /* callback_id */)
908
909// Optional Ack message sent to the browser to notify that the response to a
910// function has been processed.
911IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
912 int /* request_id */)
913
914// Response to ExtensionMsg_ShouldSuspend.
915IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
916 std::string /* extension_id */,
917 uint64_t /* sequence_id */)
918
919// Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
920IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
921 std::string /* extension_id */)
922
923// Informs the browser to increment the keepalive count for the lazy background
924// page, keeping it alive.
925IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
926
927// Informs the browser there is one less thing keeping the lazy background page
928// alive.
929IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
930
931// Fetches a globally unique ID (for the lifetime of the browser) from the
932// browser process.
933IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
934 int /* unique_id */)
935
936// Notify the browser that an app window is ready and can resume resource
937// requests.
938IPC_MESSAGE_ROUTED0(ExtensionHostMsg_AppWindowReady)
939
940// Sent by the renderer when the draggable regions are updated.
941IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
942 std::vector<extensions::DraggableRegion> /* regions */)
943
944// Sent by the renderer to log an API action to the extension activity log.
945IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
946 std::string /* extension_id */,
947 ExtensionHostMsg_APIActionOrEvent_Params)
948
949// Sent by the renderer to log an event to the extension activity log.
950IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
951 std::string /* extension_id */,
952 ExtensionHostMsg_APIActionOrEvent_Params)
953
954// Sent by the renderer to log a DOM action to the extension activity log.
955IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
956 std::string /* extension_id */,
957 ExtensionHostMsg_DOMAction_Params)
958
959// Notifies the browser process that a tab has started or stopped matching
960// certain conditions. This message is sent in response to several events:
961//
962// * ExtensionMsg_WatchPages was received, updating the set of conditions.
963// * A new page is loaded. This will be sent after
964// mojom::FrameHost::DidCommitProvisionalLoad. Currently this only fires for
965// the main frame.
966// * Something changed on an existing frame causing the set of matching searches
967// to change.
968IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
969 std::vector<std::string> /* Matching CSS selectors */)
970
971// Sent by the renderer when it has received a Blob handle from the browser.
972IPC_MESSAGE_CONTROL1(ExtensionHostMsg_TransferBlobsAck,
973 std::vector<std::string> /* blob_uuids */)
974
975// Asks the browser to wake the event page of an extension.
976// The browser will reply with ExtensionHostMsg_WakeEventPageResponse.
977IPC_MESSAGE_CONTROL2(ExtensionHostMsg_WakeEventPage,
978 int /* request_id */,
979 std::string /* extension_id */)
980
981// Tells listeners that a detailed message was reported to the console by
982// WebKit.
983IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
984 base::string16 /* message */,
985 base::string16 /* source */,
986 extensions::StackTrace /* stack trace */,
987 int32_t /* severity level */)
988
989// Sent when a query selector request is made from the automation API.
990// acc_obj_id is the accessibility tree ID of the starting element.
991IPC_MESSAGE_ROUTED3(ExtensionMsg_AutomationQuerySelector,
992 int /* request_id */,
993 int /* acc_obj_id */,
994 base::string16 /* selector */)
995
996// Result of a query selector request.
997// result_acc_obj_id is the accessibility tree ID of the result element; 0
998// indicates no result.
999IPC_MESSAGE_ROUTED3(ExtensionHostMsg_AutomationQuerySelector_Result,
1000 int /* request_id */,
1001 ExtensionHostMsg_AutomationQuerySelector_Error /* error */,
1002 int /* result_acc_obj_id */)
1003
1004// Tells the renderer whether or not activity logging is enabled. This is only
1005// sent if logging is or was previously enabled; not being enabled is assumed
1006// otherwise.
1007IPC_MESSAGE_CONTROL1(ExtensionMsg_SetActivityLoggingEnabled, bool /* enabled */)
1008
1009// Messages related to Extension Service Worker.
1010#undef IPC_MESSAGE_START
1011#define IPC_MESSAGE_START ExtensionWorkerMsgStart
1012// A service worker thread sends this message when an extension service worker
1013// starts an API request. The browser will always respond with a
1014// ExtensionMsg_ResponseWorker.
1015IPC_MESSAGE_CONTROL1(ExtensionHostMsg_RequestWorker,
1016 ExtensionHostMsg_Request_Params)
1017
1018// The browser sends this message in response to all service worker extension
1019// api calls. The response data (if any) is one of the base::Value subclasses,
1020// wrapped as the first element in a ListValue.
1021IPC_MESSAGE_CONTROL5(ExtensionMsg_ResponseWorker,
1022 int /* thread_id */,
1023 int /* request_id */,
1024 bool /* success */,
1025 base::ListValue /* response wrapper (see comment above) */,
1026 std::string /* error */)
1027
1028// Asks the browser to increment the pending activity count for
1029// the worker with version id |service_worker_version_id|.
1030// Each request to increment must use unique |request_uuid|. If a request with
1031// |request_uuid| is already in progress (due to race condition or renderer
1032// compromise), browser process ignores the IPC.
1033IPC_MESSAGE_CONTROL2(ExtensionHostMsg_IncrementServiceWorkerActivity,
1034 int64_t /* service_worker_version_id */,
1035 std::string /* request_uuid */)
1036
1037// Asks the browser to decrement the pending activity count for
1038// the worker with version id |service_worker_version_id|.
1039// |request_uuid| must match the GUID of a previous request, otherwise the
1040// browser process ignores the IPC.
1041IPC_MESSAGE_CONTROL2(ExtensionHostMsg_DecrementServiceWorkerActivity,
1042 int64_t /* service_worker_version_id */,
1043 std::string /* request_uuid */)
1044
1045// Tells the browser that an event with |event_id| was successfully dispatched
1046// to the worker with version |service_worker_version_id|.
1047IPC_MESSAGE_CONTROL2(ExtensionHostMsg_EventAckWorker,
1048 int64_t /* service_worker_version_id */,
1049 int /* event_id */)
1050
1051// Tells the browser that an extension service worker context was initialized,
1052// but possibly didn't start executing its top-level JavaScript.
1053IPC_MESSAGE_CONTROL3(ExtensionHostMsg_DidInitializeServiceWorkerContext,
1054 std::string /* extension_id */,
1055 int64_t /* service_worker_version_id */,
1056 int /* worker_thread_id */)
1057
1058// Tells the browser that an extension service worker context has started and
1059// finished executing its top-level JavaScript.
1060// Start corresponds to EmbeddedWorkerInstance::OnStarted notification.
1061//
1062// TODO(lazyboy): This is a workaround: ideally this IPC should be redundant
1063// because it directly corresponds to EmbeddedWorkerInstance::OnStarted message.
1064// However, because OnStarted message is on different mojo IPC pipe, and most
1065// extension IPCs are on legacy IPC pipe, this IPC is necessary to ensure FIFO
1066// ordering of this message with rest of the extension IPCs.
1067// Two possible solutions to this:
1068// - Associate extension IPCs with Service Worker IPCs. This can be done (and
1069// will be a requirement) when extension IPCs are moved to mojo, but
1070// requires resolving or defining ordering dependencies amongst the
1071// extension messages, and any additional messages in Chrome.
1072// - Make Service Worker IPCs channel-associated so that there's FIFO
1073// guarantee between extension IPCs and Service Worker IPCs. This isn't
1074// straightforward as it changes SW IPC ordering with respect of rest of
1075// Chrome.
1076// See https://crbug.com/879015#c4 for details.
1077IPC_MESSAGE_CONTROL4(ExtensionHostMsg_DidStartServiceWorkerContext,
1078 std::string /* extension_id */,
1079 GURL /* service_worker_scope */,
1080 int64_t /* service_worker_version_id */,
1081 int /* worker_thread_id */)
1082
1083// Tells the browser that an extension service worker context has been
1084// destroyed.
1085IPC_MESSAGE_CONTROL4(ExtensionHostMsg_DidStopServiceWorkerContext,
1086 std::string /* extension_id */,
1087 GURL /* service_worker_scope */,
1088 int64_t /* service_worker_version_id */,
1089 int /* worker_thread_id */)
1090
1091IPC_STRUCT_TRAITS_BEGIN(ui::AXNodeData)
1092 IPC_STRUCT_TRAITS_MEMBER(id)
1093 IPC_STRUCT_TRAITS_MEMBER(role)
1094 IPC_STRUCT_TRAITS_MEMBER(state)
1095 IPC_STRUCT_TRAITS_MEMBER(actions)
1096 IPC_STRUCT_TRAITS_MEMBER(string_attributes)
1097 IPC_STRUCT_TRAITS_MEMBER(int_attributes)
1098 IPC_STRUCT_TRAITS_MEMBER(float_attributes)
1099 IPC_STRUCT_TRAITS_MEMBER(bool_attributes)
1100 IPC_STRUCT_TRAITS_MEMBER(intlist_attributes)
1101 IPC_STRUCT_TRAITS_MEMBER(stringlist_attributes)
1102 IPC_STRUCT_TRAITS_MEMBER(html_attributes)
1103 IPC_STRUCT_TRAITS_MEMBER(child_ids)
1104 IPC_STRUCT_TRAITS_MEMBER(relative_bounds)
1105IPC_STRUCT_TRAITS_END()
1106
1107IPC_STRUCT_TRAITS_BEGIN(ui::AXTreeData)
1108 IPC_STRUCT_TRAITS_MEMBER(tree_id)
1109 IPC_STRUCT_TRAITS_MEMBER(parent_tree_id)
1110 IPC_STRUCT_TRAITS_MEMBER(focused_tree_id)
1111 IPC_STRUCT_TRAITS_MEMBER(url)
1112 IPC_STRUCT_TRAITS_MEMBER(title)
1113 IPC_STRUCT_TRAITS_MEMBER(mimetype)
1114 IPC_STRUCT_TRAITS_MEMBER(doctype)
1115 IPC_STRUCT_TRAITS_MEMBER(loaded)
1116 IPC_STRUCT_TRAITS_MEMBER(loading_progress)
1117 IPC_STRUCT_TRAITS_MEMBER(focus_id)
1118 IPC_STRUCT_TRAITS_MEMBER(sel_is_backward)
1119 IPC_STRUCT_TRAITS_MEMBER(sel_anchor_object_id)
1120 IPC_STRUCT_TRAITS_MEMBER(sel_anchor_offset)
1121 IPC_STRUCT_TRAITS_MEMBER(sel_anchor_affinity)
1122 IPC_STRUCT_TRAITS_MEMBER(sel_focus_object_id)
1123 IPC_STRUCT_TRAITS_MEMBER(sel_focus_offset)
1124 IPC_STRUCT_TRAITS_MEMBER(sel_focus_affinity)
1125IPC_STRUCT_TRAITS_END()
1126
1127IPC_STRUCT_TRAITS_BEGIN(ui::AXTreeUpdate)
1128 IPC_STRUCT_TRAITS_MEMBER(has_tree_data)
1129 IPC_STRUCT_TRAITS_MEMBER(tree_data)
1130 IPC_STRUCT_TRAITS_MEMBER(node_id_to_clear)
1131 IPC_STRUCT_TRAITS_MEMBER(root_id)
1132 IPC_STRUCT_TRAITS_MEMBER(nodes)
1133 IPC_STRUCT_TRAITS_MEMBER(event_from)
1134IPC_STRUCT_TRAITS_END()
1135
1136IPC_STRUCT_BEGIN(ExtensionMsg_AccessibilityEventBundleParams)
1137 // ID of the accessibility tree that this event applies to.
1138 IPC_STRUCT_MEMBER(ui::AXTreeID, tree_id)
1139
1140 // Zero or more updates to the accessibility tree to apply first.
1141 IPC_STRUCT_MEMBER(std::vector<ui::AXTreeUpdate>, updates)
1142
1143 // Zero or more events to fire after the tree updates have been applied.
1144 IPC_STRUCT_MEMBER(std::vector<ui::AXEvent>, events)
1145
1146 // The mouse location in screen coordinates.
1147 IPC_STRUCT_MEMBER(gfx::Point, mouse_location)
1148IPC_STRUCT_END()
1149
1150IPC_STRUCT_BEGIN(ExtensionMsg_AccessibilityLocationChangeParams)
1151 // ID of the accessibility tree that this event applies to.
1152 IPC_STRUCT_MEMBER(ui::AXTreeID, tree_id)
1153
1154 // ID of the object whose location is changing.
1155 IPC_STRUCT_MEMBER(int, id)
1156
1157 // The object's new location info.
1158 IPC_STRUCT_MEMBER(ui::AXRelativeBounds, new_location)
1159IPC_STRUCT_END()
1160
1161// Forward an accessibility message to an extension process where an
1162// extension is using the automation API to listen for accessibility events.
1163IPC_MESSAGE_CONTROL2(ExtensionMsg_AccessibilityEventBundle,
1164 ExtensionMsg_AccessibilityEventBundleParams /* events */,
1165 bool /* is_active_profile */)
1166
1167// Forward an accessibility location change message to an extension process
1168// where an extension is using the automation API to listen for
1169// accessibility events.
1170IPC_MESSAGE_CONTROL1(ExtensionMsg_AccessibilityLocationChange,
1171 ExtensionMsg_AccessibilityLocationChangeParams)
1172
1173#endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
1174