nacl_broker_host_win.h revision ddb351dbec246cf1fab5ec20d2d5520909041de1
1// Copyright (c) 2011 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#pragma once
8
9#include "base/basictypes.h"
10#include "content/browser/browser_child_process_host.h"
11
12class NaClBrokerHost : public BrowserChildProcessHost {
13 public:
14  NaClBrokerHost();
15  ~NaClBrokerHost();
16
17  // This function starts the broker process. It needs to be called
18  // before loaders can be launched.
19  bool Init();
20
21  // Send a message to the broker process, causing it to launch
22  // a Native Client loader process.
23  bool LaunchLoader(const std::wstring& loader_channel_id);
24
25  // Stop the broker process.
26  void StopBroker();
27
28 private:
29  virtual bool CanShutdown() { return true; }
30
31  // Handler for NaClProcessMsg_LoaderLaunched message
32  void OnLoaderLaunched(const std::wstring& loader_channel_id,
33                        base::ProcessHandle handle);
34
35  // IPC::Channel::Listener
36  virtual bool OnMessageReceived(const IPC::Message& msg);
37
38  bool stopping_;
39
40  DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost);
41};
42
43#endif  // CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_
44