| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 ExtensionMessageService::MessagePort receiver; | 51 ExtensionMessageService::MessagePort receiver; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 const char ExtensionMessageService::kDispatchOnConnect[] = | 54 const char ExtensionMessageService::kDispatchOnConnect[] = |
| 55 "Port.dispatchOnConnect"; | 55 "Port.dispatchOnConnect"; |
| 56 const char ExtensionMessageService::kDispatchOnDisconnect[] = | 56 const char ExtensionMessageService::kDispatchOnDisconnect[] = |
| 57 "Port.dispatchOnDisconnect"; | 57 "Port.dispatchOnDisconnect"; |
| 58 | 58 |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 static base::AtomicSequenceNumber g_next_channel_id(base::LINKER_INITIALIZED); | 61 static base::StaticAtomicSequenceNumber g_next_channel_id; |
| 62 | 62 |
| 63 static void DispatchOnConnect(const ExtensionMessageService::MessagePort& port, | 63 static void DispatchOnConnect(const ExtensionMessageService::MessagePort& port, |
| 64 int dest_port_id, | 64 int dest_port_id, |
| 65 const std::string& channel_name, | 65 const std::string& channel_name, |
| 66 const std::string& tab_json, | 66 const std::string& tab_json, |
| 67 const std::string& source_extension_id, | 67 const std::string& source_extension_id, |
| 68 const std::string& target_extension_id) { | 68 const std::string& target_extension_id) { |
| 69 ListValue args; | 69 ListValue args; |
| 70 args.Set(0, Value::CreateIntegerValue(dest_port_id)); | 70 args.Set(0, Value::CreateIntegerValue(dest_port_id)); |
| 71 args.Set(1, Value::CreateStringValue(channel_name)); | 71 args.Set(1, Value::CreateStringValue(channel_name)); |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 | 380 |
| 381 if (current->second->opener.sender == sender) { | 381 if (current->second->opener.sender == sender) { |
| 382 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), | 382 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), |
| 383 notify_other_port); | 383 notify_other_port); |
| 384 } else if (current->second->receiver.sender == sender) { | 384 } else if (current->second->receiver.sender == sender) { |
| 385 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), | 385 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), |
| 386 notify_other_port); | 386 notify_other_port); |
| 387 } | 387 } |
| 388 } | 388 } |
| 389 } | 389 } |
| OLD | NEW |