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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/api/messaging/native_message_port.h"
8 #include "chrome/browser/extensions/api/messaging/native_message_process_host.h"
9 #include "content/public/browser/browser_thread.h"
11 namespace extensions
{
13 NativeMessagePort::NativeMessagePort(NativeMessageProcessHost
* native_process
)
14 : native_process_(native_process
) {
17 NativeMessagePort::~NativeMessagePort() {
18 content::BrowserThread::DeleteSoon(
19 content::BrowserThread::IO
, FROM_HERE
, native_process_
);
22 void NativeMessagePort::DispatchOnMessage(
23 const Message
& message
,
25 content::BrowserThread::PostTask(
26 content::BrowserThread::IO
, FROM_HERE
,
27 base::Bind(&NativeMessageProcessHost::Send
,
28 base::Unretained(native_process_
), message
.data
));
31 } // namespace extensions