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_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" |
11 #include "chrome/browser/child_process_security_policy.h" | 11 #include "chrome/browser/child_process_security_policy.h" |
12 #include "chrome/browser/chrome_thread.h" | 12 #include "chrome/browser/chrome_thread.h" |
13 #include "chrome/browser/extensions/extension_process_manager.h" | 13 #include "chrome/browser/extensions/extension_process_manager.h" |
14 #include "chrome/browser/extensions/extension_tabs_module.h" | 14 #include "chrome/browser/extensions/extension_tabs_module.h" |
15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
16 #include "chrome/browser/renderer_host/render_process_host.h" | 16 #include "chrome/browser/renderer_host/render_process_host.h" |
17 #include "chrome/browser/renderer_host/render_view_host.h" | 17 #include "chrome/browser/renderer_host/render_view_host.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 channels_[GET_CHANNEL_ID(receiver_port_id)] = channel; | 316 channels_[GET_CHANNEL_ID(receiver_port_id)] = channel; |
317 | 317 |
318 CHECK(receiver.sender); | 318 CHECK(receiver.sender); |
319 | 319 |
320 // Include info about the opener's tab (if it was a tab). | 320 // Include info about the opener's tab (if it was a tab). |
321 std::string tab_json = "null"; | 321 std::string tab_json = "null"; |
322 if (source_contents) { | 322 if (source_contents) { |
323 DictionaryValue* tab_value = | 323 DictionaryValue* tab_value = |
324 ExtensionTabUtil::CreateTabValue(source_contents); | 324 ExtensionTabUtil::CreateTabValue(source_contents); |
325 JSONWriter::Write(tab_value, false, &tab_json); | 325 base::JSONWriter::Write(tab_value, false, &tab_json); |
326 } | 326 } |
327 | 327 |
328 CHECK(receiver.sender); | 328 CHECK(receiver.sender); |
329 | 329 |
330 // Send the connect event to the receiver. Give it the opener's port ID (the | 330 // Send the connect event to the receiver. Give it the opener's port ID (the |
331 // opener has the opposite port ID). | 331 // opener has the opposite port ID). |
332 DispatchOnConnect(receiver, receiver_port_id, channel_name, tab_json, | 332 DispatchOnConnect(receiver, receiver_port_id, channel_name, tab_json, |
333 source_extension_id, target_extension_id); | 333 source_extension_id, target_extension_id); |
334 | 334 |
335 return true; | 335 return true; |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 | 508 |
509 if (current->second->opener.sender == sender) { | 509 if (current->second->opener.sender == sender) { |
510 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), | 510 CloseChannelImpl(current, GET_CHANNEL_OPENER_ID(current->first), |
511 notify_other_port); | 511 notify_other_port); |
512 } else if (current->second->receiver.sender == sender) { | 512 } else if (current->second->receiver.sender == sender) { |
513 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), | 513 CloseChannelImpl(current, GET_CHANNEL_RECEIVERS_ID(current->first), |
514 notify_other_port); | 514 notify_other_port); |
515 } | 515 } |
516 } | 516 } |
517 } | 517 } |
OLD | NEW |