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