OLD | NEW |
---|---|
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" |
11 #include "base/win/scoped_handle.h" | |
12 #include "ipc/ipc_platform_file.h" | |
13 #include "remoting/host/desktop_session.h" | |
14 #include "remoting/host/win/wts_terminal_observer.h" | |
15 #include "remoting/host/worker_process_ipc_delegate.h" | |
16 | |
17 namespace tracked_objects { | |
18 class Location; | |
19 } // namespace tracked_objects | |
20 | 10 |
21 namespace remoting { | 11 namespace remoting { |
22 | 12 |
23 class AutoThreadTaskRunner; | 13 class AutoThreadTaskRunner; |
24 class DaemonProcess; | 14 class DaemonProcess; |
15 class DesktopSession; | |
25 struct DesktopSessionParams; | 16 struct DesktopSessionParams; |
26 class SasInjector; | |
27 class WorkerProcessLauncher; | |
28 class WtsTerminalMonitor; | |
29 | 17 |
30 // DesktopSession implementation which attaches to the host's physical console. | 18 // Creates a desktop session instance. |
31 // Receives IPC messages from the desktop process, running in the console | 19 scoped_ptr<DesktopSession> CreateDesktopSessionWin( |
32 // session, via |WorkerProcessIpcDelegate|, and monitors console session | 20 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
Wez
2013/03/12 01:21:11
I think it's cleaner to keep separate CreateForCon
alexeypa (please no reviews)
2013/03/12 20:21:15
Done.
| |
33 // attach/detach events via |WtsConsoleObserer|. | |
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 | |
37 : public DesktopSession, | |
38 public WorkerProcessIpcDelegate, | |
39 public WtsTerminalObserver { | |
40 public: | |
41 // Passes the owning |daemon_process|, a unique identifier of the desktop | |
42 // session |id| and the interface for monitoring console session attach/detach | |
43 // events. Both |daemon_process| and |monitor| must outlive |this|. | |
44 DesktopSessionWin( | |
45 scoped_refptr<AutoThreadTaskRunner> main_task_runner, | |
46 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 21 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
47 DaemonProcess* daemon_process, | 22 DaemonProcess* daemon_process, |
48 int id, | 23 int id, |
49 const DesktopSessionParams& params, | 24 const DesktopSessionParams& params, |
50 bool virtual_terminal, | 25 bool virtual_terminal); |
51 WtsTerminalMonitor* monitor); | |
52 virtual ~DesktopSessionWin(); | |
53 | |
54 // WorkerProcessIpcDelegate implementation. | |
55 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | |
56 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
57 virtual void OnPermanentError() OVERRIDE; | |
58 | |
59 // WtsTerminalObserver implementation. | |
60 virtual void OnSessionAttached(uint32 session_id) OVERRIDE; | |
61 virtual void OnSessionDetached() OVERRIDE; | |
62 | |
63 private: | |
64 // ChromotingDesktopDaemonMsg_DesktopAttached handler. | |
65 void OnDesktopSessionAgentAttached(IPC::PlatformFileForTransit desktop_pipe); | |
66 | |
67 // ChromotingDesktopDaemonMsg_InjectSas handler. | |
68 void OnInjectSas(); | |
69 | |
70 // Restarts the desktop process. | |
71 void RestartDesktopProcess(const tracked_objects::Location& location); | |
72 | |
73 // Task runner on which public methods of this class should be called. | |
74 scoped_refptr<AutoThreadTaskRunner> main_task_runner_; | |
75 | |
76 // Message loop used by the IPC channel. | |
77 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | |
78 | |
79 // Contains the full path to the desktop binary. | |
80 base::FilePath desktop_binary_; | |
81 | |
82 // Handle of the desktop process. | |
83 base::win::ScopedHandle desktop_process_; | |
84 | |
85 // Launches and monitors the desktop process. | |
86 scoped_ptr<WorkerProcessLauncher> launcher_; | |
87 | |
88 // Pointer used to unsubscribe from session attach and detach events. | |
89 WtsTerminalMonitor* monitor_; | |
90 | |
91 scoped_ptr<SasInjector> sas_injector_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(DesktopSessionWin); | |
94 }; | |
95 | 26 |
96 } // namespace remoting | 27 } // namespace remoting |
97 | 28 |
98 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_ | 29 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_ |
OLD | NEW |