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