1// Copyright (c) 2012 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// Multiply-included message file, hence no include guard.
7
8#include <string>
9#include <vector>
10
11#include "base/memory/shared_memory.h"
12#include "base/values.h"
13#include "chrome/common/extensions/extension.h"
14#include "chrome/common/extensions/permissions/bluetooth_permission_data.h"
15#include "chrome/common/extensions/permissions/media_galleries_permission_data.h"
16#include "chrome/common/extensions/permissions/permission_set.h"
17#include "chrome/common/extensions/permissions/socket_permission_data.h"
18#include "chrome/common/extensions/permissions/usb_device_permission_data.h"
19#include "chrome/common/web_application_info.h"
20#include "content/public/common/common_param_traits.h"
21#include "content/public/common/socket_permission_request.h"
22#include "extensions/common/draggable_region.h"
23#include "extensions/common/url_pattern.h"
24#include "extensions/common/url_pattern_set.h"
25#include "extensions/common/view_type.h"
26#include "ipc/ipc_message_macros.h"
27#include "url/gurl.h"
28
29#define IPC_MESSAGE_START ExtensionMsgStart
30
31IPC_ENUM_TRAITS(extensions::ViewType)
32
33// Parameters structure for ExtensionHostMsg_AddAPIActionToActivityLog and
34// ExtensionHostMsg_AddEventToActivityLog.
35IPC_STRUCT_BEGIN(ExtensionHostMsg_APIActionOrEvent_Params)
36  // API name.
37  IPC_STRUCT_MEMBER(std::string, api_call)
38
39  // List of arguments.
40  IPC_STRUCT_MEMBER(base::ListValue, arguments)
41
42  // Extra logging information.
43  IPC_STRUCT_MEMBER(std::string, extra)
44IPC_STRUCT_END()
45
46// Parameters structure for ExtensionHostMsg_AddDOMActionToActivityLog.
47IPC_STRUCT_BEGIN(ExtensionHostMsg_DOMAction_Params)
48  // URL of the page.
49  IPC_STRUCT_MEMBER(GURL, url)
50
51  // Title of the page.
52  IPC_STRUCT_MEMBER(string16, url_title)
53
54  // API name.
55  IPC_STRUCT_MEMBER(std::string, api_call)
56
57  // List of arguments.
58  IPC_STRUCT_MEMBER(base::ListValue, arguments)
59
60  // Type of DOM API call.
61  IPC_STRUCT_MEMBER(int, call_type)
62IPC_STRUCT_END()
63
64// Parameters structure for ExtensionHostMsg_Request.
65IPC_STRUCT_BEGIN(ExtensionHostMsg_Request_Params)
66  // Message name.
67  IPC_STRUCT_MEMBER(std::string, name)
68
69  // List of message arguments.
70  IPC_STRUCT_MEMBER(base::ListValue, arguments)
71
72  // Extension ID this request was sent from. This can be empty, in the case
73  // where we expose APIs to normal web pages using the extension function
74  // system.
75  IPC_STRUCT_MEMBER(std::string, extension_id)
76
77  // URL of the frame the request was sent from. This isn't necessarily an
78  // extension url. Extension requests can also originate from content scripts,
79  // in which case extension_id will indicate the ID of the associated
80  // extension. Or, they can originate from hosted apps or normal web pages.
81  IPC_STRUCT_MEMBER(GURL, source_url)
82
83  // Unique request id to match requests and responses.
84  IPC_STRUCT_MEMBER(int, request_id)
85
86  // True if request has a callback specified.
87  IPC_STRUCT_MEMBER(bool, has_callback)
88
89  // True if request is executed in response to an explicit user gesture.
90  IPC_STRUCT_MEMBER(bool, user_gesture)
91IPC_STRUCT_END()
92
93// Allows an extension to execute code in a tab.
94IPC_STRUCT_BEGIN(ExtensionMsg_ExecuteCode_Params)
95  // The extension API request id, for responding.
96  IPC_STRUCT_MEMBER(int, request_id)
97
98  // The ID of the requesting extension. To know which isolated world to
99  // execute the code inside of.
100  IPC_STRUCT_MEMBER(std::string, extension_id)
101
102  // Whether the code is JavaScript or CSS.
103  IPC_STRUCT_MEMBER(bool, is_javascript)
104
105  // String of code to execute.
106  IPC_STRUCT_MEMBER(std::string, code)
107
108  // Whether to inject into all frames, or only the root frame.
109  IPC_STRUCT_MEMBER(bool, all_frames)
110
111  // When to inject the code.
112  IPC_STRUCT_MEMBER(int, run_at)
113
114  // Whether to execute code in the main world (as opposed to an isolated
115  // world).
116  IPC_STRUCT_MEMBER(bool, in_main_world)
117
118  // Whether the request is coming from a <webview>.
119  IPC_STRUCT_MEMBER(bool, is_web_view)
120IPC_STRUCT_END()
121
122// Struct containing the data for external connections to extensions. Used to
123// handle the IPCs initiated by both connect() and onConnect().
124IPC_STRUCT_BEGIN(ExtensionMsg_ExternalConnectionInfo)
125  // The ID of the extension that is the target of the request.
126  IPC_STRUCT_MEMBER(std::string, target_id)
127
128  // The ID of the extension that initiated the request. May be empty if it
129  // wasn't initiated by an extension.
130  IPC_STRUCT_MEMBER(std::string, source_id)
131
132  // The URL of the frame that initiated the request.
133  IPC_STRUCT_MEMBER(GURL, source_url)
134IPC_STRUCT_END()
135
136IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo::IconInfo)
137  IPC_STRUCT_TRAITS_MEMBER(url)
138  IPC_STRUCT_TRAITS_MEMBER(width)
139  IPC_STRUCT_TRAITS_MEMBER(height)
140  IPC_STRUCT_TRAITS_MEMBER(data)
141IPC_STRUCT_TRAITS_END()
142
143IPC_STRUCT_TRAITS_BEGIN(WebApplicationInfo)
144  IPC_STRUCT_TRAITS_MEMBER(title)
145  IPC_STRUCT_TRAITS_MEMBER(description)
146  IPC_STRUCT_TRAITS_MEMBER(app_url)
147  IPC_STRUCT_TRAITS_MEMBER(icons)
148  IPC_STRUCT_TRAITS_MEMBER(permissions)
149  IPC_STRUCT_TRAITS_MEMBER(launch_container)
150  IPC_STRUCT_TRAITS_MEMBER(is_offline_enabled)
151IPC_STRUCT_TRAITS_END()
152
153IPC_STRUCT_TRAITS_BEGIN(extensions::DraggableRegion)
154  IPC_STRUCT_TRAITS_MEMBER(draggable)
155  IPC_STRUCT_TRAITS_MEMBER(bounds)
156IPC_STRUCT_TRAITS_END()
157
158IPC_ENUM_TRAITS(content::SocketPermissionRequest::OperationType)
159
160IPC_STRUCT_TRAITS_BEGIN(content::SocketPermissionRequest)
161  IPC_STRUCT_TRAITS_MEMBER(type)
162  IPC_STRUCT_TRAITS_MEMBER(host)
163  IPC_STRUCT_TRAITS_MEMBER(port)
164IPC_STRUCT_TRAITS_END()
165
166IPC_STRUCT_TRAITS_BEGIN(extensions::SocketPermissionData)
167  IPC_STRUCT_TRAITS_MEMBER(pattern())
168  IPC_STRUCT_TRAITS_MEMBER(match_subdomains())
169IPC_STRUCT_TRAITS_END()
170
171IPC_STRUCT_TRAITS_BEGIN(extensions::UsbDevicePermissionData)
172  IPC_STRUCT_TRAITS_MEMBER(vendor_id())
173  IPC_STRUCT_TRAITS_MEMBER(product_id())
174IPC_STRUCT_TRAITS_END()
175
176IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData)
177  IPC_STRUCT_TRAITS_MEMBER(permission())
178IPC_STRUCT_TRAITS_END()
179
180IPC_STRUCT_TRAITS_BEGIN(extensions::BluetoothPermissionData)
181  IPC_STRUCT_TRAITS_MEMBER(uuid())
182IPC_STRUCT_TRAITS_END()
183
184// Singly-included section for custom IPC traits.
185#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_
186#define CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_
187
188// IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
189// to typedef it to avoid that.
190// Substitution map for l10n messages.
191typedef std::map<std::string, std::string> SubstitutionMap;
192
193// Map of extensions IDs to the executing script paths.
194typedef std::map<std::string, std::set<std::string> > ExecutingScriptsMap;
195
196struct ExtensionMsg_Loaded_Params {
197  ExtensionMsg_Loaded_Params();
198  ~ExtensionMsg_Loaded_Params();
199  explicit ExtensionMsg_Loaded_Params(const extensions::Extension* extension);
200
201  // Creates a new extension from the data in this object.
202  scoped_refptr<extensions::Extension> ConvertToExtension(
203      std::string* error) const;
204
205  // The subset of the extension manifest data we send to renderers.
206  linked_ptr<base::DictionaryValue> manifest;
207
208  // The location the extension was installed from.
209  extensions::Manifest::Location location;
210
211  // The path the extension was loaded from. This is used in the renderer only
212  // to generate the extension ID for extensions that are loaded unpacked.
213  base::FilePath path;
214
215  // The extension's active permissions.
216  extensions::APIPermissionSet apis;
217  extensions::URLPatternSet explicit_hosts;
218  extensions::URLPatternSet scriptable_hosts;
219
220  // We keep this separate so that it can be used in logging.
221  std::string id;
222
223  // Send creation flags so extension is initialized identically.
224  int creation_flags;
225};
226
227namespace IPC {
228
229template <>
230struct ParamTraits<URLPattern> {
231  typedef URLPattern param_type;
232  static void Write(Message* m, const param_type& p);
233  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
234  static void Log(const param_type& p, std::string* l);
235};
236
237template <>
238struct ParamTraits<extensions::URLPatternSet> {
239  typedef extensions::URLPatternSet param_type;
240  static void Write(Message* m, const param_type& p);
241  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
242  static void Log(const param_type& p, std::string* l);
243};
244
245template <>
246struct ParamTraits<extensions::APIPermission::ID> {
247  typedef extensions::APIPermission::ID param_type;
248  static void Write(Message* m, const param_type& p);
249  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
250  static void Log(const param_type& p, std::string* l);
251};
252
253template <>
254struct ParamTraits<extensions::APIPermission*> {
255  typedef extensions::APIPermission* param_type;
256  static void Log(const param_type& p, std::string* l);
257};
258
259template <>
260struct ParamTraits<extensions::APIPermissionSet> {
261  typedef extensions::APIPermissionSet param_type;
262  static void Write(Message* m, const param_type& p);
263  static bool Read(const Message* m, PickleIterator* iter, param_type* r);
264  static void Log(const param_type& p, std::string* l);
265};
266
267template <>
268struct ParamTraits<ExtensionMsg_Loaded_Params> {
269  typedef ExtensionMsg_Loaded_Params param_type;
270  static void Write(Message* m, const param_type& p);
271  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
272  static void Log(const param_type& p, std::string* l);
273};
274
275}  // namespace IPC
276
277#endif  // CHROME_COMMON_EXTENSIONS_EXTENSION_MESSAGES_H_
278
279// Messages sent from the browser to the renderer.
280
281// The browser sends this message in response to all extension api calls. The
282// response data (if any) is one of the base::Value subclasses, wrapped as the
283// first element in a ListValue.
284IPC_MESSAGE_ROUTED4(ExtensionMsg_Response,
285                    int /* request_id */,
286                    bool /* success */,
287                    base::ListValue /* response wrapper (see comment above) */,
288                    std::string /* error */)
289
290// This message is optionally routed.  If used as a control message, it will
291// call a javascript function |function_name| from module |module_name| in
292// every registered context in the target process.  If routed, it will be
293// restricted to the contexts that are part of the target RenderView.
294//
295// If |extension_id| is non-empty, the function will be invoked only in
296// contexts owned by the extension. |args| is a list of primitive Value types
297// that are passed to the function.
298IPC_MESSAGE_ROUTED5(ExtensionMsg_MessageInvoke,
299                    std::string /* extension_id */,
300                    std::string /* module_name */,
301                    std::string /* function_name */,
302                    base::ListValue /* args */,
303                    bool /* delivered as part of a user gesture */)
304
305// Tell the renderer process all known extension function names.
306IPC_MESSAGE_CONTROL1(ExtensionMsg_SetFunctionNames,
307                     std::vector<std::string>)
308
309// Tell the renderer process the platforms system font.
310IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSystemFont,
311                     std::string /* font_family */,
312                     std::string /* font_size */)
313
314// Marks an extension as 'active' in an extension process. 'Active' extensions
315// have more privileges than other extension content that might end up running
316// in the process (e.g. because of iframes or content scripts).
317IPC_MESSAGE_CONTROL1(ExtensionMsg_ActivateExtension,
318                     std::string /* extension_id */)
319
320// Notifies the renderer that extensions were loaded in the browser.
321IPC_MESSAGE_CONTROL1(ExtensionMsg_Loaded,
322                     std::vector<ExtensionMsg_Loaded_Params>)
323
324// Notifies the renderer that an extension was unloaded in the browser.
325IPC_MESSAGE_CONTROL1(ExtensionMsg_Unloaded,
326                     std::string)
327
328// Updates the scripting whitelist for extensions in the render process. This is
329// only used for testing.
330IPC_MESSAGE_CONTROL1(ExtensionMsg_SetScriptingWhitelist,
331                     // extension ids
332                     extensions::Extension::ScriptingWhitelist)
333
334// Notification that renderer should run some JavaScript code.
335IPC_MESSAGE_ROUTED1(ExtensionMsg_ExecuteCode,
336                    ExtensionMsg_ExecuteCode_Params)
337
338// Notification that the user scripts have been updated. It has one
339// SharedMemoryHandle argument consisting of the pickled script data. This
340// handle is valid in the context of the renderer.
341IPC_MESSAGE_CONTROL1(ExtensionMsg_UpdateUserScripts,
342                     base::SharedMemoryHandle)
343
344// Requests application info for the page. The renderer responds back with
345// ExtensionHostMsg_DidGetApplicationInfo.
346IPC_MESSAGE_ROUTED1(ExtensionMsg_GetApplicationInfo,
347                    int32 /*page_id*/)
348
349// Tell the render view which browser window it's being attached to.
350IPC_MESSAGE_ROUTED1(ExtensionMsg_UpdateBrowserWindowId,
351                    int /* id of browser window */)
352
353// Tell the render view what its tab ID is.
354IPC_MESSAGE_ROUTED1(ExtensionMsg_SetTabId,
355                    int /* id of tab */)
356
357// Tell the renderer to update an extension's permission set.
358IPC_MESSAGE_CONTROL5(ExtensionMsg_UpdatePermissions,
359                     int /* UpdateExtensionPermissionsInfo::REASON */,
360                     std::string /* extension_id */,
361                     extensions::APIPermissionSet /* permissions */,
362                     extensions::URLPatternSet /* explicit_hosts */,
363                     extensions::URLPatternSet /* scriptable_hosts */)
364
365// Tell the renderer about new tab-specific permissions for an extension.
366IPC_MESSAGE_CONTROL4(ExtensionMsg_UpdateTabSpecificPermissions,
367                     int32 /* page_id (only relevant for the target tab) */,
368                     int /* tab_id */,
369                     std::string /* extension_id */,
370                     extensions::URLPatternSet /* hosts */)
371
372// Tell the renderer to clear tab-specific permissions for some extensions.
373IPC_MESSAGE_CONTROL2(ExtensionMsg_ClearTabSpecificPermissions,
374                     int /* tab_id */,
375                     std::vector<std::string> /* extension_ids */)
376
377// Tell the renderer which type this view is.
378IPC_MESSAGE_ROUTED1(ExtensionMsg_NotifyRenderViewType,
379                    extensions::ViewType /* view_type */)
380
381// Deliver a message sent with ExtensionHostMsg_PostMessage.
382IPC_MESSAGE_CONTROL3(ExtensionMsg_UsingWebRequestAPI,
383                     bool /* adblock */,
384                     bool /* adblock_plus */,
385                     bool /* other_webrequest */)
386
387// Ask the lazy background page if it is ready to be suspended. This is sent
388// when the page is considered idle. The renderer will reply with the same
389// sequence_id so that we can tell which message it is responding to.
390IPC_MESSAGE_CONTROL2(ExtensionMsg_ShouldSuspend,
391                     std::string /* extension_id */,
392                     int /* sequence_id */)
393
394// If we complete a round of ShouldSuspend->ShouldSuspendAck messages without
395// the lazy background page becoming active again, we are ready to unload. This
396// message tells the page to dispatch the suspend event.
397IPC_MESSAGE_CONTROL1(ExtensionMsg_Suspend,
398                     std::string /* extension_id */)
399
400// The browser changed its mind about suspending this extension.
401IPC_MESSAGE_CONTROL1(ExtensionMsg_CancelSuspend,
402                     std::string /* extension_id */)
403
404// Send to renderer once the installation mentioned on
405// ExtensionHostMsg_InlineWebstoreInstall is complete.
406IPC_MESSAGE_ROUTED3(ExtensionMsg_InlineWebstoreInstallResponse,
407                    int32 /* install id */,
408                    bool /* whether the install was successful */,
409                    std::string /* error */)
410
411// Response to the renderer for ExtensionHostMsg_GetAppInstallState.
412IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
413                    std::string /* state */,
414                    int32 /* callback_id */)
415
416// Dispatch the Port.onConnect event for message channels.
417IPC_MESSAGE_ROUTED4(ExtensionMsg_DispatchOnConnect,
418                    int /* target_port_id */,
419                    std::string /* channel_name */,
420                    base::DictionaryValue /* source_tab */,
421                    ExtensionMsg_ExternalConnectionInfo)
422
423// Deliver a message sent with ExtensionHostMsg_PostMessage.
424IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
425                    int /* target_port_id */,
426                    std::string /* message */)
427
428// Dispatch the Port.onDisconnect event for message channels.
429IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
430                    int /* port_id */,
431                    std::string /* error_message */)
432
433// Informs the renderer what channel (dev, beta, stable, etc) is running.
434IPC_MESSAGE_CONTROL1(ExtensionMsg_SetChannel,
435                     int /* channel */)
436
437// Adds a logging message to the renderer's root frame DevTools console.
438IPC_MESSAGE_ROUTED2(ExtensionMsg_AddMessageToConsole,
439                    content::ConsoleMessageLevel /* level */,
440                    std::string /* message */)
441
442// Notify the renderer that its window has closed.
443IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
444
445// Notify the renderer that an extension wants notifications when certain
446// searches match the active page.  This message replaces the old set of
447// searches, and triggers ExtensionHostMsg_OnWatchedPageChange messages from
448// each tab to keep the browser updated about changes.
449IPC_MESSAGE_CONTROL1(ExtensionMsg_WatchPages,
450                     std::vector<std::string> /* CSS selectors */)
451
452// Messages sent from the renderer to the browser.
453
454// A renderer sends this message when an extension process starts an API
455// request. The browser will always respond with a ExtensionMsg_Response.
456IPC_MESSAGE_ROUTED1(ExtensionHostMsg_Request,
457                    ExtensionHostMsg_Request_Params)
458
459// A renderer sends this message when an extension process starts an API
460// request. The browser will always respond with a ExtensionMsg_Response.
461IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RequestForIOThread,
462                     int /* routing_id */,
463                     ExtensionHostMsg_Request_Params)
464
465// Notify the browser that the given extension added a listener to an event.
466IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddListener,
467                     std::string /* extension_id */,
468                     std::string /* name */)
469
470// Notify the browser that the given extension removed a listener from an
471// event.
472IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveListener,
473                     std::string /* extension_id */,
474                     std::string /* name */)
475
476// Notify the browser that the given extension added a listener to an event from
477// a lazy background page.
478IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddLazyListener,
479                     std::string /* extension_id */,
480                     std::string /* name */)
481
482// Notify the browser that the given extension is no longer interested in
483// receiving the given event from a lazy background page.
484IPC_MESSAGE_CONTROL2(ExtensionHostMsg_RemoveLazyListener,
485                     std::string /* extension_id */,
486                     std::string /* name */)
487
488// Notify the browser that the given extension added a listener to instances of
489// the named event that satisfy the filter.
490IPC_MESSAGE_CONTROL4(ExtensionHostMsg_AddFilteredListener,
491                     std::string /* extension_id */,
492                     std::string /* name */,
493                     base::DictionaryValue /* filter */,
494                     bool /* lazy */)
495
496// Notify the browser that the given extension is no longer interested in
497// instances of the named event that satisfy the filter.
498IPC_MESSAGE_CONTROL4(ExtensionHostMsg_RemoveFilteredListener,
499                     std::string /* extension_id */,
500                     std::string /* name */,
501                     base::DictionaryValue /* filter */,
502                     bool /* lazy */)
503
504// Notify the browser that an event has finished being dispatched.
505IPC_MESSAGE_ROUTED0(ExtensionHostMsg_EventAck)
506
507// Open a channel to all listening contexts owned by the extension with
508// the given ID.  This always returns a valid port ID which can be used for
509// sending messages.  If an error occurred, the opener will be notified
510// asynchronously.
511IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToExtension,
512                            int /* routing_id */,
513                            ExtensionMsg_ExternalConnectionInfo,
514                            std::string /* channel_name */,
515                            int /* port_id */)
516
517IPC_SYNC_MESSAGE_CONTROL3_1(ExtensionHostMsg_OpenChannelToNativeApp,
518                            int /* routing_id */,
519                            std::string /* source_extension_id */,
520                            std::string /* native_app_name */,
521                            int /* port_id */)
522
523// Get a port handle to the given tab.  The handle can be used for sending
524// messages to the extension.
525IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToTab,
526                            int /* routing_id */,
527                            int /* tab_id */,
528                            std::string /* extension_id */,
529                            std::string /* channel_name */,
530                            int /* port_id */)
531
532// Send a message to an extension process.  The handle is the value returned
533// by ViewHostMsg_OpenChannelTo*.
534IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
535                    int /* port_id */,
536                    std::string /* message */)
537
538// Send a message to an extension process.  The handle is the value returned
539// by ViewHostMsg_OpenChannelTo*.
540IPC_MESSAGE_CONTROL2(ExtensionHostMsg_CloseChannel,
541                     int /* port_id */,
542                     std::string /* error_message */)
543
544// Used to get the extension message bundle.
545IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
546                            std::string /* extension id */,
547                            SubstitutionMap /* message bundle */)
548
549// Sent from the renderer to the browser to return the script running result.
550IPC_MESSAGE_ROUTED5(
551    ExtensionHostMsg_ExecuteCodeFinished,
552    int /* request id */,
553    std::string /* error; empty implies success */,
554    int32 /* page_id the code executed on.  May be -1 if unsuccessful */,
555    GURL /* URL of the code executed on. May be empty if unsuccessful. */,
556    base::ListValue /* result of the script */)
557
558// Sent from the renderer to the browser to notify that content scripts are
559// running in the renderer that the IPC originated from.
560// Note that the page_id is for the parent (or more accurately the topmost)
561// frame (e.g. if executing in an iframe this is the page ID of the parent,
562// unless the parent is an iframe... etc).
563IPC_MESSAGE_ROUTED3(ExtensionHostMsg_ContentScriptsExecuting,
564                    ExecutingScriptsMap,
565                    int32 /* page_id of the _topmost_ frame */,
566                    GURL /* url of the _topmost_ frame */)
567
568IPC_MESSAGE_ROUTED2(ExtensionHostMsg_DidGetApplicationInfo,
569                    int32 /* page_id */,
570                    WebApplicationInfo)
571
572// Sent by the renderer to implement chrome.webstore.install().
573IPC_MESSAGE_ROUTED4(ExtensionHostMsg_InlineWebstoreInstall,
574                    int32 /* install id */,
575                    int32 /* return route id */,
576                    std::string /* Web Store item ID */,
577                    GURL /* requestor URL */)
578
579// Sent by the renderer when a web page is checking if its app is installed.
580IPC_MESSAGE_ROUTED3(ExtensionHostMsg_GetAppInstallState,
581                    GURL /* requestor_url */,
582                    int32 /* return_route_id */,
583                    int32 /* callback_id */)
584
585// Optional Ack message sent to the browser to notify that the response to a
586// function has been processed.
587IPC_MESSAGE_ROUTED1(ExtensionHostMsg_ResponseAck,
588                    int /* request_id */)
589
590// Response to ExtensionMsg_ShouldSuspend.
591IPC_MESSAGE_CONTROL2(ExtensionHostMsg_ShouldSuspendAck,
592                     std::string /* extension_id */,
593                     int /* sequence_id */)
594
595// Response to ExtensionMsg_Suspend, after we dispatch the suspend event.
596IPC_MESSAGE_CONTROL1(ExtensionHostMsg_SuspendAck,
597                     std::string /* extension_id */)
598
599// Informs the browser to increment the keepalive count for the lazy background
600// page, keeping it alive.
601IPC_MESSAGE_ROUTED0(ExtensionHostMsg_IncrementLazyKeepaliveCount)
602
603// Informs the browser there is one less thing keeping the lazy background page
604// alive.
605IPC_MESSAGE_ROUTED0(ExtensionHostMsg_DecrementLazyKeepaliveCount)
606
607// Fetches a globally unique ID (for the lifetime of the browser) from the
608// browser process.
609IPC_SYNC_MESSAGE_CONTROL0_1(ExtensionHostMsg_GenerateUniqueID,
610                            int /* unique_id */)
611
612// Resumes resource requests for a newly created app window.
613IPC_MESSAGE_CONTROL1(ExtensionHostMsg_ResumeRequests, int /* route_id */)
614
615// Sent by the renderer when the draggable regions are updated.
616IPC_MESSAGE_ROUTED1(ExtensionHostMsg_UpdateDraggableRegions,
617                    std::vector<extensions::DraggableRegion> /* regions */)
618
619// Sent by the renderer to log an API action to the extension activity log.
620IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddAPIActionToActivityLog,
621                     std::string /* extension_id */,
622                     ExtensionHostMsg_APIActionOrEvent_Params)
623
624// Sent by the renderer to log a blocked API action to the activity log.
625IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddBlockedCallToActivityLog,
626                    std::string /* extension_id */,
627                    std::string /* api call function name */)
628
629// Sent by the renderer to log an event to the extension activity log.
630IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddEventToActivityLog,
631                    std::string /* extension_id */,
632                    ExtensionHostMsg_APIActionOrEvent_Params)
633
634// Sent by the renderer to log a DOM action to the extension activity log.
635IPC_MESSAGE_CONTROL2(ExtensionHostMsg_AddDOMActionToActivityLog,
636                     std::string /* extension_id */,
637                     ExtensionHostMsg_DOMAction_Params)
638
639// Notifies the browser process that a tab has started or stopped matching
640// certain conditions.  This message is sent in response to several events:
641//
642// * ExtensionMsg_WatchPages was received, updating the set of conditions.
643// * A new page is loaded.  This will be sent after ViewHostMsg_FrameNavigate.
644//   Currently this only fires for the main frame.
645// * Something changed on an existing frame causing the set of matching searches
646//   to change.
647IPC_MESSAGE_ROUTED1(ExtensionHostMsg_OnWatchedPageChange,
648                    std::vector<std::string> /* Matching CSS selectors */)
649