| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> |
| 11 | 12 |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/shared_memory_handle.h" | 15 #include "base/memory/shared_memory_handle.h" |
| 16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 17 #include "base/process/process.h" | 17 #include "base/process/process.h" |
| 18 #include "base/sequenced_task_runner_helpers.h" | 18 #include "base/sequenced_task_runner_helpers.h" |
| 19 #include "ipc/ipc_listener.h" | 19 #include "ipc/ipc_listener.h" |
| 20 #include "ipc/ipc_platform_file.h" | 20 #include "ipc/ipc_platform_file.h" |
| 21 #include "remoting/host/audio_capturer.h" | 21 #include "remoting/host/audio_capturer.h" |
| 22 #include "remoting/host/desktop_environment.h" | 22 #include "remoting/host/desktop_environment.h" |
| 23 #include "remoting/host/screen_resolution.h" | 23 #include "remoting/host/screen_resolution.h" |
| 24 #include "remoting/proto/event.pb.h" | 24 #include "remoting/proto/event.pb.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 DesktopSessionProxy( | 75 DesktopSessionProxy( |
| 76 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 76 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, |
| 77 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 77 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
| 78 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 78 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 79 base::WeakPtr<ClientSessionControl> client_session_control, | 79 base::WeakPtr<ClientSessionControl> client_session_control, |
| 80 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 80 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, |
| 81 bool virtual_terminal, | 81 bool virtual_terminal, |
| 82 bool supports_touch_events); | 82 bool supports_touch_events); |
| 83 | 83 |
| 84 // Mirrors DesktopEnvironment. | 84 // Mirrors DesktopEnvironment. |
| 85 scoped_ptr<AudioCapturer> CreateAudioCapturer(); | 85 std::unique_ptr<AudioCapturer> CreateAudioCapturer(); |
| 86 scoped_ptr<InputInjector> CreateInputInjector(); | 86 std::unique_ptr<InputInjector> CreateInputInjector(); |
| 87 scoped_ptr<ScreenControls> CreateScreenControls(); | 87 std::unique_ptr<ScreenControls> CreateScreenControls(); |
| 88 scoped_ptr<webrtc::DesktopCapturer> CreateVideoCapturer(); | 88 std::unique_ptr<webrtc::DesktopCapturer> CreateVideoCapturer(); |
| 89 scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor(); | 89 std::unique_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor(); |
| 90 std::string GetCapabilities() const; | 90 std::string GetCapabilities() const; |
| 91 void SetCapabilities(const std::string& capabilities); | 91 void SetCapabilities(const std::string& capabilities); |
| 92 | 92 |
| 93 // IPC::Listener implementation. | 93 // IPC::Listener implementation. |
| 94 bool OnMessageReceived(const IPC::Message& message) override; | 94 bool OnMessageReceived(const IPC::Message& message) override; |
| 95 void OnChannelConnected(int32_t peer_pid) override; | 95 void OnChannelConnected(int32_t peer_pid) override; |
| 96 void OnChannelError() override; | 96 void OnChannelError() override; |
| 97 | 97 |
| 98 // Connects to the desktop session agent. | 98 // Connects to the desktop session agent. |
| 99 bool AttachToDesktop(base::Process desktop_process, | 99 bool AttachToDesktop(base::Process desktop_process, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 123 // Called on the |video_capture_task_runner_| thread. | 123 // Called on the |video_capture_task_runner_| thread. |
| 124 void SetMouseCursorMonitor( | 124 void SetMouseCursorMonitor( |
| 125 const base::WeakPtr<IpcMouseCursorMonitor>& mouse_cursor_monitor); | 125 const base::WeakPtr<IpcMouseCursorMonitor>& mouse_cursor_monitor); |
| 126 | 126 |
| 127 // APIs used to implement the InputInjector interface. | 127 // APIs used to implement the InputInjector interface. |
| 128 void InjectClipboardEvent(const protocol::ClipboardEvent& event); | 128 void InjectClipboardEvent(const protocol::ClipboardEvent& event); |
| 129 void InjectKeyEvent(const protocol::KeyEvent& event); | 129 void InjectKeyEvent(const protocol::KeyEvent& event); |
| 130 void InjectTextEvent(const protocol::TextEvent& event); | 130 void InjectTextEvent(const protocol::TextEvent& event); |
| 131 void InjectMouseEvent(const protocol::MouseEvent& event); | 131 void InjectMouseEvent(const protocol::MouseEvent& event); |
| 132 void InjectTouchEvent(const protocol::TouchEvent& event); | 132 void InjectTouchEvent(const protocol::TouchEvent& event); |
| 133 void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); | 133 void StartInputInjector( |
| 134 std::unique_ptr<protocol::ClipboardStub> client_clipboard); |
| 134 | 135 |
| 135 // API used to implement the SessionController interface. | 136 // API used to implement the SessionController interface. |
| 136 void SetScreenResolution(const ScreenResolution& resolution); | 137 void SetScreenResolution(const ScreenResolution& resolution); |
| 137 | 138 |
| 138 private: | 139 private: |
| 139 friend class base::DeleteHelper<DesktopSessionProxy>; | 140 friend class base::DeleteHelper<DesktopSessionProxy>; |
| 140 friend struct DesktopSessionProxyTraits; | 141 friend struct DesktopSessionProxyTraits; |
| 141 | 142 |
| 142 class IpcSharedBufferCore; | 143 class IpcSharedBufferCore; |
| 143 class IpcSharedBuffer; | 144 class IpcSharedBuffer; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // |caller_task_runner_|. | 179 // |caller_task_runner_|. |
| 179 // - background I/O is served on |io_task_runner_|. | 180 // - background I/O is served on |io_task_runner_|. |
| 180 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_; | 181 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner_; |
| 181 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; | 182 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner_; |
| 182 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 183 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 183 | 184 |
| 184 // Points to the audio capturer receiving captured audio packets. | 185 // Points to the audio capturer receiving captured audio packets. |
| 185 base::WeakPtr<IpcAudioCapturer> audio_capturer_; | 186 base::WeakPtr<IpcAudioCapturer> audio_capturer_; |
| 186 | 187 |
| 187 // Points to the client stub passed to StartInputInjector(). | 188 // Points to the client stub passed to StartInputInjector(). |
| 188 scoped_ptr<protocol::ClipboardStub> client_clipboard_; | 189 std::unique_ptr<protocol::ClipboardStub> client_clipboard_; |
| 189 | 190 |
| 190 // Used to disconnect the client session. | 191 // Used to disconnect the client session. |
| 191 base::WeakPtr<ClientSessionControl> client_session_control_; | 192 base::WeakPtr<ClientSessionControl> client_session_control_; |
| 192 | 193 |
| 193 // Used to create a desktop session and receive notifications every time | 194 // Used to create a desktop session and receive notifications every time |
| 194 // the desktop process is replaced. | 195 // the desktop process is replaced. |
| 195 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; | 196 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; |
| 196 | 197 |
| 197 // Points to the video capturer receiving captured video frames. | 198 // Points to the video capturer receiving captured video frames. |
| 198 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; | 199 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; |
| 199 | 200 |
| 200 // Points to the mouse cursor monitor receiving mouse cursor changes. | 201 // Points to the mouse cursor monitor receiving mouse cursor changes. |
| 201 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; | 202 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; |
| 202 | 203 |
| 203 // IPC channel to the desktop session agent. | 204 // IPC channel to the desktop session agent. |
| 204 scoped_ptr<IPC::ChannelProxy> desktop_channel_; | 205 std::unique_ptr<IPC::ChannelProxy> desktop_channel_; |
| 205 | 206 |
| 206 // Handle of the desktop process. | 207 // Handle of the desktop process. |
| 207 base::Process desktop_process_; | 208 base::Process desktop_process_; |
| 208 | 209 |
| 209 int pending_capture_frame_requests_; | 210 int pending_capture_frame_requests_; |
| 210 | 211 |
| 211 // Shared memory buffers by Id. Each buffer is owned by the corresponding | 212 // Shared memory buffers by Id. Each buffer is owned by the corresponding |
| 212 // frame. | 213 // frame. |
| 213 SharedBuffers shared_buffers_; | 214 SharedBuffers shared_buffers_; |
| 214 | 215 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 228 }; | 229 }; |
| 229 | 230 |
| 230 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 231 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
| 231 struct DesktopSessionProxyTraits { | 232 struct DesktopSessionProxyTraits { |
| 232 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 233 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
| 233 }; | 234 }; |
| 234 | 235 |
| 235 } // namespace remoting | 236 } // namespace remoting |
| 236 | 237 |
| 237 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 238 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
| OLD | NEW |