Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: remoting/host/wts_session_process_launcher_win.h

Issue 9476017: Chromoting service now launches the host process in the session the is currently attached to the ph… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing scoped_ptr<ScopedHandle>. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/host/wts_session_process_launcher_win.h
diff --git a/remoting/host/wts_session_process_launcher_win.h b/remoting/host/wts_session_process_launcher_win.h
index b1c9104dc2f6ebbf36cc584febb47b9073f996dc..c0d81318a2cd7fc0e6881c1d4572e1a26c19f52b 100644
--- a/remoting/host/wts_session_process_launcher_win.h
+++ b/remoting/host/wts_session_process_launcher_win.h
@@ -8,28 +8,89 @@
#include <windows.h>
#include "base/basictypes.h"
+#include "base/file_path.h"
#include "base/compiler_specific.h"
+#include "base/process.h"
+#include "base/time.h"
+#include "base/timer.h"
+#include "base/win/object_watcher.h"
#include "remoting/host/wts_console_observer_win.h"
+namespace base {
+namespace win {
+
+class ScopedHandle;
+
+} // namespace win
+} // namespace base
+
namespace remoting {
class WtsConsoleMonitor;
-class WtsSessionProcessLauncher : public WtsConsoleObserver {
+class WtsSessionProcessLauncher
+ : public base::win::ObjectWatcher::Delegate,
+ public WtsConsoleObserver {
public:
// Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this
- // class.
- WtsSessionProcessLauncher(WtsConsoleMonitor* monitor);
+ // class. |host_binary| is the name of the executable to be launched in
+ // the session attached to the console.
Wez 2012/02/28 22:55:36 nit: the console session.
alexeypa (please no reviews) 2012/02/29 04:17:56 Done.
+ WtsSessionProcessLauncher(WtsConsoleMonitor* monitor,
+ const FilePath& host_binary);
+
virtual ~WtsSessionProcessLauncher();
+ // base::win::ObjectWatcher::Delegate implementation
+ virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
+
// WtsConsoleObserver implementation
virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
virtual void OnSessionDetached() OVERRIDE;
private:
+ // Attempts to launch the host process in the currently attached session.
Wez 2012/02/28 22:55:36 nit: current console session?
alexeypa (please no reviews) 2012/02/29 04:17:56 Done.
+ // Schedules next launch attempt if creation of the process fails for any
+ // reason.
+ void LaunchProcess();
+
+ // Name of the host executable.
+ FilePath host_binary_;
+
+ // Time of the last launch attempt.
+ base::Time launch_time_;
+
+ // Current backoff delay.
+ base::TimeDelta launch_backoff_;
+
+ // Timer used to schedule the next attempt to launch the process.
+ base::OneShotTimer<WtsSessionProcessLauncher> timer_;
+
+ // This pointer is used to unsubscribe from session attach and detach events.
WtsConsoleMonitor* monitor_;
+ // Impersonation token that has the SE_TCB_NAME privilege enabled.
+ base::win::ScopedHandle privileged_token_;
+
+ // The handle of the process injected into the watched session.
Wez 2012/02/28 22:55:36 nit: watched -> console?
alexeypa (please no reviews) 2012/02/29 04:17:56 Done.
+ base::Process process_;
+
+ // Monitors the launched process calling a callback when it terminates.
Wez 2012/02/28 22:55:36 nit: "Used to determine when the launched process
alexeypa (please no reviews) 2012/02/29 04:17:56 Done.
+ base::win::ObjectWatcher process_watcher_;
+
+ // The token to be used to launch a process in a different session.
+ base::win::ScopedHandle session_token_;
+
+ // Defines the states the process launcher can be in.
+ enum State {
+ StateDetached,
+ StateStarting,
+ StateAttached,
+ };
+
+ // Current state of the process launcher.
+ State state_;
+
DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);
};

Powered by Google App Engine
This is Rietveld 408576698