summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authormpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-02 23:56:11 +0000
committermpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-02 23:56:11 +0000
commit75e5a879a500897b2409c49d4ef205e2e954c9fd (patch)
tree166ca53e8cc29520402efd7cc6ee2804edf744eb /chrome/common
parent720ac73783ea732c130ff6d11dffa41919a25809 (diff)
downloadchromium_src-75e5a879a500897b2409c49d4ef205e2e954c9fd.zip
chromium_src-75e5a879a500897b2409c49d4ef205e2e954c9fd.tar.gz
chromium_src-75e5a879a500897b2409c49d4ef205e2e954c9fd.tar.bz2
Add code to support 2-way communication between extensions and renderers. The code is almost fully symmetrical, except that right now a channel can only be opened to an extension (by ID). It should be trivial to open a channel to a tab, once we have a solid tab API.
Review URL: http://codereview.chromium.org/56037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/ipc_message_utils.h5
-rw-r--r--chrome/common/render_messages_internal.h25
2 files changed, 19 insertions, 11 deletions
diff --git a/chrome/common/ipc_message_utils.h b/chrome/common/ipc_message_utils.h
index ac3cbef..6e82d40 100644
--- a/chrome/common/ipc_message_utils.h
+++ b/chrome/common/ipc_message_utils.h
@@ -1247,9 +1247,12 @@ void GenerateLogData(const std::wstring& channel, const Message& message,
LogData* data);
// Used for synchronous messages.
-template <class SendParam, class ReplyParam>
+template <class SendParamType, class ReplyParamType>
class MessageWithReply : public SyncMessage {
public:
+ typedef SendParamType SendParam;
+ typedef ReplyParamType ReplyParam;
+
MessageWithReply(int32 routing_id, uint16 type,
const SendParam& send, const ReplyParam& reply)
: SyncMessage(routing_id, type, PRIORITY_NORMAL,
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index cc296a6..ece0cd1 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -528,11 +528,16 @@ IPC_BEGIN_MESSAGES(View)
int /* callback id */,
std::string /* response */)
- // Relay a message sent from a renderer to an extension process. channel_id
- // is a handle that can be used for sending a response.
- IPC_MESSAGE_ROUTED2(ViewMsg_HandleExtensionMessage,
- std::string /* message */,
- int /* channel_id */)
+ // Tell the extension process about a new channel that has been opened from a
+ // renderer. source_port_id identifies the port that the extension can
+ // respond to.
+ IPC_MESSAGE_CONTROL1(ViewMsg_ExtensionHandleConnect,
+ int /* source_port_id */)
+
+ // Send a javascript message to a renderer from the given port.
+ IPC_MESSAGE_CONTROL2(ViewMsg_ExtensionHandleMessage,
+ std::string /* message */,
+ int /* source_port_id */)
// Tell the renderer process all known extension function names.
IPC_MESSAGE_CONTROL1(ViewMsg_Extension_SetFunctionNames,
@@ -1280,16 +1285,16 @@ IPC_BEGIN_MESSAGES(ViewHost)
IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateFeedList,
ViewHostMsg_UpdateFeedList_Params)
- // Get a handle to a currently-running extension process for the extension
- // with the given ID. If no such extension is found, -1 is returned. The
- // handle can be used for sending messages to the extension.
+ // Get a port handle to a currently-running extension process for the
+ // extension with the given ID. If no such extension is found, -1 is
+ // returned. The handle can be used for sending messages to the extension.
IPC_SYNC_MESSAGE_CONTROL1_1(ViewHostMsg_OpenChannelToExtension,
std::string /* extension_id */,
- int /* channel_id */)
+ int /* port_id */)
// Send a message to an extension process. The handle is the value returned
// by ViewHostMsg_OpenChannelToExtension.
IPC_MESSAGE_CONTROL2(ViewHostMsg_ExtensionPostMessage,
- int /* channel_id */,
+ int /* port_id */,
std::string /* message */)
IPC_END_MESSAGES(ViewHost)