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