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/native_message_port.h" | 5 #include "chrome/browser/extensions/api/messaging/native_message_port.h" |
6 | 6 |
7 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" | 7 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h" |
8 #include "content/public/browser/browser_thread.h" | 8 #include "content/public/browser/browser_thread.h" |
9 | 9 |
10 namespace extensions { | 10 namespace extensions { |
11 | 11 |
12 NativeMessagePort::NativeMessagePort(NativeMessageProcessHost* native_process) | 12 NativeMessagePort::NativeMessagePort(NativeMessageProcessHost* native_process) |
13 : native_process_(native_process) { | 13 : native_process_(native_process) { |
14 } | 14 } |
15 | 15 |
16 NativeMessagePort::~NativeMessagePort() { | 16 NativeMessagePort::~NativeMessagePort() { |
17 content::BrowserThread::DeleteSoon(content::BrowserThread::FILE, | 17 content::BrowserThread::DeleteSoon(content::BrowserThread::IO, |
18 FROM_HERE, | 18 FROM_HERE, |
19 native_process_); | 19 native_process_); |
20 } | 20 } |
21 | 21 |
22 void NativeMessagePort::DispatchOnMessage(const std::string& message, | 22 void NativeMessagePort::DispatchOnMessage(const std::string& message, |
23 int target_port_id) { | 23 int target_port_id) { |
24 content::BrowserThread::PostTask( | 24 content::BrowserThread::PostTask( |
25 content::BrowserThread::FILE, | 25 content::BrowserThread::IO, |
26 FROM_HERE, | 26 FROM_HERE, |
27 base::Bind(&NativeMessageProcessHost::Send, | 27 base::Bind(&NativeMessageProcessHost::Send, |
28 base::Unretained(native_process_), | 28 base::Unretained(native_process_), |
29 message)); | 29 message)); |
30 } | 30 } |
31 | 31 |
32 } // namespace extensions | 32 } // namespace extensions |
OLD | NEW |