OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #include "chrome/browser/extensions/extension_message_service.h" | 5 #include "chrome/browser/extensions/extension_message_service.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/singleton.h" | 8 #include "base/singleton.h" |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 bool ExtensionMessageService::OpenChannelOnUIThreadImpl( | 322 bool ExtensionMessageService::OpenChannelOnUIThreadImpl( |
323 IPC::Message::Sender* source, | 323 IPC::Message::Sender* source, |
324 const std::string& tab_json, | 324 const std::string& tab_json, |
325 const MessagePort& receiver, int receiver_port_id, | 325 const MessagePort& receiver, int receiver_port_id, |
326 const std::string& source_extension_id, | 326 const std::string& source_extension_id, |
327 const std::string& target_extension_id, | 327 const std::string& target_extension_id, |
328 const std::string& channel_name) { | 328 const std::string& channel_name) { |
329 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); | 329 DCHECK_EQ(MessageLoop::current()->type(), MessageLoop::TYPE_UI); |
330 | 330 |
331 // TODO(mpcomplete): notify source if reciever doesn't exist | 331 // TODO(mpcomplete): notify source if receiver doesn't exist |
332 if (!source) | 332 if (!source) |
333 return false; // Closed while in flight. | 333 return false; // Closed while in flight. |
334 | 334 |
335 if (!receiver.sender) { | 335 if (!receiver.sender) { |
336 // Treat it as a disconnect. | 336 // Treat it as a disconnect. |
337 DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL), | 337 DispatchOnDisconnect(MessagePort(source, MSG_ROUTING_CONTROL), |
338 GET_OPPOSITE_PORT_ID(receiver_port_id)); | 338 GET_OPPOSITE_PORT_ID(receiver_port_id)); |
339 return false; | 339 return false; |
340 } | 340 } |
341 | 341 |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 | 542 |
543 if (current->second->opener.sender == sender) { | 543 if (current->second->opener.sender == sender) { |
544 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), | 544 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), |
545 notify_other_port); | 545 notify_other_port); |
546 } else if (current->second->receiver.sender == sender) { | 546 } else if (current->second->receiver.sender == sender) { |
547 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), | 547 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), |
548 notify_other_port); | 548 notify_other_port); |
549 } | 549 } |
550 } | 550 } |
551 } | 551 } |
OLD | NEW |