#ifndef COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_
#define COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_
#include "base/memory/scoped_ptr.h"
#include "base/process/process.h"
#include "components/nacl/common/nacl_types.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
#include "ipc/ipc_listener.h"
namespace IPC {
class Channel;
}
class NaClBrokerListener : public content::SandboxedProcessLauncherDelegate,
public IPC::Listener {
public:
NaClBrokerListener();
~NaClBrokerListener();
void Listen();
virtual void PreSpawnTarget(sandbox::TargetPolicy* policy,
bool* success) OVERRIDE;
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
virtual void OnChannelError() OVERRIDE;
private:
void OnLaunchLoaderThroughBroker(const std::string& loader_channel_id);
void OnLaunchDebugExceptionHandler(int32 pid,
base::ProcessHandle process_handle,
const std::string& startup_info);
void OnStopBroker();
base::ProcessHandle browser_handle_;
scoped_ptr<IPC::Channel> channel_;
DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener);
};
#endif