Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: extensions/common/extension_messages.h

Issue 2547753002: [Extensions] Extension Port Ids and Initialization 2.0 (Closed)
Patch Set: rkaplow Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/common/api/messaging/port_id.cc ('k') | extensions/renderer/dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // IPC messages for extensions. 5 // IPC messages for extensions.
6 // Multiply-included message file, hence no include guard. 6 // Multiply-included message file, hence no include guard.
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/memory/shared_memory.h" 13 #include "base/memory/shared_memory.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "components/version_info/version_info.h" 15 #include "components/version_info/version_info.h"
16 #include "content/public/common/common_param_traits.h" 16 #include "content/public/common/common_param_traits.h"
17 #include "content/public/common/socket_permission_request.h" 17 #include "content/public/common/socket_permission_request.h"
18 #include "extensions/common/api/messaging/message.h" 18 #include "extensions/common/api/messaging/message.h"
19 #include "extensions/common/api/messaging/port_id.h"
19 #include "extensions/common/draggable_region.h" 20 #include "extensions/common/draggable_region.h"
20 #include "extensions/common/extension.h" 21 #include "extensions/common/extension.h"
21 #include "extensions/common/extensions_client.h" 22 #include "extensions/common/extensions_client.h"
22 #include "extensions/common/features/feature_session_type.h" 23 #include "extensions/common/features/feature_session_type.h"
23 #include "extensions/common/host_id.h" 24 #include "extensions/common/host_id.h"
24 #include "extensions/common/permissions/media_galleries_permission_data.h" 25 #include "extensions/common/permissions/media_galleries_permission_data.h"
25 #include "extensions/common/permissions/permission_set.h" 26 #include "extensions/common/permissions/permission_set.h"
26 #include "extensions/common/permissions/socket_permission_data.h" 27 #include "extensions/common/permissions/socket_permission_data.h"
27 #include "extensions/common/permissions/usb_device_permission_data.h" 28 #include "extensions/common/permissions/usb_device_permission_data.h"
28 #include "extensions/common/stack_frame.h" 29 #include "extensions/common/stack_frame.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 254
254 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData) 255 IPC_STRUCT_TRAITS_BEGIN(extensions::MediaGalleriesPermissionData)
255 IPC_STRUCT_TRAITS_MEMBER(permission()) 256 IPC_STRUCT_TRAITS_MEMBER(permission())
256 IPC_STRUCT_TRAITS_END() 257 IPC_STRUCT_TRAITS_END()
257 258
258 IPC_STRUCT_TRAITS_BEGIN(extensions::Message) 259 IPC_STRUCT_TRAITS_BEGIN(extensions::Message)
259 IPC_STRUCT_TRAITS_MEMBER(data) 260 IPC_STRUCT_TRAITS_MEMBER(data)
260 IPC_STRUCT_TRAITS_MEMBER(user_gesture) 261 IPC_STRUCT_TRAITS_MEMBER(user_gesture)
261 IPC_STRUCT_TRAITS_END() 262 IPC_STRUCT_TRAITS_END()
262 263
264 IPC_STRUCT_TRAITS_BEGIN(extensions::PortId)
265 IPC_STRUCT_TRAITS_MEMBER(context_id)
266 IPC_STRUCT_TRAITS_MEMBER(port_number)
267 IPC_STRUCT_TRAITS_MEMBER(is_opener)
268 IPC_STRUCT_TRAITS_END()
269
263 // Singly-included section for custom IPC traits. 270 // Singly-included section for custom IPC traits.
264 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ 271 #ifndef EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
265 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_ 272 #define EXTENSIONS_COMMON_EXTENSION_MESSAGES_H_
266 273
267 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need 274 // IPC_MESSAGE macros choke on extra , in the std::map, when expanding. We need
268 // to typedef it to avoid that. 275 // to typedef it to avoid that.
269 // Substitution map for l10n messages. 276 // Substitution map for l10n messages.
270 typedef std::map<std::string, std::string> SubstitutionMap; 277 typedef std::map<std::string, std::string> SubstitutionMap;
271 278
272 // Map of extensions IDs to the executing script paths. 279 // Map of extensions IDs to the executing script paths.
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 std::string /* extension_id */) 589 std::string /* extension_id */)
583 590
584 // Response to the renderer for ExtensionHostMsg_GetAppInstallState. 591 // Response to the renderer for ExtensionHostMsg_GetAppInstallState.
585 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse, 592 IPC_MESSAGE_ROUTED2(ExtensionMsg_GetAppInstallStateResponse,
586 std::string /* state */, 593 std::string /* state */,
587 int32_t /* callback_id */) 594 int32_t /* callback_id */)
588 595
589 // Check whether the Port for extension messaging exists in the frame. If the 596 // Check whether the Port for extension messaging exists in the frame. If the
590 // port ID is unknown, the frame replies with ExtensionHostMsg_CloseMessagePort. 597 // port ID is unknown, the frame replies with ExtensionHostMsg_CloseMessagePort.
591 IPC_MESSAGE_ROUTED1(ExtensionMsg_ValidateMessagePort, 598 IPC_MESSAGE_ROUTED1(ExtensionMsg_ValidateMessagePort,
592 int /* port_id */) 599 extensions::PortId /* port_id */)
593 600
594 // Dispatch the Port.onConnect event for message channels. 601 // Dispatch the Port.onConnect event for message channels.
595 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect, 602 IPC_MESSAGE_ROUTED5(ExtensionMsg_DispatchOnConnect,
596 int /* target_port_id */, 603 extensions::PortId /* target_port_id */,
597 std::string /* channel_name */, 604 std::string /* channel_name */,
598 ExtensionMsg_TabConnectionInfo /* source */, 605 ExtensionMsg_TabConnectionInfo /* source */,
599 ExtensionMsg_ExternalConnectionInfo, 606 ExtensionMsg_ExternalConnectionInfo,
600 std::string /* tls_channel_id */) 607 std::string /* tls_channel_id */)
601 608
602 // Deliver a message sent with ExtensionHostMsg_PostMessage. 609 // Deliver a message sent with ExtensionHostMsg_PostMessage.
603 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage, 610 IPC_MESSAGE_ROUTED2(ExtensionMsg_DeliverMessage,
604 int /* target_port_id */, 611 extensions::PortId /* target_port_id */,
605 extensions::Message) 612 extensions::Message)
606 613
607 // Dispatch the Port.onDisconnect event for message channels. 614 // Dispatch the Port.onDisconnect event for message channels.
608 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect, 615 IPC_MESSAGE_ROUTED2(ExtensionMsg_DispatchOnDisconnect,
609 int /* port_id */, 616 extensions::PortId /* port_id */,
610 std::string /* error_message */) 617 std::string /* error_message */)
611 618
612 // Informs the renderer what channel (dev, beta, stable, etc) and user session 619 // Informs the renderer what channel (dev, beta, stable, etc) and user session
613 // type is running. 620 // type is running.
614 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSessionInfo, 621 IPC_MESSAGE_CONTROL2(ExtensionMsg_SetSessionInfo,
615 version_info::Channel /* channel */, 622 version_info::Channel /* channel */,
616 extensions::FeatureSessionType /* session_type */) 623 extensions::FeatureSessionType /* session_type */)
617 624
618 // Notify the renderer that its window has closed. 625 // Notify the renderer that its window has closed.
619 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed) 626 IPC_MESSAGE_ROUTED0(ExtensionMsg_AppWindowClosed)
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */) 702 IPC_MESSAGE_ROUTED1(ExtensionHostMsg_EventAck, int /* message_id */)
696 703
697 // Open a channel to all listening contexts owned by the extension with 704 // Open a channel to all listening contexts owned by the extension with
698 // the given ID. This responds asynchronously with ExtensionMsg_AssignPortId. 705 // the given ID. This responds asynchronously with ExtensionMsg_AssignPortId.
699 // If an error occurred, the opener will be notified asynchronously. 706 // If an error occurred, the opener will be notified asynchronously.
700 IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToExtension, 707 IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToExtension,
701 int /* frame_routing_id */, 708 int /* frame_routing_id */,
702 ExtensionMsg_ExternalConnectionInfo, 709 ExtensionMsg_ExternalConnectionInfo,
703 std::string /* channel_name */, 710 std::string /* channel_name */,
704 bool /* include_tls_channel_id */, 711 bool /* include_tls_channel_id */,
705 int /* request_id */) 712 extensions::PortId /* port_id */)
706
707 // Same as ExtensionHostMsg_OpenChannelToExtension, but assigns the port id
708 // synchronously.
709 IPC_SYNC_MESSAGE_CONTROL4_1(ExtensionHostMsg_OpenChannelToExtensionSync,
710 int /* frame_routing_id */,
711 ExtensionMsg_ExternalConnectionInfo,
712 std::string /* channel_name */,
713 bool /* include_tls_channel_id */,
714 int /* port_id */)
715
716 // The response to a request to open an extension message port, including the
717 // global port id and the request id.
718 IPC_MESSAGE_ROUTED2(ExtensionMsg_AssignPortId,
719 int /*port_id */,
720 int /* request_id */)
721 713
722 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_OpenChannelToNativeApp, 714 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_OpenChannelToNativeApp,
723 int /* frame_routing_id */, 715 int /* frame_routing_id */,
724 std::string /* native_app_name */, 716 std::string /* native_app_name */,
725 int /* request_id */) 717 extensions::PortId /* port_id */)
726 718
727 // Get a port handle to the given tab. The handle can be used for sending 719 // Get a port handle to the given tab. The handle can be used for sending
728 // messages to the extension. 720 // messages to the extension.
729 IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToTab, 721 IPC_MESSAGE_CONTROL5(ExtensionHostMsg_OpenChannelToTab,
730 int /* frame_routing_id */, 722 int /* frame_routing_id */,
731 ExtensionMsg_TabTargetConnectionInfo, 723 ExtensionMsg_TabTargetConnectionInfo,
732 std::string /* extension_id */, 724 std::string /* extension_id */,
733 std::string /* channel_name */, 725 std::string /* channel_name */,
734 int /* request_id */) 726 extensions::PortId /* port_id */)
735 727
736 // Sent in response to ExtensionMsg_DispatchOnConnect when the port is accepted. 728 // Sent in response to ExtensionMsg_DispatchOnConnect when the port is accepted.
737 // The handle is the value returned by ExtensionHostMsg_OpenChannelTo*. 729 // The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
738 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_OpenMessagePort, 730 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_OpenMessagePort,
739 int /* frame_routing_id */, 731 int /* frame_routing_id */,
740 int /* port_id */) 732 extensions::PortId /* port_id */)
741 733
742 // Sent in response to ExtensionMsg_DispatchOnConnect and whenever the port is 734 // Sent in response to ExtensionMsg_DispatchOnConnect and whenever the port is
743 // closed. The handle is the value returned by ExtensionHostMsg_OpenChannelTo*. 735 // closed. The handle is the value returned by ExtensionHostMsg_OpenChannelTo*.
744 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_CloseMessagePort, 736 IPC_MESSAGE_CONTROL3(ExtensionHostMsg_CloseMessagePort,
745 int /* frame_routing_id */, 737 int /* frame_routing_id */,
746 int /* port_id */, 738 extensions::PortId /* port_id */,
747 bool /* force_close */) 739 bool /* force_close */)
748 740
749 // Send a message to an extension process. The handle is the value returned 741 // Send a message to an extension process. The handle is the value returned
750 // by ExtensionHostMsg_OpenChannelTo*. 742 // by ExtensionHostMsg_OpenChannelTo*.
751 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage, 743 IPC_MESSAGE_ROUTED2(ExtensionHostMsg_PostMessage,
752 int /* port_id */, 744 extensions::PortId /* port_id */,
753 extensions::Message) 745 extensions::Message)
754 746
755 // Used to get the extension message bundle. 747 // Used to get the extension message bundle.
756 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle, 748 IPC_SYNC_MESSAGE_CONTROL1_1(ExtensionHostMsg_GetMessageBundle,
757 std::string /* extension id */, 749 std::string /* extension id */,
758 SubstitutionMap /* message bundle */) 750 SubstitutionMap /* message bundle */)
759 751
760 // Sent from the renderer to the browser to return the script running result. 752 // Sent from the renderer to the browser to return the script running result.
761 IPC_MESSAGE_ROUTED4( 753 IPC_MESSAGE_ROUTED4(
762 ExtensionHostMsg_ExecuteCodeFinished, 754 ExtensionHostMsg_ExecuteCodeFinished,
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 int64_t /* service_worker_version_id */, 914 int64_t /* service_worker_version_id */,
923 std::string /* request_uuid */) 915 std::string /* request_uuid */)
924 916
925 // Asks the browser to decrement the pending activity count for 917 // Asks the browser to decrement the pending activity count for
926 // the worker with version id |service_worker_version_id|. 918 // the worker with version id |service_worker_version_id|.
927 // |request_uuid| must match the GUID of a previous request, otherwise the 919 // |request_uuid| must match the GUID of a previous request, otherwise the
928 // browser process ignores the IPC. 920 // browser process ignores the IPC.
929 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_DecrementServiceWorkerActivity, 921 IPC_MESSAGE_CONTROL2(ExtensionHostMsg_DecrementServiceWorkerActivity,
930 int64_t /* service_worker_version_id */, 922 int64_t /* service_worker_version_id */,
931 std::string /* request_uuid */) 923 std::string /* request_uuid */)
OLDNEW
« no previous file with comments | « extensions/common/api/messaging/port_id.cc ('k') | extensions/renderer/dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698