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

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

Issue 9617027: Chromoting: Implemented security attention sequence (SAS) emulation on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased + a bunch of renamings 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/file_path.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/process.h" 13 #include "base/process.h"
14 #include "base/time.h" 14 #include "base/time.h"
15 #include "base/timer.h" 15 #include "base/timer.h"
16 #include "base/win/scoped_handle.h" 16 #include "base/win/scoped_handle.h"
17 #include "base/win/object_watcher.h" 17 #include "base/win/object_watcher.h"
18 #include "ipc/ipc_channel.h"
18 19
19 #include "remoting/host/wts_console_observer_win.h" 20 #include "remoting/host/wts_console_observer_win.h"
20 21
22 namespace base {
23
24 class Thread;
25
26 } // namespace base
27
28 namespace IPC {
29
30 class ChannelProxy;
31 class Message;
32
33 } // namespace IPC
34
21 namespace remoting { 35 namespace remoting {
22 36
37 class SasInjector;
23 class WtsConsoleMonitor; 38 class WtsConsoleMonitor;
24 39
25 class WtsSessionProcessLauncher 40 class WtsSessionProcessLauncher
26 : public base::win::ObjectWatcher::Delegate, 41 : public base::win::ObjectWatcher::Delegate,
42 public IPC::Channel::Listener,
27 public WtsConsoleObserver { 43 public WtsConsoleObserver {
28 public: 44 public:
29 // Constructs a WtsSessionProcessLauncher object. |monitor| must outlive this 45 // Constructs a WtsSessionProcessLauncher object. |monitor| and |io_thread|
30 // class. |host_binary| is the name of the executable to be launched in 46 // must outlive this object. |host_binary| is the name of the executable to
31 // the console session. 47 // be launched in the console session.
32 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor, 48 WtsSessionProcessLauncher(WtsConsoleMonitor* monitor,
33 const FilePath& host_binary); 49 const FilePath& host_binary,
50 base::Thread* io_thread);
34 51
35 virtual ~WtsSessionProcessLauncher(); 52 virtual ~WtsSessionProcessLauncher();
36 53
37 // base::win::ObjectWatcher::Delegate implementation 54 // base::win::ObjectWatcher::Delegate implementation.
38 virtual void OnObjectSignaled(HANDLE object) OVERRIDE; 55 virtual void OnObjectSignaled(HANDLE object) OVERRIDE;
39 56
40 // WtsConsoleObserver implementation 57 // IPC::Channel::Listener implementation.
58 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
59
60 // WtsConsoleObserver implementation.
41 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; 61 virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
42 virtual void OnSessionDetached() OVERRIDE; 62 virtual void OnSessionDetached() OVERRIDE;
43 63
44 private: 64 private:
45 // Attempts to launch the host process in the current console session. 65 // Attempts to launch the host process in the current console session.
46 // Schedules next launch attempt if creation of the process fails for any 66 // Schedules next launch attempt if creation of the process fails for any
47 // reason. 67 // reason.
48 void LaunchProcess(); 68 void LaunchProcess();
49 69
70 // Sends the security attention sequence to the session represented by
Wez 2012/03/08 22:58:55 nit: Secure Attention Sequence
alexeypa (please no reviews) 2012/03/09 01:13:54 Done.
71 // |session_token_|.
72 void OnSendSasToConsole();
73
50 // Name of the host executable. 74 // Name of the host executable.
51 FilePath host_binary_; 75 FilePath host_binary_;
52 76
53 // Time of the last launch attempt. 77 // Time of the last launch attempt.
54 base::Time launch_time_; 78 base::Time launch_time_;
55 79
56 // Current backoff delay. 80 // Current backoff delay.
57 base::TimeDelta launch_backoff_; 81 base::TimeDelta launch_backoff_;
58 82
59 // Timer used to schedule the next attempt to launch the process. 83 // Timer used to schedule the next attempt to launch the process.
60 base::OneShotTimer<WtsSessionProcessLauncher> timer_; 84 base::OneShotTimer<WtsSessionProcessLauncher> timer_;
61 85
86 // Pointer to the I/O thread.
Wez 2012/03/08 22:58:55 nit: I can see that from the naming. What's it us
alexeypa (please no reviews) 2012/03/09 01:13:54 Done.
87 base::Thread* io_thread_;
88
62 // This pointer is used to unsubscribe from session attach and detach events. 89 // This pointer is used to unsubscribe from session attach and detach events.
63 WtsConsoleMonitor* monitor_; 90 WtsConsoleMonitor* monitor_;
64 91
65 // Impersonation token that has the SE_TCB_NAME privilege enabled. 92 // Impersonation token that has the SE_TCB_NAME privilege enabled.
66 base::win::ScopedHandle privileged_token_; 93 base::win::ScopedHandle privileged_token_;
67 94
68 // The handle of the process injected into the console session. 95 // The handle of the process injected into the console session.
69 base::Process process_; 96 base::Process process_;
70 97
71 // Used to determine when the launched process terminates. 98 // Used to determine when the launched process terminates.
72 base::win::ObjectWatcher process_watcher_; 99 base::win::ObjectWatcher process_watcher_;
73 100
74 // The token to be used to launch a process in a different session. 101 // The token to be used to launch a process in a different session.
75 base::win::ScopedHandle session_token_; 102 base::win::ScopedHandle session_token_;
76 103
77 // Defines the states the process launcher can be in. 104 // Defines the states the process launcher can be in.
78 enum State { 105 enum State {
79 StateDetached, 106 StateDetached,
80 StateStarting, 107 StateStarting,
81 StateAttached, 108 StateAttached,
82 }; 109 };
83 110
84 // Current state of the process launcher. 111 // Current state of the process launcher.
85 State state_; 112 State state_;
86 113
114 // The server endpoint of the chromoting IPC channel.
Wez 2012/03/08 22:58:55 Is it relevant that it's the server endpoint? Woul
alexeypa (please no reviews) 2012/03/09 01:13:54 Done.
115 scoped_ptr<IPC::ChannelProxy> chromoting_channel_;
116
117 scoped_ptr<SasInjector> sas_injector_;
118
87 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher); 119 DISALLOW_COPY_AND_ASSIGN(WtsSessionProcessLauncher);
88 }; 120 };
89 121
90 } // namespace remoting 122 } // namespace remoting
91 123
92 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_ 124 #endif // REMOTING_HOST_WTS_SESSION_PROCESS_LAUNCHER_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698