Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ | 5 #ifndef REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ |
| 6 #define REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ | 6 #define REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/win/scoped_handle.h" | |
| 12 #include "remoting/host/win/worker_process_launcher.h" | 13 #include "remoting/host/win/worker_process_launcher.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 16 } // namespace base | 17 } // namespace base |
| 17 | 18 |
| 19 namespace IPC { | |
| 20 class ChannelProxy; | |
| 21 class Listener; | |
| 22 class Message; | |
| 23 } // namespace IPC | |
| 24 | |
| 18 namespace remoting { | 25 namespace remoting { |
| 19 | 26 |
| 20 // Implements logic for launching and monitoring a worker process under a less | 27 // Implements logic for launching and monitoring a worker process under a less |
| 21 // privileged user account. | 28 // privileged user account. |
| 22 class UnprivilegedProcessDelegate : public WorkerProcessLauncher::Delegate { | 29 class UnprivilegedProcessDelegate : public WorkerProcessLauncher::Delegate { |
| 23 public: | 30 public: |
| 24 UnprivilegedProcessDelegate( | 31 UnprivilegedProcessDelegate( |
| 25 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | 32 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 26 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 33 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 27 const FilePath& binary_path); | 34 const FilePath& binary_path); |
| 28 virtual ~UnprivilegedProcessDelegate(); | 35 virtual ~UnprivilegedProcessDelegate(); |
| 29 | 36 |
| 37 // IPC::Sender implementation. | |
| 38 virtual bool Send(IPC::Message* message) OVERRIDE; | |
| 39 | |
| 30 // WorkerProcessLauncher::Delegate implementation. | 40 // WorkerProcessLauncher::Delegate implementation. |
| 31 virtual DWORD GetExitCode() OVERRIDE; | 41 virtual DWORD GetExitCode() OVERRIDE; |
| 32 virtual void KillProcess(DWORD exit_code) OVERRIDE; | 42 virtual void KillProcess(DWORD exit_code) OVERRIDE; |
| 33 virtual bool LaunchProcess( | 43 virtual bool LaunchProcess( |
| 34 const std::string& channel_name, | 44 IPC::Listener* delegate, |
| 35 base::win::ScopedHandle* process_exit_event_out) OVERRIDE; | 45 base::win::ScopedHandle* process_exit_event_out) OVERRIDE; |
| 36 | 46 |
| 37 private: | 47 private: |
| 48 // Creates an already connected IPC channel. The server end of the channel | |
| 49 // is wrapped into a channel proxy that will invoke methods of |delegate| | |
| 50 // on the |main_task_runner| thread while using |io_task_runner| to send and | |
| 51 // receive messages in the background. The client end is returned as | |
| 52 // an inheritable NT handle. | |
| 53 bool CreateConnectedIpcChannel(const std::string channel_name, | |
|
simonmorris
2012/10/12 16:31:13
string -> string& ?
alexeypa (please no reviews)
2012/10/12 18:44:39
Done.
| |
| 54 IPC::Listener* delegate, | |
| 55 base::win::ScopedHandle* client_out, | |
| 56 scoped_ptr<IPC::ChannelProxy>* server_out); | |
| 57 | |
| 38 // The task runner all public methods of this class should be called on. | 58 // The task runner all public methods of this class should be called on. |
| 39 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | 59 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 40 | 60 |
| 41 // The task runner serving job object notifications. | 61 // The task runner serving job object notifications. |
| 42 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 62 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 43 | 63 |
| 44 // Path to the worker process binary. | 64 // Path to the worker process binary. |
| 45 FilePath binary_path_; | 65 FilePath binary_path_; |
| 46 | 66 |
| 67 // The server end of the IPC channel used to commonicate to the worker | |
|
simonmorris
2012/10/12 16:31:13
commonicate -> communicate
alexeypa (please no reviews)
2012/10/12 18:44:39
Done.
| |
| 68 // process. | |
| 69 scoped_ptr<IPC::ChannelProxy> channel_; | |
| 70 | |
| 47 // The handle of the worker process, if launched. | 71 // The handle of the worker process, if launched. |
| 48 base::win::ScopedHandle worker_process_; | 72 base::win::ScopedHandle worker_process_; |
| 49 | 73 |
| 50 DISALLOW_COPY_AND_ASSIGN(UnprivilegedProcessDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(UnprivilegedProcessDelegate); |
| 51 }; | 75 }; |
| 52 | 76 |
| 53 } // namespace remoting | 77 } // namespace remoting |
| 54 | 78 |
| 55 #endif // REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ | 79 #endif // REMOTING_HOST_WIN_UNPRIVILEGED_PROCESS_DELEGATE_H_ |
| OLD | NEW |