| 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 <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace base { | 25 namespace base { |
| 26 class SingleThreadTaskRunner; | 26 class SingleThreadTaskRunner; |
| 27 } // namespace base | 27 } // namespace base |
| 28 | 28 |
| 29 namespace IPC { | 29 namespace IPC { |
| 30 class ChannelProxy; | 30 class ChannelProxy; |
| 31 class Message; | 31 class Message; |
| 32 } // namespace IPC | 32 } // namespace IPC |
| 33 | 33 |
| 34 namespace webrtc { | |
| 35 class MouseCursor; | |
| 36 } // namespace webrtc | |
| 37 | |
| 38 struct SerializedDesktopFrame; | 34 struct SerializedDesktopFrame; |
| 39 struct SerializedMouseCursor; | |
| 40 | 35 |
| 41 namespace remoting { | 36 namespace remoting { |
| 42 | 37 |
| 43 class AudioPacket; | 38 class AudioPacket; |
| 44 class ClientSession; | 39 class ClientSession; |
| 45 class ClientSessionControl; | 40 class ClientSessionControl; |
| 46 class DesktopSessionConnector; | 41 class DesktopSessionConnector; |
| 47 struct DesktopSessionProxyTraits; | 42 struct DesktopSessionProxyTraits; |
| 48 class IpcAudioCapturer; | 43 class IpcAudioCapturer; |
| 49 class IpcMouseCursorMonitor; | |
| 50 class IpcVideoFrameCapturer; | 44 class IpcVideoFrameCapturer; |
| 51 class ScreenControls; | 45 class ScreenControls; |
| 52 | 46 |
| 53 // DesktopSessionProxy is created by an owning DesktopEnvironment to route | 47 // DesktopSessionProxy is created by an owning DesktopEnvironment to route |
| 54 // requests from stubs to the DesktopSessionAgent instance through | 48 // requests from stubs to the DesktopSessionAgent instance through |
| 55 // the IPC channel. DesktopSessionProxy is owned both by the DesktopEnvironment | 49 // the IPC channel. DesktopSessionProxy is owned both by the DesktopEnvironment |
| 56 // and the stubs, since stubs can out-live their DesktopEnvironment. | 50 // and the stubs, since stubs can out-live their DesktopEnvironment. |
| 57 // | 51 // |
| 58 // DesktopSessionProxy objects are ref-counted but are always deleted on | 52 // DesktopSessionProxy objects are ref-counted but are always deleted on |
| 59 // the |caller_tast_runner_| thread. This makes it possible to continue | 53 // the |caller_tast_runner_| thread. This makes it possible to continue |
| (...skipping 16 matching lines...) Expand all Loading... |
| 76 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 77 base::WeakPtr<ClientSessionControl> client_session_control, | 71 base::WeakPtr<ClientSessionControl> client_session_control, |
| 78 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | 72 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, |
| 79 bool virtual_terminal); | 73 bool virtual_terminal); |
| 80 | 74 |
| 81 // Mirrors DesktopEnvironment. | 75 // Mirrors DesktopEnvironment. |
| 82 scoped_ptr<AudioCapturer> CreateAudioCapturer(); | 76 scoped_ptr<AudioCapturer> CreateAudioCapturer(); |
| 83 scoped_ptr<InputInjector> CreateInputInjector(); | 77 scoped_ptr<InputInjector> CreateInputInjector(); |
| 84 scoped_ptr<ScreenControls> CreateScreenControls(); | 78 scoped_ptr<ScreenControls> CreateScreenControls(); |
| 85 scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer(); | 79 scoped_ptr<webrtc::ScreenCapturer> CreateVideoCapturer(); |
| 86 scoped_ptr<webrtc::MouseCursorMonitor> CreateMouseCursorMonitor(); | |
| 87 std::string GetCapabilities() const; | 80 std::string GetCapabilities() const; |
| 88 void SetCapabilities(const std::string& capabilities); | 81 void SetCapabilities(const std::string& capabilities); |
| 89 | 82 |
| 90 // IPC::Listener implementation. | 83 // IPC::Listener implementation. |
| 91 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 84 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 92 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 85 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
| 93 virtual void OnChannelError() OVERRIDE; | 86 virtual void OnChannelError() OVERRIDE; |
| 94 | 87 |
| 95 // Connects to the desktop session agent. | 88 // Connects to the desktop session agent. |
| 96 bool AttachToDesktop(base::ProcessHandle desktop_process, | 89 bool AttachToDesktop(base::ProcessHandle desktop_process, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 109 | 102 |
| 110 // APIs used to implement the webrtc::ScreenCapturer interface. These must be | 103 // APIs used to implement the webrtc::ScreenCapturer interface. These must be |
| 111 // called on the |video_capture_task_runner_| thread. | 104 // called on the |video_capture_task_runner_| thread. |
| 112 void CaptureFrame(); | 105 void CaptureFrame(); |
| 113 | 106 |
| 114 // Stores |video_capturer| to be used to post captured video frames. Called on | 107 // Stores |video_capturer| to be used to post captured video frames. Called on |
| 115 // the |video_capture_task_runner_| thread. | 108 // the |video_capture_task_runner_| thread. |
| 116 void SetVideoCapturer( | 109 void SetVideoCapturer( |
| 117 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer); | 110 const base::WeakPtr<IpcVideoFrameCapturer> video_capturer); |
| 118 | 111 |
| 119 // Stores |mouse_cursor_monitor| to be used to post mouse cursor changes. | |
| 120 // Called on the |video_capture_task_runner_| thread. | |
| 121 void SetMouseCursorMonitor( | |
| 122 const base::WeakPtr<IpcMouseCursorMonitor>& mouse_cursor_monitor); | |
| 123 | |
| 124 // APIs used to implement the InputInjector interface. | 112 // APIs used to implement the InputInjector interface. |
| 125 void InjectClipboardEvent(const protocol::ClipboardEvent& event); | 113 void InjectClipboardEvent(const protocol::ClipboardEvent& event); |
| 126 void InjectKeyEvent(const protocol::KeyEvent& event); | 114 void InjectKeyEvent(const protocol::KeyEvent& event); |
| 127 void InjectMouseEvent(const protocol::MouseEvent& event); | 115 void InjectMouseEvent(const protocol::MouseEvent& event); |
| 128 void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); | 116 void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); |
| 129 | 117 |
| 130 // API used to implement the SessionController interface. | 118 // API used to implement the SessionController interface. |
| 131 void SetScreenResolution(const ScreenResolution& resolution); | 119 void SetScreenResolution(const ScreenResolution& resolution); |
| 132 | 120 |
| 133 private: | 121 private: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 150 void OnCreateSharedBuffer(int id, | 138 void OnCreateSharedBuffer(int id, |
| 151 IPC::PlatformFileForTransit handle, | 139 IPC::PlatformFileForTransit handle, |
| 152 uint32 size); | 140 uint32 size); |
| 153 | 141 |
| 154 // Drops a cached reference to the shared buffer. | 142 // Drops a cached reference to the shared buffer. |
| 155 void OnReleaseSharedBuffer(int id); | 143 void OnReleaseSharedBuffer(int id); |
| 156 | 144 |
| 157 // Handles CaptureCompleted notification from the desktop session agent. | 145 // Handles CaptureCompleted notification from the desktop session agent. |
| 158 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); | 146 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); |
| 159 | 147 |
| 160 // Handles MouseCursor notification from the desktop session agent. | 148 // Handles CursorShapeChanged notification from the desktop session agent. |
| 161 void OnMouseCursor(const webrtc::MouseCursor& mouse_cursor); | 149 void OnCursorShapeChanged(const webrtc::MouseCursorShape& cursor_shape); |
| 162 | 150 |
| 163 // Handles InjectClipboardEvent request from the desktop integration process. | 151 // Handles InjectClipboardEvent request from the desktop integration process. |
| 164 void OnInjectClipboardEvent(const std::string& serialized_event); | 152 void OnInjectClipboardEvent(const std::string& serialized_event); |
| 165 | 153 |
| 166 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, | 154 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, |
| 167 // passing |frame|. | 155 // passing |frame|. |
| 168 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); | 156 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
| 169 | 157 |
| 170 // Posts OnMouseCursor() to |mouse_cursor_monitor_| on the video thread, | 158 // Posts OnCursorShapeChanged() to |video_capturer_| on the video thread, |
| 171 // passing |mouse_cursor|. | 159 // passing |cursor_shape|. |
| 172 void PostMouseCursor(scoped_ptr<webrtc::MouseCursor> mouse_cursor); | 160 void PostCursorShape(scoped_ptr<webrtc::MouseCursorShape> cursor_shape); |
| 173 | 161 |
| 174 // Sends a message to the desktop session agent. The message is silently | 162 // Sends a message to the desktop session agent. The message is silently |
| 175 // deleted if the channel is broken. | 163 // deleted if the channel is broken. |
| 176 void SendToDesktop(IPC::Message* message); | 164 void SendToDesktop(IPC::Message* message); |
| 177 | 165 |
| 178 // Task runners: | 166 // Task runners: |
| 179 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. | 167 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. |
| 180 // - public methods of this class (with some exceptions) are called on | 168 // - public methods of this class (with some exceptions) are called on |
| 181 // |caller_task_runner_|. | 169 // |caller_task_runner_|. |
| 182 // - background I/O is served on |io_task_runner_|. | 170 // - background I/O is served on |io_task_runner_|. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 195 // Used to disconnect the client session. | 183 // Used to disconnect the client session. |
| 196 base::WeakPtr<ClientSessionControl> client_session_control_; | 184 base::WeakPtr<ClientSessionControl> client_session_control_; |
| 197 | 185 |
| 198 // Used to create a desktop session and receive notifications every time | 186 // Used to create a desktop session and receive notifications every time |
| 199 // the desktop process is replaced. | 187 // the desktop process is replaced. |
| 200 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; | 188 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; |
| 201 | 189 |
| 202 // Points to the video capturer receiving captured video frames. | 190 // Points to the video capturer receiving captured video frames. |
| 203 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; | 191 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; |
| 204 | 192 |
| 205 // Points to the mouse cursor monitor receiving mouse cursor changes. | |
| 206 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; | |
| 207 | |
| 208 // IPC channel to the desktop session agent. | 193 // IPC channel to the desktop session agent. |
| 209 scoped_ptr<IPC::ChannelProxy> desktop_channel_; | 194 scoped_ptr<IPC::ChannelProxy> desktop_channel_; |
| 210 | 195 |
| 211 // Handle of the desktop process. | 196 // Handle of the desktop process. |
| 212 base::ProcessHandle desktop_process_; | 197 base::ProcessHandle desktop_process_; |
| 213 | 198 |
| 214 int pending_capture_frame_requests_; | 199 int pending_capture_frame_requests_; |
| 215 | 200 |
| 216 // Shared memory buffers by Id. Each buffer is owned by the corresponding | 201 // Shared memory buffers by Id. Each buffer is owned by the corresponding |
| 217 // frame. | 202 // frame. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 230 }; | 215 }; |
| 231 | 216 |
| 232 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 217 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
| 233 struct DesktopSessionProxyTraits { | 218 struct DesktopSessionProxyTraits { |
| 234 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 219 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
| 235 }; | 220 }; |
| 236 | 221 |
| 237 } // namespace remoting | 222 } // namespace remoting |
| 238 | 223 |
| 239 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 224 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
| OLD | NEW |