1 // Copyright 2014 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 "components/nacl/loader/nacl_trusted_listener.h"
7 #include "base/single_thread_task_runner.h"
9 NaClTrustedListener::NaClTrustedListener(
10 const IPC::ChannelHandle& handle,
11 base::SingleThreadTaskRunner* ipc_task_runner)
12 : channel_handle_(handle),
13 channel_proxy_(IPC::ChannelProxy::Create(
14 handle, IPC::Channel::MODE_SERVER, this, ipc_task_runner)) {
17 NaClTrustedListener::~NaClTrustedListener() {
20 IPC::ChannelHandle NaClTrustedListener::TakeClientChannelHandle() {
21 IPC::ChannelHandle handle = channel_handle_;
24 base::FileDescriptor(channel_proxy_->TakeClientFileDescriptor(), true);
29 bool NaClTrustedListener::OnMessageReceived(const IPC::Message& msg) {
33 void NaClTrustedListener::OnChannelError() {
34 channel_proxy_->Close();
37 bool NaClTrustedListener::Send(IPC::Message* msg) {
38 return channel_proxy_->Send(msg);