| 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_PROXY_H_ | 5 #ifndef REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
| 6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 6 #define REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
| 7 | 7 |
| 8 #include <cstdint> | 8 #include <cstdint> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/shared_memory_handle.h" | 14 #include "base/memory/shared_memory_handle.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 17 #include "base/sequenced_task_runner_helpers.h" | 17 #include "base/sequenced_task_runner_helpers.h" |
| 18 #include "ipc/ipc_channel_handle.h" |
| 18 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
| 19 #include "ipc/ipc_platform_file.h" | |
| 20 #include "remoting/host/audio_capturer.h" | 20 #include "remoting/host/audio_capturer.h" |
| 21 #include "remoting/host/desktop_environment.h" | 21 #include "remoting/host/desktop_environment.h" |
| 22 #include "remoting/host/screen_resolution.h" | 22 #include "remoting/host/screen_resolution.h" |
| 23 #include "remoting/proto/event.pb.h" | 23 #include "remoting/proto/event.pb.h" |
| 24 #include "remoting/protocol/clipboard_stub.h" | 24 #include "remoting/protocol/clipboard_stub.h" |
| 25 #include "remoting/protocol/errors.h" | 25 #include "remoting/protocol/errors.h" |
| 26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" | 26 #include "third_party/webrtc/modules/desktop_capture/screen_capturer.h" |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 class SingleThreadTaskRunner; | 29 class SingleThreadTaskRunner; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor(); | 86 std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor(); |
| 87 std::string GetCapabilities() const; | 87 std::string GetCapabilities() const; |
| 88 void SetCapabilities(const std::string& capabilities); | 88 void SetCapabilities(const std::string& capabilities); |
| 89 | 89 |
| 90 // IPC::Listener implementation. | 90 // IPC::Listener implementation. |
| 91 bool OnMessageReceived(const IPC::Message& message) override; | 91 bool OnMessageReceived(const IPC::Message& message) override; |
| 92 void OnChannelConnected(int32_t peer_pid) override; | 92 void OnChannelConnected(int32_t peer_pid) override; |
| 93 void OnChannelError() override; | 93 void OnChannelError() override; |
| 94 | 94 |
| 95 // Connects to the desktop session agent. | 95 // Connects to the desktop session agent. |
| 96 bool AttachToDesktop(base::Process desktop_process, | 96 bool AttachToDesktop(const IPC::ChannelHandle& desktop_pipe); |
| 97 IPC::PlatformFileForTransit desktop_pipe); | |
| 98 | 97 |
| 99 // Closes the connection to the desktop session agent and cleans up | 98 // Closes the connection to the desktop session agent and cleans up |
| 100 // the associated resources. | 99 // the associated resources. |
| 101 void DetachFromDesktop(); | 100 void DetachFromDesktop(); |
| 102 | 101 |
| 103 // Disconnects the client session that owns |this|. | 102 // Disconnects the client session that owns |this|. |
| 104 void DisconnectSession(protocol::ErrorCode error); | 103 void DisconnectSession(protocol::ErrorCode error); |
| 105 | 104 |
| 106 // Stores |audio_capturer| to be used to post captured audio packets. Called | 105 // Stores |audio_capturer| to be used to post captured audio packets. Called |
| 107 // on the |audio_capture_task_runner_| thread. | 106 // on the |audio_capture_task_runner_| thread. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 196 |
| 198 // Points to the video capturer receiving captured video frames. | 197 // Points to the video capturer receiving captured video frames. |
| 199 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; | 198 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; |
| 200 | 199 |
| 201 // Points to the mouse cursor monitor receiving mouse cursor changes. | 200 // Points to the mouse cursor monitor receiving mouse cursor changes. |
| 202 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; | 201 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; |
| 203 | 202 |
| 204 // IPC channel to the desktop session agent. | 203 // IPC channel to the desktop session agent. |
| 205 std::unique_ptr<IPC::ChannelProxy> desktop_channel_; | 204 std::unique_ptr<IPC::ChannelProxy> desktop_channel_; |
| 206 | 205 |
| 207 // Handle of the desktop process. | |
| 208 base::Process desktop_process_; | |
| 209 | |
| 210 int pending_capture_frame_requests_; | 206 int pending_capture_frame_requests_; |
| 211 | 207 |
| 212 // Shared memory buffers by Id. Each buffer is owned by the corresponding | 208 // Shared memory buffers by Id. Each buffer is owned by the corresponding |
| 213 // frame. | 209 // frame. |
| 214 SharedBuffers shared_buffers_; | 210 SharedBuffers shared_buffers_; |
| 215 | 211 |
| 216 // Keeps the desired screen resolution so it can be passed to a newly attached | 212 // Keeps the desired screen resolution so it can be passed to a newly attached |
| 217 // desktop session agent. | 213 // desktop session agent. |
| 218 ScreenResolution screen_resolution_; | 214 ScreenResolution screen_resolution_; |
| 219 | 215 |
| 220 // True if |this| has been connected to the desktop session. | 216 // True if |this| has been connected to the desktop session. |
| 221 bool is_desktop_session_connected_; | 217 bool is_desktop_session_connected_; |
| 222 | 218 |
| 223 bool virtual_terminal_; | 219 bool virtual_terminal_; |
| 224 | 220 |
| 225 // Stores the session id for the proxied desktop process. | 221 // Stores the session id for the proxied desktop process. |
| 226 uint32_t desktop_session_id_ = UINT32_MAX; | 222 uint32_t desktop_session_id_ = UINT32_MAX; |
| 227 | 223 |
| 228 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); | 224 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); |
| 229 }; | 225 }; |
| 230 | 226 |
| 231 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 227 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
| 232 struct DesktopSessionProxyTraits { | 228 struct DesktopSessionProxyTraits { |
| 233 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 229 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
| 234 }; | 230 }; |
| 235 | 231 |
| 236 } // namespace remoting | 232 } // namespace remoting |
| 237 | 233 |
| 238 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 234 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
| OLD | NEW |