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_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ | 5 #ifndef REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ |
| 6 #define REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ | 6 #define REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_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/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/process.h" | 15 #include "base/process.h" |
| 14 #include "base/time.h" | 16 #include "base/time.h" |
| 15 #include "base/timer.h" | 17 #include "base/timer.h" |
| 16 #include "base/win/scoped_handle.h" | 18 #include "base/win/scoped_handle.h" |
| 17 #include "base/win/object_watcher.h" | 19 #include "base/win/object_watcher.h" |
| 18 #include "ipc/ipc_channel.h" | 20 #include "ipc/ipc_channel.h" |
| 19 | 21 |
| 20 #include "remoting/host/wts_console_observer_win.h" | 22 #include "remoting/host/wts_console_observer_win.h" |
| 21 | 23 |
| 22 namespace base { | 24 namespace base { |
| 23 | 25 class MessageLoopProxy; |
| 24 class Thread; | |
| 25 | |
| 26 } // namespace base | 26 } // namespace base |
| 27 | 27 |
| 28 namespace IPC { | 28 namespace IPC { |
| 29 | |
| 30 class ChannelProxy; | 29 class ChannelProxy; |
| 31 class Message; | 30 class Message; |
| 32 | |
| 33 } // namespace IPC | 31 } // namespace IPC |
| 34 | 32 |
| 35 namespace remoting { | 33 namespace remoting { |
| 36 | 34 |
| 37 class SasInjector; | 35 class SasInjector; |
| 38 class WtsConsoleMonitor; | 36 class WtsConsoleMonitor; |
| 39 | 37 |
| 40 class WtsSessionProcessLauncher | 38 class WtsSessionProcessLauncher |
| 41 : public base::win::ObjectWatcher::Delegate, | 39 : public base::win::ObjectWatcher::Delegate, |
| 42 public IPC::Channel::Listener, | 40 public IPC::Channel::Listener, |
| 43 public WtsConsoleObserver { | 41 public WtsConsoleObserver { |
| 44 public: | 42 public: |
| 45 // Constructs a WtsSessionProcessLauncher object. |monitor| and |io_thread| | 43 // Constructs a WtsSessionProcessLauncher object. |monitor| and |io_thread| |
| 46 // must outlive this object. |host_binary| is the name of the executable to | 44 // must outlive this object. |host_binary| is the name of the executable to |
| 47 // be launched in the console session. | 45 // be launched in the console session. |
|
Wez
2012/04/10 21:26:20
nit: Update this comment.
alexeypa (please no reviews)
2012/04/10 22:18:16
Done.
| |
| 48 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor, | 46 WtsSessionProcessLauncher( |
| 49 const FilePath& host_binary, | 47 WtsConsoleMonitor* monitor, |
| 50 base::Thread* io_thread); | 48 const FilePath& host_binary, |
| 49 scoped_refptr<base::MessageLoopProxy> main_message_loop, | |
| 50 scoped_refptr<base::MessageLoopProxy> ipc_message_loop); | |
| 51 | 51 |
| 52 virtual ~WtsSessionProcessLauncher(); | 52 virtual ~WtsSessionProcessLauncher(); |
| 53 | 53 |
| 54 // base::win::ObjectWatcher::Delegate implementation. | 54 // base::win::ObjectWatcher::Delegate implementation. |
| 55 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 55 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
| 56 | 56 |
| 57 // IPC::Channel::Listener implementation. | 57 // IPC::Channel::Listener implementation. |
| 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 59 | 59 |
| 60 // WtsConsoleObserver implementation. | 60 // WtsConsoleObserver implementation. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 76 | 76 |
| 77 // Time of the last launch attempt. | 77 // Time of the last launch attempt. |
| 78 base::Time launch_time_; | 78 base::Time launch_time_; |
| 79 | 79 |
| 80 // Current backoff delay. | 80 // Current backoff delay. |
| 81 base::TimeDelta launch_backoff_; | 81 base::TimeDelta launch_backoff_; |
| 82 | 82 |
| 83 // Timer used to schedule the next attempt to launch the process. | 83 // Timer used to schedule the next attempt to launch the process. |
| 84 base::OneShotTimer<WtsSessionProcessLauncher> timer_; | 84 base::OneShotTimer<WtsSessionProcessLauncher> timer_; |
| 85 | 85 |
| 86 // The I/O thread hosts the Chromoting IPC channel and any other code | 86 // The main service message loop. |
| 87 // requiring an I/O message loop. | 87 scoped_refptr<base::MessageLoopProxy> main_message_loop_; |
| 88 base::Thread* io_thread_; | 88 |
| 89 // Message loop used by the IPC channel. | |
| 90 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; | |
| 89 | 91 |
| 90 // This pointer is used to unsubscribe from session attach and detach events. | 92 // This pointer is used to unsubscribe from session attach and detach events. |
| 91 WtsConsoleMonitor* monitor_; | 93 WtsConsoleMonitor* monitor_; |
| 92 | 94 |
| 93 // Impersonation token that has the SE_TCB_NAME privilege enabled. | 95 // Impersonation token that has the SE_TCB_NAME privilege enabled. |
| 94 base::win::ScopedHandle privileged_token_; | 96 base::win::ScopedHandle privileged_token_; |
| 95 | 97 |
| 96 // The handle of the process injected into the console session. | 98 // The handle of the process injected into the console session. |
| 97 base::Process process_; | 99 base::Process process_; |
| 98 | 100 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 117 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; | 119 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; |
| 118 | 120 |
| 119 scoped_ptr<SasInjector> sas_injector_; | 121 scoped_ptr<SasInjector> sas_injector_; |
| 120 | 122 |
| 121 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); | 123 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); |
| 122 }; | 124 }; |
| 123 | 125 |
| 124 } // namespace remoting | 126 } // namespace remoting |
| 125 | 127 |
| 126 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ | 128 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ |
| OLD | NEW |