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