| 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_WTS_SESSION_PROCESS_LAUNCHER_H_ | 5 #ifndef REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ |
| 6 #define REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ | 6 #define REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/file_path.h" |
| 13 #include "base/file_util.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
| 15 #include "base/process.h" | 17 #include "base/process.h" |
| 16 #include "base/time.h" | 18 #include "base/time.h" |
| 17 #include "base/timer.h" | 19 #include "base/timer.h" |
| 18 #include "base/win/scoped_handle.h" | 20 #include "base/win/scoped_handle.h" |
| 19 #include "ipc/ipc_channel.h" | 21 #include "ipc/ipc_channel.h" |
| 20 #include "remoting/base/stoppable.h" | 22 #include "remoting/base/stoppable.h" |
| 21 #include "remoting/host/win/worker_process_launcher.h" | 23 #include "remoting/host/win/worker_process_launcher.h" |
| 22 #include "remoting/host/win/wts_console_observer.h" | 24 #include "remoting/host/win/wts_console_observer.h" |
| 25 #include "remoting/host/worker_process_ipc_delegate.h" |
| 23 | 26 |
| 24 namespace base { | 27 namespace base { |
| 25 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 26 } // namespace base | 29 } // namespace base |
| 27 | 30 |
| 28 namespace IPC { | |
| 29 class ChannelProxy; | |
| 30 class Message; | |
| 31 } // namespace IPC | |
| 32 | |
| 33 namespace remoting { | 31 namespace remoting { |
| 34 | 32 |
| 35 class WtsConsoleMonitor; | 33 class WtsConsoleMonitor; |
| 36 | 34 |
| 37 class WtsSessionProcessLauncher | 35 class WtsSessionProcessLauncher |
| 38 : public base::MessagePumpForIO::IOHandler, | 36 : public base::MessagePumpForIO::IOHandler, |
| 39 public Stoppable, | 37 public Stoppable, |
| 38 public WorkerProcessIpcDelegate, |
| 40 public WorkerProcessLauncher::Delegate, | 39 public WorkerProcessLauncher::Delegate, |
| 41 public WtsConsoleObserver { | 40 public WtsConsoleObserver { |
| 42 public: | 41 public: |
| 43 // Constructs a WtsSessionProcessLauncher object. |stopped_callback| and | 42 // Constructs a WtsSessionProcessLauncher object. |stopped_callback| and |
| 44 // |main_message_loop| are passed to the undelying |Stoppable| implementation. | 43 // |main_message_loop| are passed to the undelying |Stoppable| implementation. |
| 45 // All interaction with |monitor| should happen on |main_message_loop|. | 44 // All interaction with |monitor| should happen on |main_message_loop|. |
| 46 // |ipc_message_loop| must be an I/O message loop. | 45 // |ipc_message_loop| must be an I/O message loop. |
| 47 WtsSessionProcessLauncher( | 46 WtsSessionProcessLauncher( |
| 48 const base::Closure& stopped_callback, | 47 const base::Closure& stopped_callback, |
| 49 WtsConsoleMonitor* monitor, | 48 WtsConsoleMonitor* monitor, |
| 50 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop, | 49 scoped_refptr<base::SingleThreadTaskRunner> main_message_loop, |
| 51 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop); | 50 scoped_refptr<base::SingleThreadTaskRunner> ipc_message_loop); |
| 52 | 51 |
| 53 virtual ~WtsSessionProcessLauncher(); | 52 virtual ~WtsSessionProcessLauncher(); |
| 54 | 53 |
| 55 // base::MessagePumpForIO::IOHandler implementation. | 54 // base::MessagePumpForIO::IOHandler implementation. |
| 56 virtual void OnIOCompleted(base::MessagePumpForIO::IOContext* context, | 55 virtual void OnIOCompleted(base::MessagePumpForIO::IOContext* context, |
| 57 DWORD bytes_transferred, | 56 DWORD bytes_transferred, |
| 58 DWORD error) OVERRIDE; | 57 DWORD error) OVERRIDE; |
| 59 | 58 |
| 59 // WorkerProcessIpcDelegate implementation. |
| 60 virtual void OnChannelConnected() OVERRIDE; |
| 61 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 62 |
| 60 // WorkerProcessLauncher::Delegate implementation. | 63 // WorkerProcessLauncher::Delegate implementation. |
| 61 virtual bool DoLaunchProcess( | 64 virtual bool DoLaunchProcess( |
| 62 const std::string& channel_name, | 65 const std::string& channel_name, |
| 63 base::win::ScopedHandle* process_exit_event_out) OVERRIDE; | 66 base::win::ScopedHandle* process_exit_event_out) OVERRIDE; |
| 64 virtual void DoKillProcess(DWORD exit_code) OVERRIDE; | 67 virtual void DoKillProcess(DWORD exit_code) OVERRIDE; |
| 65 virtual void OnChannelConnected() OVERRIDE; | |
| 66 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
| 67 | 68 |
| 68 // WtsConsoleObserver implementation. | 69 // WtsConsoleObserver implementation. |
| 69 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; | 70 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; |
| 70 virtual void OnSessionDetached() OVERRIDE; | 71 virtual void OnSessionDetached() OVERRIDE; |
| 71 | 72 |
| 72 protected: | 73 protected: |
| 73 // Stoppable implementation. | 74 // Stoppable implementation. |
| 74 virtual void DoStop() OVERRIDE; | 75 virtual void DoStop() OVERRIDE; |
| 75 | 76 |
| 76 private: | 77 private: |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 142 |
| 142 // The token to be used to launch a process in a different session. | 143 // The token to be used to launch a process in a different session. |
| 143 base::win::ScopedHandle session_token_; | 144 base::win::ScopedHandle session_token_; |
| 144 | 145 |
| 145 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); | 146 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 } // namespace remoting | 149 } // namespace remoting |
| 149 | 150 |
| 150 #endif // REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ | 151 #endif // REMOTING_HOST_WIN_WTS_SESSION_PROCESS_LAUNCHER_H_ |
| OLD | NEW |