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