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