extension_messages.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  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. // IPC messages for extensions.
  5. #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
  6. #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
  7. #include <stdint.h>
  8. #include <map>
  9. #include <memory>
  10. #include <set>
  11. #include <string>
  12. #include <vector>
  13. #include "base/memory/read_only_shared_memory_region.h"
  14. #include "base/values.h"
  15. #include "content/public/common/common_param_traits.h"
  16. #include "content/public/common/socket_permission_request.h"
  17. #include "extensions/common/activation_sequence.h"
  18. #include "extensions/common/api/messaging/message.h"
  19. #include "extensions/common/api/messaging/messaging_endpoint.h"
  20. #include "extensions/common/api/messaging/port_context.h"
  21. #include "extensions/common/api/messaging/port_id.h"
  22. #include "extensions/common/api/messaging/serialization_format.h"
  23. #include "extensions/common/common_param_traits.h"
  24. #include "extensions/common/constants.h"
  25. #include "extensions/common/draggable_region.h"
  26. #include "extensions/common/extension.h"
  27. #include "extensions/common/extension_guid.h"
  28. #include "extensions/common/extensions_client.h"
  29. #include "extensions/common/message_bundle.h"
  30. #include "extensions/common/mojom/css_origin.mojom-shared.h"
  31. #include "extensions/common/mojom/event_dispatcher.mojom.h"
  32. #include "extensions/common/mojom/feature_session_type.mojom.h"
  33. #include "extensions/common/mojom/frame.mojom.h"
  34. #include "extensions/common/mojom/host_id.mojom.h"
  35. #include "extensions/common/mojom/injection_type.mojom-shared.h"
  36. #include "extensions/common/mojom/manifest.mojom-shared.h"
  37. #include "extensions/common/mojom/run_location.mojom-shared.h"
  38. #include "extensions/common/permissions/socket_permission_data.h"
  39. #include "extensions/common/permissions/usb_device_permission_data.h"
  40. #include "extensions/common/stack_frame.h"
  41. #include "extensions/common/user_script.h"
  42. #include "ipc/ipc_message_macros.h"
  43. #include "ipc/ipc_message_start.h"
  44. #include "ipc/ipc_message_utils.h"
  45. #include "ui/accessibility/ax_param_traits.h"
  46. #include "url/gurl.h"
  47. #include "url/origin.h"
  48. #define IPC_MESSAGE_START ExtensionMsgStart
  49. IPC_ENUM_TRAITS_MAX_VALUE(extensions::mojom::CSSOrigin,
  50. extensions::mojom::CSSOrigin::kMaxValue)
  51. IPC_ENUM_TRAITS_MAX_VALUE(content::SocketPermissionRequest::OperationType,
  52. content::SocketPermissionRequest::OPERATION_TYPE_LAST)
  53. IPC_ENUM_TRAITS_MAX_VALUE(extensions::mojom::RunLocation,
  54. extensions::mojom::RunLocation::kMaxValue)
  55. IPC_ENUM_TRAITS_MAX_VALUE(extensions::MessagingEndpoint::Type,
  56. extensions::MessagingEndpoint::Type::kLast)
  57. IPC_ENUM_TRAITS_MAX_VALUE(extensions::SerializationFormat,
  58. extensions::SerializationFormat::kLast)
  59. // Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
  60. // ExtensionHostMsg_AddEventToActivityLog.
  61. IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params)
  62. // API name.
  63. IPC_STRUCT_MEMBER(std::string, api_call)
  64. // List of arguments.
  65. IPC_STRUCT_MEMBER(base::Value::List, arguments)
  66. // Extra logging information.
  67. IPC_STRUCT_MEMBER(std::string, extra)
  68. IPC_STRUCT_END()
  69. // Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
  70. IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params)
  71. // URL of the page.
  72. IPC_STRUCT_MEMBER(GURL, url)
  73. // Title of the page.
  74. IPC_STRUCT_MEMBER(std::u16string, url_title)
  75. // API name.
  76. IPC_STRUCT_MEMBER(std::string, api_call)
  77. // List of arguments.
  78. IPC_STRUCT_MEMBER(base::ListValue, arguments)
  79. // Type of DOM API call.
  80. IPC_STRUCT_MEMBER(int, call_type)
  81. IPC_STRUCT_END()
  82. // Parameters structure for ExtensionHostMsg_RequestWorker.
  83. IPC_STRUCT_TRAITS_BEGIN(extensions::mojom::RequestParams)
  84. // Message name.
  85. IPC_STRUCT_TRAITS_MEMBER(name)
  86. // List of message arguments.
  87. IPC_STRUCT_TRAITS_MEMBER(arguments)
  88. // Extension ID this request was sent from. This can be empty, in the case
  89. // where we expose APIs to normal web pages using the extension function
  90. // system.
  91. IPC_STRUCT_TRAITS_MEMBER(extension_id)
  92. // URL of the frame the request was sent from. This isn't necessarily an
  93. // extension url. Extension requests can also originate from content scripts,
  94. // in which case extension_id will indicate the ID of the associated
  95. // extension. Or, they can originate from hosted apps or normal web pages.
  96. IPC_STRUCT_TRAITS_MEMBER(source_url)
  97. // Unique request id to match requests and responses.
  98. IPC_STRUCT_TRAITS_MEMBER(request_id)
  99. // True if request has a callback specified.
  100. IPC_STRUCT_TRAITS_MEMBER(has_callback)
  101. // True if request is executed in response to an explicit user gesture.
  102. IPC_STRUCT_TRAITS_MEMBER(user_gesture)
  103. // If this API call is for a service worker, then this is the worker thread
  104. // id. Otherwise, this is kMainThreadId.
  105. IPC_STRUCT_TRAITS_MEMBER(worker_thread_id)
  106. // If this API call is for a service worker, then this is the service
  107. // worker version id. Otherwise, this is set to
  108. // blink::mojom::kInvalidServiceWorkerVersionId.
  109. IPC_STRUCT_TRAITS_MEMBER(service_worker_version_id)
  110. IPC_STRUCT_TRAITS_END()
  111. // Struct containing information about the sender of connect() calls that
  112. // originate from a tab.
  113. IPC_STRUCT_BEGIN(ExtensionMsg_TabConnectionInfo)
  114. // The tab from where the connection was created.
  115. IPC_STRUCT_MEMBER(base::DictionaryValue, tab)
  116. // The ID of the frame that initiated the connection.
  117. // 0 if main frame, positive otherwise. -1 if not initiated from a frame.
  118. IPC_STRUCT_MEMBER(int, frame_id)
  119. // The unique ID of the document of the frame that initiated the connection.
  120. IPC_STRUCT_MEMBER(std::string, document_id)
  121. // The lifecycle of the frame that initiated the connection.
  122. IPC_STRUCT_MEMBER(std::string, document_lifecycle)
  123. IPC_STRUCT_END()
  124. // Struct containing information about the destination of tab.connect().
  125. IPC_STRUCT_BEGIN(ExtensionMsg_TabTargetConnectionInfo)
  126. // The destination tab's ID.
  127. IPC_STRUCT_MEMBER(int, tab_id)
  128. // Frame ID of the destination. -1 for all frames, 0 for main frame and
  129. // positive if the destination is a specific child frame.
  130. IPC_STRUCT_MEMBER(int, frame_id)
  131. // The unique ID of the document of the target frame.
  132. IPC_STRUCT_MEMBER(std::string, document_id)
  133. IPC_STRUCT_END()
  134. IPC_STRUCT_TRAITS_BEGIN(extensions::MessagingEndpoint)
  135. IPC_STRUCT_TRAITS_MEMBER(type)
  136. IPC_STRUCT_TRAITS_MEMBER(extension_id)
  137. IPC_STRUCT_TRAITS_MEMBER(native_app_name)
  138. IPC_STRUCT_TRAITS_END()
  139. // Struct containing the data for external connections to extensions. Used to
  140. // handle the IPCs initiated by both connect() and onConnect().
  141. IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo)
  142. // The ID of the extension that is the target of the request.
  143. IPC_STRUCT_MEMBER(std::string, target_id)
  144. // Specifies the type and the ID of the endpoint that initiated the request.
  145. IPC_STRUCT_MEMBER(extensions::MessagingEndpoint, source_endpoint)
  146. // The URL of the frame that initiated the request.
  147. IPC_STRUCT_MEMBER(GURL, source_url)
  148. // The origin of the object that initiated the request.
  149. IPC_STRUCT_MEMBER(absl::optional<url::Origin>, source_origin)
  150. // The process ID of the webview that initiated the request.
  151. IPC_STRUCT_MEMBER(int, guest_process_id)
  152. // The render frame routing ID of the webview that initiated the request.
  153. IPC_STRUCT_MEMBER(int, guest_render_frame_routing_id)
  154. IPC_STRUCT_END()
  155. IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion)
  156. IPC_STRUCT_TRAITS_MEMBER(draggable)
  157. IPC_STRUCT_TRAITS_MEMBER(bounds)
  158. IPC_STRUCT_TRAITS_END()
  159. IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest)
  160. IPC_STRUCT_TRAITS_MEMBER(type)
  161. IPC_STRUCT_TRAITS_MEMBER(host)
  162. IPC_STRUCT_TRAITS_MEMBER(port)
  163. IPC_STRUCT_TRAITS_END()
  164. IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext::FrameContext)
  165. IPC_STRUCT_TRAITS_MEMBER(routing_id)
  166. IPC_STRUCT_TRAITS_END()
  167. IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext::WorkerContext)
  168. IPC_STRUCT_TRAITS_MEMBER(thread_id)
  169. IPC_STRUCT_TRAITS_MEMBER(version_id)
  170. IPC_STRUCT_TRAITS_MEMBER(extension_id)
  171. IPC_STRUCT_TRAITS_END()
  172. IPC_STRUCT_TRAITS_BEGIN(extensions::PortContext)
  173. IPC_STRUCT_TRAITS_MEMBER(frame)
  174. IPC_STRUCT_TRAITS_MEMBER(worker)
  175. IPC_STRUCT_TRAITS_END()
  176. IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionEntry)
  177. IPC_STRUCT_TRAITS_MEMBER(pattern_)
  178. IPC_STRUCT_TRAITS_MEMBER(match_subdomains_)
  179. IPC_STRUCT_TRAITS_END()
  180. IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData)
  181. IPC_STRUCT_TRAITS_MEMBER(entry())
  182. IPC_STRUCT_TRAITS_END()
  183. IPC_STRUCT_TRAITS_BEGIN(extensions::StackFrame)
  184. IPC_STRUCT_TRAITS_MEMBER(line_number)
  185. IPC_STRUCT_TRAITS_MEMBER(column_number)
  186. IPC_STRUCT_TRAITS_MEMBER(source)
  187. IPC_STRUCT_TRAITS_MEMBER(function)
  188. IPC_STRUCT_TRAITS_END()
  189. IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData)
  190. IPC_STRUCT_TRAITS_MEMBER(vendor_id())
  191. IPC_STRUCT_TRAITS_MEMBER(product_id())
  192. IPC_STRUCT_TRAITS_MEMBER(interface_class())
  193. IPC_STRUCT_TRAITS_END()
  194. IPC_STRUCT_TRAITS_BEGIN(extensions::Message)
  195. IPC_STRUCT_TRAITS_MEMBER(data)
  196. IPC_STRUCT_TRAITS_MEMBER(format)
  197. IPC_STRUCT_TRAITS_MEMBER(user_gesture)
  198. IPC_STRUCT_TRAITS_END()
  199. IPC_STRUCT_TRAITS_BEGIN(extensions::PortId)
  200. IPC_STRUCT_TRAITS_MEMBER(context_id)
  201. IPC_STRUCT_TRAITS_MEMBER(port_number)
  202. IPC_STRUCT_TRAITS_MEMBER(is_opener)
  203. IPC_STRUCT_TRAITS_MEMBER(serialization_format)
  204. IPC_STRUCT_TRAITS_END()
  205. // Singly-included section for custom IPC traits.
  206. #ifndef INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
  207. #define INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
  208. // Map of extensions IDs to the executing script paths.
  209. typedef std::map<std::string, std::set<std::string>> ExecutingScriptsMap;
  210. #endif // INTERNAL_EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
  211. // Messages sent from the browser to the renderer:
  212. // The browser's response to the ExtensionMsg_WakeEventPage IPC.
  213. IPC_MESSAGE_CONTROL2(ExtensionMsg_WakeEventPageResponse,
  214. int /* request_id */,
  215. bool /* success */)
  216. // Check whether the Port for extension messaging exists in a frame or a Service
  217. // Worker. If the port ID is unknown, the frame replies with
  218. // ExtensionHostMsg_CloseMessagePort.
  219. IPC_MESSAGE_ROUTED2(ExtensionMsg_ValidateMessagePort,
  220. // For main thread, this is kMainThreadId.
  221. int /* worker_thread_id */,
  222. extensions::PortId /* port_id */)
  223. // Dispatch the Port.onConnect event for message channels.
  224. IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
  225. // For main thread, this is kMainThreadId.
  226. // TODO(lazyboy): Can this be absl::optional<int> instead?
  227. int /* worker_thread_id */,
  228. extensions::PortId /* target_port_id */,
  229. std::string /* channel_name */,
  230. ExtensionMsg_TabConnectionInfo /* source */,
  231. ExtensionMsg_ExternalConnectionInfo)
  232. // Deliver a message sent with ExtensionHostMsg_PostMessage.
  233. IPC_MESSAGE_ROUTED3(ExtensionMsg_DeliverMessage,
  234. // For main thread, this is kMainThreadId.
  235. int /* worker_thread_id */,
  236. extensions::PortId /* target_port_id */,
  237. extensions::Message)
  238. // Dispatch the Port.onDisconnect event for message channels.
  239. IPC_MESSAGE_ROUTED3(ExtensionMsg_DispatchOnDisconnect,
  240. // For main thread, this is kMainThreadId.
  241. int /* worker_thread_id */,
  242. extensions::PortId /* port_id */,
  243. std::string /* error_message */)
  244. // Messages sent from the renderer to the browser:
  245. // Notify the browser that an event has finished being dispatched.
  246. IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
  247. // Open a channel to all listening contexts owned by the extension with
  248. // the given ID. This responds asynchronously with ExtensionMsg_AssignPortId.
  249. // If an error occurred, the opener will be notified asynchronously.
  250. IPC_MESSAGE_CONTROL4(ExtensionHostMsg_OpenChannelToExtension,
  251. extensions::PortContext /* source_context */,
  252. ExtensionMsg_ExternalConnectionInfo,
  253. std::string /* channel_name */,
  254. extensions::PortId /* port_id */)
  255. IPC_MESSAGE_CONTROL3(ExtensionHostMsg_OpenChannelToNativeApp,
  256. extensions::PortContext /* source_context */,
  257. std::string /* native_app_name */,
  258. extensions::PortId /* port_id */)
  259. // Get a port handle to the given tab. The handle can be used for sending
  260. // messages to the extension.
  261. IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToTab,
  262. extensions::PortContext /* source_context */,
  263. ExtensionMsg_TabTargetConnectionInfo,
  264. std::string /* extension_id */,
  265. std::string /* channel_name */,
  266. extensions::PortId /* port_id */)
  267. // Sent in response to ExtensionMsg_DispatchOnConnect when the port is accepted.
  268. // The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
  269. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_OpenMessagePort,
  270. extensions::PortContext /* port_context */,
  271. extensions::PortId /* port_id */)
  272. // Sent in response to ExtensionMsg_DispatchOnConnect and whenever the port is
  273. // closed. The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
  274. IPC_MESSAGE_CONTROL3(ExtensionHostMsg_CloseMessagePort,
  275. extensions::PortContext /* port_context */,
  276. extensions::PortId /* port_id */,
  277. bool /* force_close */)
  278. // Send a message to an extension process. The handle is the value returned
  279. // by ExtensionHostMsg_OpenChannelTo*.
  280. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_PostMessage,
  281. extensions::PortId /* port_id */,
  282. extensions::Message)
  283. // Send a message to tell the browser that one of the listeners for a message
  284. // indicated they are intending to reply later. The handle is the value returned
  285. // by ExtensionHostMsg_OpenChannelTo*.
  286. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ResponsePending,
  287. extensions::PortContext /* port_context */,
  288. extensions::PortId /*port_id */)
  289. // Used to get the extension message bundle.
  290. IPC_SYNC_MESSAGE_CONTROL1_1(
  291. ExtensionHostMsg_GetMessageBundle,
  292. std::string /* extension id */,
  293. extensions::MessageBundle::SubstitutionMap /* message bundle */)
  294. // Sent from the renderer to the browser to notify that content scripts are
  295. // running in the renderer that the IPC originated from.
  296. IPC_MESSAGE_ROUTED2(ExtensionHostMsg_ContentScriptsExecuting,
  297. ExecutingScriptsMap,
  298. GURL /* url of the _topmost_ frame */)
  299. // Optional Ack message sent to the browser to notify that the response to a
  300. // function has been processed.
  301. IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck, int /* request_id */)
  302. // Informs the browser to increment the keepalive count for the lazy background
  303. // page, keeping it alive.
  304. IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
  305. // Informs the browser there is one less thing keeping the lazy background page
  306. // alive.
  307. IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
  308. // Notify the browser that an app window is ready and can resume resource
  309. // requests.
  310. IPC_MESSAGE_ROUTED0(ExtensionHostMsg_AppWindowReady)
  311. // Sent by the renderer when the draggable regions are updated.
  312. IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
  313. std::vector<extensions::DraggableRegion> /* regions */)
  314. // Sent by the renderer to log an API action to the extension activity log.
  315. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
  316. std::string /* extension_id */,
  317. ExtensionHostMsg_APIActionOrEvent_Params)
  318. // Sent by the renderer to log an event to the extension activity log.
  319. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
  320. std::string /* extension_id */,
  321. ExtensionHostMsg_APIActionOrEvent_Params)
  322. // Sent by the renderer to log a DOM action to the extension activity log.
  323. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
  324. std::string /* extension_id */,
  325. ExtensionHostMsg_DOMAction_Params)
  326. // Asks the browser to wake the event page of an extension.
  327. // The browser will reply with ExtensionHostMsg_WakeEventPageResponse.
  328. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_WakeEventPage,
  329. int /* request_id */,
  330. std::string /* extension_id */)
  331. // Tells listeners that a detailed message was reported to the console by
  332. // WebKit.
  333. IPC_MESSAGE_ROUTED4(ExtensionHostMsg_DetailedConsoleMessageAdded,
  334. std::u16string /* message */,
  335. std::u16string /* source */,
  336. extensions::StackTrace /* stack trace */,
  337. int32_t /* severity level */)
  338. // Messages related to Extension Service Worker.
  339. #undef IPC_MESSAGE_START
  340. #define IPC_MESSAGE_START ExtensionWorkerMsgStart
  341. // A service worker thread sends this message when an extension service worker
  342. // starts an API request. The browser will always respond with a
  343. // ExtensionMsg_ResponseWorker.
  344. IPC_MESSAGE_CONTROL1(ExtensionHostMsg_RequestWorker,
  345. extensions::mojom::RequestParams)
  346. // The browser sends this message in response to all service worker extension
  347. // api calls. The response data (if any) is the first element in the Value::List
  348. // parameter.
  349. IPC_MESSAGE_CONTROL5(
  350. ExtensionMsg_ResponseWorker,
  351. int /* thread_id */,
  352. int /* request_id */,
  353. bool /* success */,
  354. base::Value::List /* response wrapper (see comment above) */,
  355. std::string /* error */)
  356. // Asks the browser to increment the pending activity count for
  357. // the worker with version id |service_worker_version_id|.
  358. // Each request to increment must use unique |request_uuid|. If a request with
  359. // |request_uuid| is already in progress (due to race condition or renderer
  360. // compromise), browser process ignores the IPC.
  361. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_IncrementServiceWorkerActivity,
  362. int64_t /* service_worker_version_id */,
  363. std::string /* request_uuid */)
  364. // Asks the browser to decrement the pending activity count for
  365. // the worker with version id |service_worker_version_id|.
  366. // |request_uuid| must match the GUID of a previous request, otherwise the
  367. // browser process ignores the IPC.
  368. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_DecrementServiceWorkerActivity,
  369. int64_t /* service_worker_version_id */,
  370. std::string /* request_uuid */)
  371. // Tells the browser that an event with |event_id| was successfully dispatched
  372. // to the worker with version |service_worker_version_id|.
  373. IPC_MESSAGE_CONTROL4(ExtensionHostMsg_EventAckWorker,
  374. std::string /* extension_id */,
  375. int64_t /* service_worker_version_id */,
  376. int /* worker_thread_id */,
  377. int /* event_id */)
  378. // Tells the browser that an extension service worker context was initialized,
  379. // but possibly didn't start executing its top-level JavaScript.
  380. IPC_MESSAGE_CONTROL3(ExtensionHostMsg_DidInitializeServiceWorkerContext,
  381. std::string /* extension_id */,
  382. int64_t /* service_worker_version_id */,
  383. int /* worker_thread_id */)
  384. // Tells the browser that an extension service worker context has started and
  385. // finished executing its top-level JavaScript.
  386. // Start corresponds to EmbeddedWorkerInstance::OnStarted notification.
  387. //
  388. // TODO(lazyboy): This is a workaround: ideally this IPC should be redundant
  389. // because it directly corresponds to EmbeddedWorkerInstance::OnStarted message.
  390. // However, because OnStarted message is on different mojo IPC pipe, and most
  391. // extension IPCs are on legacy IPC pipe, this IPC is necessary to ensure FIFO
  392. // ordering of this message with rest of the extension IPCs.
  393. // Two possible solutions to this:
  394. // - Associate extension IPCs with Service Worker IPCs. This can be done (and
  395. // will be a requirement) when extension IPCs are moved to mojo, but
  396. // requires resolving or defining ordering dependencies amongst the
  397. // extension messages, and any additional messages in Chrome.
  398. // - Make Service Worker IPCs channel-associated so that there's FIFO
  399. // guarantee between extension IPCs and Service Worker IPCs. This isn't
  400. // straightforward as it changes SW IPC ordering with respect of rest of
  401. // Chrome.
  402. // See https://crbug.com/879015#c4 for details.
  403. IPC_MESSAGE_CONTROL5(ExtensionHostMsg_DidStartServiceWorkerContext,
  404. std::string /* extension_id */,
  405. extensions::ActivationSequence /* activation_sequence */,
  406. GURL /* service_worker_scope */,
  407. int64_t /* service_worker_version_id */,
  408. int /* worker_thread_id */)
  409. // Tells the browser that an extension service worker context has been
  410. // destroyed.
  411. IPC_MESSAGE_CONTROL5(ExtensionHostMsg_DidStopServiceWorkerContext,
  412. std::string /* extension_id */,
  413. extensions::ActivationSequence /* activation_sequence */,
  414. GURL /* service_worker_scope */,
  415. int64_t /* service_worker_version_id */,
  416. int /* worker_thread_id */)
  417. // Optional Ack message sent to the browser to notify that the response to a
  418. // function has been processed.
  419. IPC_MESSAGE_CONTROL2(ExtensionHostMsg_WorkerResponseAck,
  420. int /* request_id */,
  421. int64_t /* service_worker_version_id */)
  422. IPC_STRUCT_BEGIN(ExtensionMsg_AccessibilityEventBundleParams)
  423. // ID of the accessibility tree that this event applies to.
  424. IPC_STRUCT_MEMBER(ui::AXTreeID, tree_id)
  425. // Zero or more updates to the accessibility tree to apply first.
  426. IPC_STRUCT_MEMBER(std::vector<ui::AXTreeUpdate>, updates)
  427. // Zero or more events to fire after the tree updates have been applied.
  428. IPC_STRUCT_MEMBER(std::vector<ui::AXEvent>, events)
  429. // The mouse location in screen coordinates.
  430. IPC_STRUCT_MEMBER(gfx::Point, mouse_location)
  431. IPC_STRUCT_END()
  432. IPC_STRUCT_BEGIN(ExtensionMsg_AccessibilityLocationChangeParams)
  433. // ID of the accessibility tree that this event applies to.
  434. IPC_STRUCT_MEMBER(ui::AXTreeID, tree_id)
  435. // ID of the object whose location is changing.
  436. IPC_STRUCT_MEMBER(int, id)
  437. // The object's new location info.
  438. IPC_STRUCT_MEMBER(ui::AXRelativeBounds, new_location)
  439. IPC_STRUCT_END()
  440. // Forward an accessibility message to an extension process where an
  441. // extension is using the automation API to listen for accessibility events.
  442. IPC_MESSAGE_CONTROL2(ExtensionMsg_AccessibilityEventBundle,
  443. ExtensionMsg_AccessibilityEventBundleParams /* events */,
  444. bool /* is_active_profile */)
  445. // Forward an accessibility location change message to an extension process
  446. // where an extension is using the automation API to listen for
  447. // accessibility events.
  448. IPC_MESSAGE_CONTROL1(ExtensionMsg_AccessibilityLocationChange,
  449. ExtensionMsg_AccessibilityLocationChangeParams)
  450. #endif // EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_