OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | 5 #ifndef CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ |
6 #define CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | 6 #define CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "content/browser/browser_child_process_host.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/process.h" |
| 12 #include "content/public/browser/browser_child_process_host_delegate.h" |
11 | 13 |
12 class NaClBrokerHost : public BrowserChildProcessHost { | 14 namespace content { |
| 15 class BrowserChildProcessHost; |
| 16 } |
| 17 |
| 18 class NaClBrokerHost : public content::BrowserChildProcessHostDelegate { |
13 public: | 19 public: |
14 NaClBrokerHost(); | 20 NaClBrokerHost(); |
15 ~NaClBrokerHost(); | 21 ~NaClBrokerHost(); |
16 | 22 |
17 // This function starts the broker process. It needs to be called | 23 // This function starts the broker process. It needs to be called |
18 // before loaders can be launched. | 24 // before loaders can be launched. |
19 bool Init(); | 25 bool Init(); |
20 | 26 |
21 // Send a message to the broker process, causing it to launch | 27 // Send a message to the broker process, causing it to launch |
22 // a Native Client loader process. | 28 // a Native Client loader process. |
23 bool LaunchLoader(const std::wstring& loader_channel_id); | 29 bool LaunchLoader(const std::wstring& loader_channel_id); |
24 | 30 |
25 // Stop the broker process. | 31 // Stop the broker process. |
26 void StopBroker(); | 32 void StopBroker(); |
27 | 33 |
28 private: | 34 private: |
29 // Handler for NaClProcessMsg_LoaderLaunched message | 35 // Handler for NaClProcessMsg_LoaderLaunched message |
30 void OnLoaderLaunched(const std::wstring& loader_channel_id, | 36 void OnLoaderLaunched(const std::wstring& loader_channel_id, |
31 base::ProcessHandle handle); | 37 base::ProcessHandle handle); |
32 | 38 |
33 // BrowserChildProcessHost implementation: | 39 // BrowserChildProcessHostDelegate implementation: |
34 virtual bool OnMessageReceived(const IPC::Message& msg); | 40 virtual bool OnMessageReceived(const IPC::Message& msg); |
35 | 41 |
36 bool stopping_; | 42 bool stopping_; |
37 | 43 |
| 44 scoped_ptr<content::BrowserChildProcessHost> process_; |
| 45 |
38 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); | 46 DISALLOW_COPY_AND_ASSIGN(NaClBrokerHost); |
39 }; | 47 }; |
40 | 48 |
41 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ | 49 #endif // CHROME_BROWSER_NACL_HOST_NACL_BROKER_HOST_WIN_H_ |
OLD | NEW |