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

Side by Side 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, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/process.h"
14 #include "base/time.h"
15 #include "base/timer.h"
16 #include "base/win/object_watcher.h"
12 17
13 #include "remoting/host/wts_console_observer_win.h" 18 #include "remoting/host/wts_console_observer_win.h"
14 19
20 namespace base {
21 namespace win {
22
23 class ScopedHandle;
24
25 } // namespace win
26 } // namespace base
27
15 namespace remoting { 28 namespace remoting {
16 29
17 class WtsConsoleMonitor; 30 class WtsConsoleMonitor;
18 31
19 class WtsSessionProcessLauncher : public WtsConsoleObserver { 32 class WtsSessionProcessLauncher
33 : public base::win::ObjectWatcher::Delegate,
34 public WtsConsoleObserver {
20 public: 35 public:
21 // Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this 36 // Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this
22 // class. 37 // class. |host_binary| is the name of the executable to be launched in
23 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor); 38 // 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.
39 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor,
40 const FilePath& host_binary);
41
24 virtual ~WtsSessionProcessLauncher(); 42 virtual ~WtsSessionProcessLauncher();
25 43
44 // base::win::ObjectWatcher::Delegate implementation
45 virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
46
26 // WtsConsoleObserver implementation 47 // WtsConsoleObserver implementation
27 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; 48 virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
28 virtual void OnSessionDetached() OVERRIDE; 49 virtual void OnSessionDetached() OVERRIDE;
29 50
30 private: 51 private:
52 // 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.
53 // Schedules next launch attempt if creation of the process fails for any
54 // reason.
55 void LaunchProcess();
56
57 // Name of the host executable.
58 FilePath host_binary_;
59
60 // Time of the last launch attempt.
61 base::Time launch_time_;
62
63 // Current backoff delay.
64 base::TimeDelta launch_backoff_;
65
66 // Timer used to schedule the next attempt to launch the process.
67 base::OneShotTimer<WtsSessionProcessLauncher> timer_;
68
69 // This pointer is used to unsubscribe from session attach and detach events.
31 WtsConsoleMonitor* monitor_; 70 WtsConsoleMonitor* monitor_;
32 71
72 // Impersonation token that has the SE_TCB_NAME privilege enabled.
73 base::win::ScopedHandle privileged_token_;
74
75 // 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.
76 base::Process process_;
77
78 // 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.
79 base::win::ObjectWatcher process_watcher_;
80
81 // The token to be used to launch a process in a different session.
82 base::win::ScopedHandle session_token_;
83
84 // Defines the states the process launcher can be in.
85 enum State {
86 StateDetached,
87 StateStarting,
88 StateAttached,
89 };
90
91 // Current state of the process launcher.
92 State state_;
93
33 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); 94 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);
34 }; 95 };
35 96
36 } // namespace remoting 97 } // namespace remoting
37 98
38 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ 99 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698