Index: chrome/browser/extensions/api/messaging/message_service.cc |
diff --git a/chrome/browser/extensions/api/messaging/message_service.cc b/chrome/browser/extensions/api/messaging/message_service.cc |
index 5592fad351da08eb25018cf27ed8d1bbc8fd7fa1..74873162e8c1660745020f27d8eade1d0c3c6fe7 100644 |
--- a/chrome/browser/extensions/api/messaging/message_service.cc |
+++ b/chrome/browser/extensions/api/messaging/message_service.cc |
@@ -188,6 +188,7 @@ void MessageService::OpenChannelToNativeApp( |
int receiver_port_id, |
const std::string& source_extension_id, |
const std::string& native_app_name) { |
+#if defined(OS_WIN) || defined(OS_MAXOSX) || defined(OS_LINUX) |
content::RenderProcessHost* source = |
content::RenderProcessHost::FromID(source_process_id); |
if (!source) |
@@ -217,6 +218,9 @@ void MessageService::OpenChannelToNativeApp( |
// Abandon the channel |
if (!native_process.get()) { |
LOG(ERROR) << "Failed to create native process."; |
+ // Treat it as a disconnect. |
+ ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); |
+ port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), true); |
return; |
} |
channel->receiver.reset(new NativeMessagePort(native_process.release())); |
@@ -225,6 +229,10 @@ void MessageService::OpenChannelToNativeApp( |
channel->opener->IncrementLazyKeepaliveCount(); |
AddChannel(channel.release(), receiver_port_id); |
+#else // defined(OS_WIN) || defined(OS_MAXOSX) || defined(OS_LINUX) |
+ ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); |
+ port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(receiver_port_id), true); |
+#endif // !(defined(OS_WIN) || defined(OS_MAXOSX) || defined(OS_LINUX)) |
Matt Perry
2013/02/11 22:44:54
nit: These comments seem backwards to me. The endi
Sergey Ulanov
2013/02/13 01:15:25
Done.
|
} |
void MessageService::OpenChannelToTab( |