summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/extension_message_service.cc
diff options
context:
space:
mode:
authormad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 02:33:26 +0000
committermad@google.com <mad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-08 02:33:26 +0000
commitd181233239400698741f9765bc2b9769f9e1f2ef (patch)
tree939d0358920a87ac9eadbe14ee3398546b00a872 /chrome/browser/extensions/extension_message_service.cc
parente8637201ee40d8a09066ff2204a1b05594eefdf1 (diff)
downloadchromium_src-d181233239400698741f9765bc2b9769f9e1f2ef.zip
chromium_src-d181233239400698741f9765bc2b9769f9e1f2ef.tar.gz
chromium_src-d181233239400698741f9765bc2b9769f9e1f2ef.tar.bz2
Committing for Siggi based on review:
http://codereview.chromium.org/165134 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22858 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_message_service.cc')
-rw-r--r--chrome/browser/extensions/extension_message_service.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/chrome/browser/extensions/extension_message_service.cc b/chrome/browser/extensions/extension_message_service.cc
index 38e202b..d0717c1 100644
--- a/chrome/browser/extensions/extension_message_service.cc
+++ b/chrome/browser/extensions/extension_message_service.cc
@@ -246,7 +246,7 @@ void ExtensionMessageService::OpenChannelToTabOnUIThread(
channel_name);
}
-void ExtensionMessageService::OpenChannelOnUIThreadImpl(
+bool ExtensionMessageService::OpenChannelOnUIThreadImpl(
IPC::Message::Sender* source, int source_process_id, int source_routing_id,
const MessagePort& receiver, int receiver_port_id,
const std::string& extension_id, const std::string& channel_name) {
@@ -254,12 +254,13 @@ void ExtensionMessageService::OpenChannelOnUIThreadImpl(
// TODO(mpcomplete): notify source if reciever doesn't exist
if (!source)
- return; // Closed while in flight.
+ return false; // Closed while in flight.
if (!receiver.sender) {
// Treat it as a disconnect.
DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL),
GET_OPPOSITE_PORT_ID(receiver_port_id));
+ return false;
}
linked_ptr<MessageChannel> channel(new MessageChannel);
@@ -281,11 +282,13 @@ void ExtensionMessageService::OpenChannelOnUIThreadImpl(
// opener has the opposite port ID).
DispatchOnConnect(receiver, receiver_port_id, channel_name, tab_json,
extension_id);
+
+ return true;
}
int ExtensionMessageService::OpenAutomationChannelToExtension(
int source_process_id, int routing_id, const std::string& extension_id,
- IPC::Message::Sender* source) {
+ const std::string& channel_name, IPC::Message::Sender* source) {
DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI);
DCHECK(profile_);
@@ -302,8 +305,10 @@ int ExtensionMessageService::OpenAutomationChannelToExtension(
MessagePort receiver(
profile_->GetExtensionProcessManager()->GetExtensionProcess(extension_id),
MSG_ROUTING_CONTROL);
- OpenChannelOnUIThreadImpl(source, source_process_id, routing_id, receiver,
- port2_id, extension_id, "");
+ if (!OpenChannelOnUIThreadImpl(source, source_process_id, routing_id,
+ receiver, port2_id, extension_id,
+ channel_name))
+ return -1;
return port1_id;
}