| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 14 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 15 #include "base/win/scoped_handle.h" | 16 #include "base/win/scoped_handle.h" |
| 16 #include "ipc/ipc_platform_file.h" | 17 #include "ipc/ipc_platform_file.h" |
| 17 #include "remoting/host/desktop_session.h" | 18 #include "remoting/host/desktop_session.h" |
| 18 #include "remoting/host/win/wts_terminal_observer.h" | 19 #include "remoting/host/win/wts_terminal_observer.h" |
| 19 #include "remoting/host/worker_process_ipc_delegate.h" | 20 #include "remoting/host/worker_process_ipc_delegate.h" |
| 20 | 21 |
| 21 namespace tracked_objects { | 22 namespace tracked_objects { |
| 22 class Location; | 23 class Location; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 34 // DesktopSession implementation which attaches to either physical or virtual | 35 // DesktopSession implementation which attaches to either physical or virtual |
| 35 // (RDP) console. Receives IPC messages from the desktop process, running in | 36 // (RDP) console. Receives IPC messages from the desktop process, running in |
| 36 // the target session, via |WorkerProcessIpcDelegate|, and monitors session | 37 // the target session, via |WorkerProcessIpcDelegate|, and monitors session |
| 37 // attach/detach events via |WtsTerminalObserer|. | 38 // attach/detach events via |WtsTerminalObserer|. |
| 38 class DesktopSessionWin | 39 class DesktopSessionWin |
| 39 : public DesktopSession, | 40 : public DesktopSession, |
| 40 public WorkerProcessIpcDelegate, | 41 public WorkerProcessIpcDelegate, |
| 41 public WtsTerminalObserver { | 42 public WtsTerminalObserver { |
| 42 public: | 43 public: |
| 43 // Creates a desktop session instance that attaches to the physical console. | 44 // Creates a desktop session instance that attaches to the physical console. |
| 44 static scoped_ptr<DesktopSession> CreateForConsole( | 45 static std::unique_ptr<DesktopSession> CreateForConsole( |
| 45 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 46 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 46 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 47 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 47 DaemonProcess* daemon_process, | 48 DaemonProcess* daemon_process, |
| 48 int id, | 49 int id, |
| 49 const ScreenResolution& resolution); | 50 const ScreenResolution& resolution); |
| 50 | 51 |
| 51 // Creates a desktop session instance that attaches to a virtual console. | 52 // Creates a desktop session instance that attaches to a virtual console. |
| 52 static scoped_ptr<DesktopSession> CreateForVirtualTerminal( | 53 static std::unique_ptr<DesktopSession> CreateForVirtualTerminal( |
| 53 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 54 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 54 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 55 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 55 DaemonProcess* daemon_process, | 56 DaemonProcess* daemon_process, |
| 56 int id, | 57 int id, |
| 57 const ScreenResolution& resolution); | 58 const ScreenResolution& resolution); |
| 58 | 59 |
| 59 protected: | 60 protected: |
| 60 // Passes the owning |daemon_process|, a unique identifier of the desktop | 61 // Passes the owning |daemon_process|, a unique identifier of the desktop |
| 61 // session |id| and the interface for monitoring session attach/detach events. | 62 // session |id| and the interface for monitoring session attach/detach events. |
| 62 // Both |daemon_process| and |monitor| must outlive |this|. | 63 // Both |daemon_process| and |monitor| must outlive |this|. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Task runner on which public methods of this class should be called. | 110 // Task runner on which public methods of this class should be called. |
| 110 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; | 111 scoped_refptr<AutoThreadTaskRunner> caller_task_runner_; |
| 111 | 112 |
| 112 // Message loop used by the IPC channel. | 113 // Message loop used by the IPC channel. |
| 113 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; | 114 scoped_refptr<AutoThreadTaskRunner> io_task_runner_; |
| 114 | 115 |
| 115 // Handle of the desktop process (running an instance of DesktopSessionAgent). | 116 // Handle of the desktop process (running an instance of DesktopSessionAgent). |
| 116 base::win::ScopedHandle desktop_process_; | 117 base::win::ScopedHandle desktop_process_; |
| 117 | 118 |
| 118 // Launches and monitors the desktop process. | 119 // Launches and monitors the desktop process. |
| 119 scoped_ptr<WorkerProcessLauncher> launcher_; | 120 std::unique_ptr<WorkerProcessLauncher> launcher_; |
| 120 | 121 |
| 121 // Used to unsubscribe from session attach and detach events. | 122 // Used to unsubscribe from session attach and detach events. |
| 122 WtsTerminalMonitor* monitor_; | 123 WtsTerminalMonitor* monitor_; |
| 123 | 124 |
| 124 // True if |this| is subsribed to receive session attach/detach notifications. | 125 // True if |this| is subsribed to receive session attach/detach notifications. |
| 125 bool monitoring_notifications_; | 126 bool monitoring_notifications_; |
| 126 | 127 |
| 127 // Used to report an error if the session attach notification does not arrives | 128 // Used to report an error if the session attach notification does not arrives |
| 128 // for too long. | 129 // for too long. |
| 129 base::OneShotTimer session_attach_timer_; | 130 base::OneShotTimer session_attach_timer_; |
| 130 | 131 |
| 131 base::Time last_timestamp_; | 132 base::Time last_timestamp_; |
| 132 | 133 |
| 133 DISALLOW_COPY_AND_ASSIGN(DesktopSessionWin); | 134 DISALLOW_COPY_AND_ASSIGN(DesktopSessionWin); |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 } // namespace remoting | 137 } // namespace remoting |
| 137 | 138 |
| 138 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_ | 139 #endif // REMOTING_HOST_DESKTOP_SESSION_WIN_H_ |
| OLD | NEW |