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/api/messaging/message_service.h" | 5 #include "chrome/browser/extensions/api/messaging/message_service.h" |
6 | 6 |
7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 scoped_ptr<DictionaryValue> tab_value(ExtensionTabUtil::CreateTabValue( | 204 scoped_ptr<DictionaryValue> tab_value(ExtensionTabUtil::CreateTabValue( |
205 source_contents, ExtensionTabUtil::INCLUDE_PRIVACY_SENSITIVE_FIELDS)); | 205 source_contents, ExtensionTabUtil::INCLUDE_PRIVACY_SENSITIVE_FIELDS)); |
206 base::JSONWriter::Write(tab_value.get(), &tab_json); | 206 base::JSONWriter::Write(tab_value.get(), &tab_json); |
207 } | 207 } |
208 | 208 |
209 scoped_ptr<MessageChannel> channel(new MessageChannel()); | 209 scoped_ptr<MessageChannel> channel(new MessageChannel()); |
210 channel->opener.reset(new ExtensionMessagePort(source, MSG_ROUTING_CONTROL, | 210 channel->opener.reset(new ExtensionMessagePort(source, MSG_ROUTING_CONTROL, |
211 source_extension_id)); | 211 source_extension_id)); |
212 | 212 |
213 NativeMessageProcessHost::MessageType type = | 213 NativeMessageProcessHost::MessageType type = |
214 channel_name == "chrome.extension.sendNativeMessage" ? | 214 channel_name == "chrome.runtime.sendNativeMessage" ? |
215 NativeMessageProcessHost::TYPE_SEND_MESSAGE_REQUEST : | 215 NativeMessageProcessHost::TYPE_SEND_MESSAGE_REQUEST : |
216 NativeMessageProcessHost::TYPE_CONNECT; | 216 NativeMessageProcessHost::TYPE_CONNECT; |
217 | 217 |
218 content::BrowserThread::PostTask( | 218 content::BrowserThread::PostTask( |
219 content::BrowserThread::FILE, | 219 content::BrowserThread::FILE, |
220 FROM_HERE, | 220 FROM_HERE, |
221 base::Bind(&NativeMessageProcessHost::Create, | 221 base::Bind(&NativeMessageProcessHost::Create, |
222 base::WeakPtr<NativeMessageProcessHost::Client>( | 222 base::WeakPtr<NativeMessageProcessHost::Client>( |
223 weak_factory_.GetWeakPtr()), | 223 weak_factory_.GetWeakPtr()), |
224 native_app_name, connect_message, receiver_port_id, | 224 native_app_name, connect_message, receiver_port_id, |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 return; | 500 return; |
501 | 501 |
502 params->source = source; | 502 params->source = source; |
503 params->receiver.reset(new ExtensionMessagePort(host->render_process_host(), | 503 params->receiver.reset(new ExtensionMessagePort(host->render_process_host(), |
504 MSG_ROUTING_CONTROL, | 504 MSG_ROUTING_CONTROL, |
505 params->target_extension_id)); | 505 params->target_extension_id)); |
506 OpenChannelImpl(params.Pass()); | 506 OpenChannelImpl(params.Pass()); |
507 } | 507 } |
508 | 508 |
509 } // namespace extensions | 509 } // namespace extensions |
OLD | NEW |