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 InjectTextEvent(const protocol::TextEvent& event); | 127 void InjectTextEvent(const protocol::TextEvent& event); |
116 void InjectMouseEvent(const protocol::MouseEvent& event); | 128 void InjectMouseEvent(const protocol::MouseEvent& event); |
117 void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); | 129 void StartInputInjector(scoped_ptr<protocol::ClipboardStub> client_clipboard); |
118 | 130 |
119 // API used to implement the SessionController interface. | 131 // API used to implement the SessionController interface. |
120 void SetScreenResolution(const ScreenResolution& resolution); | 132 void SetScreenResolution(const ScreenResolution& resolution); |
121 | 133 |
(...skipping 17 matching lines...) Expand all Loading... |
139 void OnCreateSharedBuffer(int id, | 151 void OnCreateSharedBuffer(int id, |
140 IPC::PlatformFileForTransit handle, | 152 IPC::PlatformFileForTransit handle, |
141 uint32 size); | 153 uint32 size); |
142 | 154 |
143 // Drops a cached reference to the shared buffer. | 155 // Drops a cached reference to the shared buffer. |
144 void OnReleaseSharedBuffer(int id); | 156 void OnReleaseSharedBuffer(int id); |
145 | 157 |
146 // Handles CaptureCompleted notification from the desktop session agent. | 158 // Handles CaptureCompleted notification from the desktop session agent. |
147 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); | 159 void OnCaptureCompleted(const SerializedDesktopFrame& serialized_frame); |
148 | 160 |
149 // Handles CursorShapeChanged notification from the desktop session agent. | 161 // Handles MouseCursor notification from the desktop session agent. |
150 void OnCursorShapeChanged(const webrtc::MouseCursorShape& cursor_shape); | 162 void OnMouseCursor(const webrtc::MouseCursor& mouse_cursor); |
151 | 163 |
152 // Handles InjectClipboardEvent request from the desktop integration process. | 164 // Handles InjectClipboardEvent request from the desktop integration process. |
153 void OnInjectClipboardEvent(const std::string& serialized_event); | 165 void OnInjectClipboardEvent(const std::string& serialized_event); |
154 | 166 |
155 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, | 167 // Posts OnCaptureCompleted() to |video_capturer_| on the video thread, |
156 // passing |frame|. | 168 // passing |frame|. |
157 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); | 169 void PostCaptureCompleted(scoped_ptr<webrtc::DesktopFrame> frame); |
158 | 170 |
159 // Posts OnCursorShapeChanged() to |video_capturer_| on the video thread, | 171 // Posts OnMouseCursor() to |mouse_cursor_monitor_| on the video thread, |
160 // passing |cursor_shape|. | 172 // passing |mouse_cursor|. |
161 void PostCursorShape(scoped_ptr<webrtc::MouseCursorShape> cursor_shape); | 173 void PostMouseCursor(scoped_ptr<webrtc::MouseCursor> mouse_cursor); |
162 | 174 |
163 // Sends a message to the desktop session agent. The message is silently | 175 // Sends a message to the desktop session agent. The message is silently |
164 // deleted if the channel is broken. | 176 // deleted if the channel is broken. |
165 void SendToDesktop(IPC::Message* message); | 177 void SendToDesktop(IPC::Message* message); |
166 | 178 |
167 // Task runners: | 179 // Task runners: |
168 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. | 180 // - |audio_capturer_| is called back on |audio_capture_task_runner_|. |
169 // - public methods of this class (with some exceptions) are called on | 181 // - public methods of this class (with some exceptions) are called on |
170 // |caller_task_runner_|. | 182 // |caller_task_runner_|. |
171 // - background I/O is served on |io_task_runner_|. | 183 // - background I/O is served on |io_task_runner_|. |
(...skipping 12 matching lines...) Expand all Loading... |
184 // Used to disconnect the client session. | 196 // Used to disconnect the client session. |
185 base::WeakPtr<ClientSessionControl> client_session_control_; | 197 base::WeakPtr<ClientSessionControl> client_session_control_; |
186 | 198 |
187 // Used to create a desktop session and receive notifications every time | 199 // Used to create a desktop session and receive notifications every time |
188 // the desktop process is replaced. | 200 // the desktop process is replaced. |
189 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; | 201 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; |
190 | 202 |
191 // Points to the video capturer receiving captured video frames. | 203 // Points to the video capturer receiving captured video frames. |
192 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; | 204 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; |
193 | 205 |
| 206 // Points to the mouse cursor monitor receiving mouse cursor changes. |
| 207 base::WeakPtr<IpcMouseCursorMonitor> mouse_cursor_monitor_; |
| 208 |
194 // IPC channel to the desktop session agent. | 209 // IPC channel to the desktop session agent. |
195 scoped_ptr<IPC::ChannelProxy> desktop_channel_; | 210 scoped_ptr<IPC::ChannelProxy> desktop_channel_; |
196 | 211 |
197 // Handle of the desktop process. | 212 // Handle of the desktop process. |
198 base::ProcessHandle desktop_process_; | 213 base::ProcessHandle desktop_process_; |
199 | 214 |
200 int pending_capture_frame_requests_; | 215 int pending_capture_frame_requests_; |
201 | 216 |
202 // Shared memory buffers by Id. Each buffer is owned by the corresponding | 217 // Shared memory buffers by Id. Each buffer is owned by the corresponding |
203 // frame. | 218 // frame. |
(...skipping 12 matching lines...) Expand all Loading... |
216 }; | 231 }; |
217 | 232 |
218 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 233 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
219 struct DesktopSessionProxyTraits { | 234 struct DesktopSessionProxyTraits { |
220 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 235 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
221 }; | 236 }; |
222 | 237 |
223 } // namespace remoting | 238 } // namespace remoting |
224 | 239 |
225 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 240 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
OLD | NEW |