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

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

Issue 12544020: Remote RDP sessions, rather than the console, if curtain-mode is configured. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing remoting_unittests Created 7 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
« no previous file with comments | « remoting/host/daemon_process_win.cc ('k') | remoting/host/desktop_session_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_DESKTOP_SESSION_WIN_H_ 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_WIN_H_
6 #define REMOTING_HOST_DESKTOP_SESSION_WIN_H_ 6 #define REMOTING_HOST_DESKTOP_SESSION_WIN_H_
7 7
8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/timer.h"
11 #include "base/win/scoped_handle.h" 11 #include "base/win/scoped_handle.h"
12 #include "ipc/ipc_platform_file.h" 12 #include "ipc/ipc_platform_file.h"
13 #include "remoting/host/desktop_session.h" 13 #include "remoting/host/desktop_session.h"
14 #include "remoting/host/win/wts_terminal_observer.h" 14 #include "remoting/host/win/wts_terminal_observer.h"
15 #include "remoting/host/worker_process_ipc_delegate.h" 15 #include "remoting/host/worker_process_ipc_delegate.h"
16 16
17 namespace net {
18 class IPEndPoint;
19 } // namespace net
20
17 namespace tracked_objects { 21 namespace tracked_objects {
18 class Location; 22 class Location;
19 } // namespace tracked_objects 23 } // namespace tracked_objects
20 24
21 namespace remoting { 25 namespace remoting {
22 26
23 class AutoThreadTaskRunner; 27 class AutoThreadTaskRunner;
24 class DaemonProcess; 28 class DaemonProcess;
29 class DesktopSession;
25 struct DesktopSessionParams; 30 struct DesktopSessionParams;
26 class SasInjector;
27 class WorkerProcessLauncher; 31 class WorkerProcessLauncher;
28 class WtsTerminalMonitor; 32 class WtsTerminalMonitor;
29 33
30 // DesktopSession implementation which attaches to the host's physical console. 34 // DesktopSession implementation which attaches to either physical or virtual
31 // Receives IPC messages from the desktop process, running in the console 35 // (RDP) console. Receives IPC messages from the desktop process, running in
32 // session, via |WorkerProcessIpcDelegate|, and monitors console session 36 // the target session, via |WorkerProcessIpcDelegate|, and monitors session
33 // attach/detach events via |WtsConsoleObserer|. 37 // attach/detach events via |WtsTerminalObserer|.
34 // TODO(alexeypa): replace |WtsTerminalObserver| with an interface capable of
35 // monitoring both the console and RDP connections. See http://crbug.com/137696.
36 class DesktopSessionWin 38 class DesktopSessionWin
37 : public DesktopSession, 39 : public DesktopSession,
38 public WorkerProcessIpcDelegate, 40 public WorkerProcessIpcDelegate,
39 public WtsTerminalObserver { 41 public WtsTerminalObserver {
40 public: 42 public:
43 // Creates a desktop session instance that attaches to the physical console.
44 static scoped_ptr<DesktopSession> CreateForConsole(
45 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
46 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
47 DaemonProcess* daemon_process,
48 int id,
49 const DesktopSessionParams& params);
50
51 // Creates a desktop session instance that attaches to a virtual console.
52 static scoped_ptr<DesktopSession> CreateForVirtualTerminal(
53 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
54 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
55 DaemonProcess* daemon_process,
56 int id,
57 const DesktopSessionParams& params);
58
59 protected:
41 // Passes the owning |daemon_process|, a unique identifier of the desktop 60 // Passes the owning |daemon_process|, a unique identifier of the desktop
42 // session |id| and the interface for monitoring console session attach/detach 61 // session |id| and the interface for monitoring session attach/detach events.
43 // events. Both |daemon_process| and |monitor| must outlive |this|. 62 // Both |daemon_process| and |monitor| must outlive |this|.
44 DesktopSessionWin( 63 DesktopSessionWin(
45 scoped_refptr<AutoThreadTaskRunner> main_task_runner, 64 scoped_refptr<AutoThreadTaskRunner> caller_task_runner,
46 scoped_refptr<AutoThreadTaskRunner> io_task_runner, 65 scoped_refptr<AutoThreadTaskRunner> io_task_runner,
47 DaemonProcess* daemon_process, 66 DaemonProcess* daemon_process,
48 int id, 67 int id,
49 const DesktopSessionParams& params,
50 bool virtual_terminal,
51 WtsTerminalMonitor* monitor); 68 WtsTerminalMonitor* monitor);
52 virtual ~DesktopSessionWin(); 69 virtual ~DesktopSessionWin();
53 70
71 const scoped_refptr<AutoThreadTaskRunner>& caller_task_runner() const {
72 return caller_task_runner_;
73 }
74
75 // Called when |session_attach_timer_| expires.
76 void OnSessionAttachTimeout();
77
78 // Starts monitoring for session attach/detach events for |client_endpoint|.
79 void StartMonitoring(const net::IPEndPoint& client_endpoint);
80
81 // Stops monitoring for session attach/detach events.
82 void StopMonitoring();
83
84 // Injects a secure attention sequence into the session.
85 virtual void InjectSas() = 0;
86
54 // WorkerProcessIpcDelegate implementation. 87 // WorkerProcessIpcDelegate implementation.
55 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; 88 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 89 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
57 virtual void OnPermanentError() OVERRIDE; 90 virtual void OnPermanentError() OVERRIDE;
58 91
59 // WtsTerminalObserver implementation. 92 // WtsTerminalObserver implementation.
60 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; 93 virtual void OnSessionAttached(uint32 session_id) OVERRIDE;
61 virtual void OnSessionDetached() OVERRIDE; 94 virtual void OnSessionDetached() OVERRIDE;
62 95
63 private: 96 private:
64 // ChromotingDesktopDaemonMsg_DesktopAttached handler. 97 // ChromotingDesktopDaemonMsg_DesktopAttached handler.
65 void OnDesktopSessionAgentAttached(IPC::PlatformFileForTransit desktop_pipe); 98 void OnDesktopSessionAgentAttached(IPC::PlatformFileForTransit desktop_pipe);
66 99
67 // ChromotingDesktopDaemonMsg_InjectSas handler.
68 void OnInjectSas();
69
70 // Requests the desktop process to crash. 100 // Requests the desktop process to crash.
71 void CrashDesktopProcess(const tracked_objects::Location& location); 101 void CrashDesktopProcess(const tracked_objects::Location& location);
72 102
73 // Task runner on which public methods of this class should be called. 103 // Task runner on which public methods of this class should be called.
74 scoped_refptr<AutoThreadTaskRunner> main_task_runner_; 104 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_;
75 105
76 // Message loop used by the IPC channel. 106 // Message loop used by the IPC channel.
77 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; 107 scoped_refptr<AutoThreadTaskRunner> io_task_runner_;
78 108
79 // Contains the full path to the desktop binary. 109 // Handle of the desktop process (running an instance of DesktopSessionAgent).
80 base::FilePath desktop_binary_;
81
82 // Handle of the desktop process.
83 base::win::ScopedHandle desktop_process_; 110 base::win::ScopedHandle desktop_process_;
84 111
85 // Launches and monitors the desktop process. 112 // Launches and monitors the desktop process.
86 scoped_ptr<WorkerProcessLauncher> launcher_; 113 scoped_ptr<WorkerProcessLauncher> launcher_;
87 114
88 // Pointer used to unsubscribe from session attach and detach events. 115 // Used to unsubscribe from session attach and detach events.
89 WtsTerminalMonitor* monitor_; 116 WtsTerminalMonitor* monitor_;
90 117
91 scoped_ptr<SasInjector> sas_injector_; 118 // True if |this| is subsribed to receive session attach/detach notifications.
119 bool monitoring_notifications_;
120
121 // Used to report an error if the session attach notification does not arrives
122 // for too long.
123 base::OneShotTimer<DesktopSessionWin> session_attach_timer_;
92 124
93 DISALLOW_COPY_AND_ASSIGN(DesktopSessionWin); 125 DISALLOW_COPY_AND_ASSIGN(DesktopSessionWin);
94 }; 126 };
95 127
96 } // namespace remoting 128 } // namespace remoting
97 129
98 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_ 130 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_
OLDNEW
« no previous file with comments | « remoting/host/daemon_process_win.cc ('k') | remoting/host/desktop_session_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698