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