nacl_broker_host_win.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1// Copyright (c) 2010 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. 4 5#ifndef CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ 6#define CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ 7 8#include "base/basictypes.h" 9#include "base/process.h" 10#include "chrome/browser/browser_child_process_host.h" 11#include "ipc/ipc_message.h" 12 13class NaClBrokerHost : public BrowserChildProcessHost { 14 public: 15 explicit NaClBrokerHost(ResourceDispatcherHost* resource_dispatcher_host); 16 ~NaClBrokerHost(); 17 18 // This function starts the broker process. It needs to be called 19 // before loaders can be launched. 20 bool Init(); 21 22 // Send a message to the broker process, causing it to launch 23 // a Native Client loader process. 24 bool LaunchLoader(const std::wstring& loader_channel_id); 25 26 // Stop the broker process. 27 void StopBroker(); 28 29 private: 30 // ResourceDispatcherHost::Receiver implementation: 31 virtual URLRequestContext* GetRequestContext( 32 uint32 request_id, 33 const ViewHostMsg_Resource_Request& request_data); 34 35 virtual bool CanShutdown() { return true; } 36 37 // Handler for NaClProcessMsg_LoaderLaunched message 38 void OnLoaderLaunched(const std::wstring& loader_channel_id, 39 base::ProcessHandle handle); 40 41 // IPC::Channel::Listener 42 virtual void OnMessageReceived(const IPC::Message& msg); 43 44 bool stopping_; 45 46 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); 47}; 48 49#endif // CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ 50