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

Side by Side Diff: remoting/host/wts_session_process_launcher_win.h

Issue 10832068: Moving Windows-only files: remoting/host -> remoting/host/win. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_
6 #define REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_
7
8 #include <windows.h>
9
10 #include "base/basictypes.h"
11 #include "base/file_path.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/process.h"
16 #include "base/time.h"
17 #include "base/timer.h"
18 #include "base/win/scoped_handle.h"
19 #include "base/win/object_watcher.h"
20 #include "ipc/ipc_channel.h"
21
22 #include "remoting/host/wts_console_observer_win.h"
23
24 namespace base {
25 class MessageLoopProxy;
26 } // namespace base
27
28 namespace IPC {
29 class ChannelProxy;
30 class Message;
31 } // namespace IPC
32
33 namespace remoting {
34
35 // Session id that does not represent any session.
36 extern const uint32 kInvalidSessionId;
37
38 class SasInjector;
39 class WtsConsoleMonitor;
40
41 class WtsSessionProcessLauncher
42 : public base::win::ObjectWatcher::Delegate,
43 public IPC::Listener,
44 public WtsConsoleObserver {
45 public:
46 // Constructs a WtsSessionProcessLauncher object. |host_binary| is the name of
47 // the executable to be launched in the console session. All interaction with
48 // |monitor| should happen on |main_message_loop|. |ipc_message_loop| has
49 // to be an I/O message loop.
50 WtsSessionProcessLauncher(
51 WtsConsoleMonitor* monitor,
52 const FilePath& host_binary,
53 scoped_refptr<base::MessageLoopProxy> main_message_loop,
54 scoped_refptr<base::MessageLoopProxy> ipc_message_loop);
55
56 virtual ~WtsSessionProcessLauncher();
57
58 // base::win::ObjectWatcher::Delegate implementation.
59 virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
60
61 // IPC::Listener implementation.
62 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
63
64 // WtsConsoleObserver implementation.
65 virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
66 virtual void OnSessionDetached() OVERRIDE;
67
68 private:
69 // Attempts to launch the host process in the current console session.
70 // Schedules next launch attempt if creation of the process fails for any
71 // reason.
72 void LaunchProcess();
73
74 // Sends the Secure Attention Sequence to the session represented by
75 // |session_token_|.
76 void OnSendSasToConsole();
77
78 // Name of the host executable.
79 FilePath host_binary_;
80
81 // Time of the last launch attempt.
82 base::Time launch_time_;
83
84 // Current backoff delay.
85 base::TimeDelta launch_backoff_;
86
87 // Timer used to schedule the next attempt to launch the process.
88 base::OneShotTimer<WtsSessionProcessLauncher> timer_;
89
90 // The main service message loop.
91 scoped_refptr<base::MessageLoopProxy> main_message_loop_;
92
93 // Message loop used by the IPC channel.
94 scoped_refptr<base::MessageLoopProxy> ipc_message_loop_;
95
96 // This pointer is used to unsubscribe from session attach and detach events.
97 WtsConsoleMonitor* monitor_;
98
99 // Impersonation token that has the SE_TCB_NAME privilege enabled.
100 base::win::ScopedHandle privileged_token_;
101
102 // The handle of the process injected into the console session.
103 base::Process process_;
104
105 // Used to determine when the launched process terminates.
106 base::win::ObjectWatcher process_watcher_;
107
108 // The token to be used to launch a process in a different session.
109 base::win::ScopedHandle session_token_;
110
111 // Defines the states the process launcher can be in.
112 enum State {
113 StateDetached,
114 StateStarting,
115 StateAttached,
116 };
117
118 // Current state of the process launcher.
119 State state_;
120
121 // The Chromoting IPC channel connecting the service to the per-session
122 // process.
123 scoped_ptr<IPC::ChannelProxy> chromoting_channel_;
124
125 scoped_ptr<SasInjector> sas_injector_;
126
127 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);
128 };
129
130 } // namespace remoting
131
132 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_
OLDNEW
« no previous file with comments | « remoting/host/wts_console_observer_win.h ('k') | remoting/host/wts_session_process_launcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698