| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ | 5 #ifndef COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ |
| 6 #define COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ | 6 #define COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/process/process.h" | 12 #include "base/process/process.h" |
| 10 #include "components/nacl/common/nacl_types.h" | 13 #include "components/nacl/common/nacl_types.h" |
| 11 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 14 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
| 12 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
| 13 | 16 |
| 14 namespace IPC { | 17 namespace IPC { |
| 15 class AttachmentBrokerUnprivileged; | 18 class AttachmentBrokerUnprivileged; |
| 16 class Channel; | 19 class Channel; |
| 17 } | 20 } |
| 18 | 21 |
| 19 // The BrokerThread class represents the thread that handles the messages from | 22 // The BrokerThread class represents the thread that handles the messages from |
| 20 // the browser process and starts NaCl loader processes. | 23 // the browser process and starts NaCl loader processes. |
| 21 class NaClBrokerListener : public content::SandboxedProcessLauncherDelegate, | 24 class NaClBrokerListener : public content::SandboxedProcessLauncherDelegate, |
| 22 public IPC::Listener { | 25 public IPC::Listener { |
| 23 public: | 26 public: |
| 24 NaClBrokerListener(); | 27 NaClBrokerListener(); |
| 25 ~NaClBrokerListener() override; | 28 ~NaClBrokerListener() override; |
| 26 | 29 |
| 27 void Listen(); | 30 void Listen(); |
| 28 | 31 |
| 29 // content::SandboxedProcessLauncherDelegate implementation: | 32 // content::SandboxedProcessLauncherDelegate implementation: |
| 30 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override; | 33 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override; |
| 31 | 34 |
| 32 // IPC::Listener implementation. | 35 // IPC::Listener implementation. |
| 33 void OnChannelConnected(int32 peer_pid) override; | 36 void OnChannelConnected(int32_t peer_pid) override; |
| 34 bool OnMessageReceived(const IPC::Message& msg) override; | 37 bool OnMessageReceived(const IPC::Message& msg) override; |
| 35 void OnChannelError() override; | 38 void OnChannelError() override; |
| 36 | 39 |
| 37 private: | 40 private: |
| 38 void OnLaunchLoaderThroughBroker(const std::string& loader_channel_id); | 41 void OnLaunchLoaderThroughBroker(const std::string& loader_channel_id); |
| 39 void OnLaunchDebugExceptionHandler(int32 pid, | 42 void OnLaunchDebugExceptionHandler(int32_t pid, |
| 40 base::ProcessHandle process_handle, | 43 base::ProcessHandle process_handle, |
| 41 const std::string& startup_info); | 44 const std::string& startup_info); |
| 42 void OnStopBroker(); | 45 void OnStopBroker(); |
| 43 | 46 |
| 44 base::Process browser_process_; | 47 base::Process browser_process_; |
| 45 scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_; | 48 scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_; |
| 46 scoped_ptr<IPC::Channel> channel_; | 49 scoped_ptr<IPC::Channel> channel_; |
| 47 | 50 |
| 48 DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); | 51 DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener); |
| 49 }; | 52 }; |
| 50 | 53 |
| 51 #endif // COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ | 54 #endif // COMPONENTS_NACL_BROKER_NACL_BROKER_LISTENER_H_ |
| OLD | NEW |