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. |host_binary| is the name of |
| 46 // must outlive this object. |host_binary| is the name of the executable to | 44 // the executable to be launched in the console session. All interaction with |
| 47 // be launched in the console session. | 45 // |monitor| should happen on the same tthread as |main_message_loop| is. |
|
Wez
2012/04/11 01:01:23
typo: tthread
Wez
2012/04/11 01:01:23
reword: "All interaction ... should happen on |mai
alexeypa (please no reviews)
2012/04/11 17:39:39
Done.
| |
| 48 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor, | 46 // |ipc_message_loop| has to be an I/O message loop. |
| 49 const FilePath& host_binary, | 47 WtsSessionProcessLauncher( |
| 50 base::Thread* io_thread); | 48 WtsConsoleMonitor* monitor, |
| 49 const FilePath& host_binary, | |
| 50 scoped_refptr<base::MessageLoopProxy> main_message_loop, | |
| 51 scoped_refptr<base::MessageLoopProxy> ipc_message_loop); | |
| 51 | 52 |
| 52 virtual ~WtsSessionProcessLauncher(); | 53 virtual ~WtsSessionProcessLauncher(); |
| 53 | 54 |
| 54 // base::win::ObjectWatcher::Delegate implementation. | 55 // base::win::ObjectWatcher::Delegate implementation. |
| 55 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; | 56 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; |
| 56 | 57 |
| 57 // IPC::Channel::Listener implementation. | 58 // IPC::Channel::Listener implementation. |
| 58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 59 | 60 |
| 60 // WtsConsoleObserver implementation. | 61 // WtsConsoleObserver implementation. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 76 | 77 |
| 77 // Time of the last launch attempt. | 78 // Time of the last launch attempt. |
| 78 base::Time launch_time_; | 79 base::Time launch_time_; |
| 79 | 80 |
| 80 // Current backoff delay. | 81 // Current backoff delay. |
| 81 base::TimeDelta launch_backoff_; | 82 base::TimeDelta launch_backoff_; |
| 82 | 83 |
| 83 // Timer used to schedule the next attempt to launch the process. | 84 // Timer used to schedule the next attempt to launch the process. |
| 84 base::OneShotTimer<WtsSessionProcessLauncher> timer_; | 85 base::OneShotTimer<WtsSessionProcessLauncher> timer_; |
| 85 | 86 |
| 86 // The I/O thread hosts the Chromoting IPC channel and any other code | 87 // The main service message loop. |
| 87 // requiring an I/O message loop. | 88 scoped_refptr<base::MessageLoopProxy> main_message_loop_; |
| 88 base::Thread* io_thread_; | 89 |
| 90 // Message loop used by the IPC channel. | |
| 91 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_; | |
| 89 | 92 |
| 90 // This pointer is used to unsubscribe from session attach and detach events. | 93 // This pointer is used to unsubscribe from session attach and detach events. |
| 91 WtsConsoleMonitor* monitor_; | 94 WtsConsoleMonitor* monitor_; |
| 92 | 95 |
| 93 // Impersonation token that has the SE_TCB_NAME privilege enabled. | 96 // Impersonation token that has the SE_TCB_NAME privilege enabled. |
| 94 base::win::ScopedHandle privileged_token_; | 97 base::win::ScopedHandle privileged_token_; |
| 95 | 98 |
| 96 // The handle of the process injected into the console session. | 99 // The handle of the process injected into the console session. |
| 97 base::Process process_; | 100 base::Process process_; |
| 98 | 101 |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 117 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; | 120 scoped_ptr<IPC::ChannelProxy> chromoting_channel_; |
| 118 | 121 |
| 119 scoped_ptr<SasInjector> sas_injector_; | 122 scoped_ptr<SasInjector> sas_injector_; |
| 120 | 123 |
| 121 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); | 124 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); |
| 122 }; | 125 }; |
| 123 | 126 |
| 124 } // namespace remoting | 127 } // namespace remoting |
| 125 | 128 |
| 126 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ | 129 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ |
| OLD | NEW |