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 20 matching lines...) Expand all Loading... |
31 namespace IPC { | 31 namespace IPC { |
32 class ChannelProxy; | 32 class ChannelProxy; |
33 class Message; | 33 class Message; |
34 } // namespace IPC | 34 } // namespace IPC |
35 | 35 |
36 struct SerializedCapturedData; | 36 struct SerializedCapturedData; |
37 | 37 |
38 namespace remoting { | 38 namespace remoting { |
39 | 39 |
40 class AudioPacket; | 40 class AudioPacket; |
| 41 class Capabilities; |
41 class ClientSession; | 42 class ClientSession; |
42 class ClientSessionControl; | 43 class ClientSessionControl; |
43 class DesktopSessionConnector; | 44 class DesktopSessionConnector; |
44 struct DesktopSessionProxyTraits; | 45 struct DesktopSessionProxyTraits; |
45 class IpcAudioCapturer; | 46 class IpcAudioCapturer; |
46 class IpcVideoFrameCapturer; | 47 class IpcVideoFrameCapturer; |
47 class ScreenControls; | 48 class ScreenControls; |
48 | 49 |
49 // DesktopSessionProxy is created by an owning DesktopEnvironment to route | 50 // DesktopSessionProxy is created by an owning DesktopEnvironment to route |
50 // requests from stubs to the DesktopSessionAgent instance through | 51 // requests from stubs to the DesktopSessionAgent instance through |
(...skipping 12 matching lines...) Expand all Loading... |
63 class DesktopSessionProxy | 64 class DesktopSessionProxy |
64 : public base::RefCountedThreadSafe<DesktopSessionProxy, | 65 : public base::RefCountedThreadSafe<DesktopSessionProxy, |
65 DesktopSessionProxyTraits>, | 66 DesktopSessionProxyTraits>, |
66 public IPC::Listener { | 67 public IPC::Listener { |
67 public: | 68 public: |
68 DesktopSessionProxy( | 69 DesktopSessionProxy( |
69 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, | 70 scoped_refptr<base::SingleThreadTaskRunner> audio_capture_task_runner, |
70 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, | 71 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner, |
71 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 72 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
72 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 73 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
73 base::WeakPtr<ClientSessionControl> client_session_control); | 74 base::WeakPtr<ClientSessionControl> client_session_control, |
| 75 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, |
| 76 bool virtual_terminal); |
74 | 77 |
75 // Mirrors DesktopEnvironment. | 78 // Mirrors DesktopEnvironment. |
76 scoped_ptr<AudioCapturer> CreateAudioCapturer(); | 79 scoped_ptr<AudioCapturer> CreateAudioCapturer(); |
77 scoped_ptr<InputInjector> CreateInputInjector(); | 80 scoped_ptr<InputInjector> CreateInputInjector(); |
78 scoped_ptr<ScreenControls> CreateScreenControls(); | 81 scoped_ptr<ScreenControls> CreateScreenControls(); |
79 scoped_ptr<media::ScreenCapturer> CreateVideoCapturer(); | 82 scoped_ptr<media::ScreenCapturer> CreateVideoCapturer(); |
| 83 Capabilities GetCapabilities() const; |
| 84 void SetCapabilities(const Capabilities& capabilities); |
80 | 85 |
81 // IPC::Listener implementation. | 86 // IPC::Listener implementation. |
82 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 87 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
83 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 88 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
84 virtual void OnChannelError() OVERRIDE; | 89 virtual void OnChannelError() OVERRIDE; |
85 | 90 |
86 // Connects to the desktop session agent. | 91 // Connects to the desktop session agent. |
87 bool AttachToDesktop(base::ProcessHandle desktop_process, | 92 bool AttachToDesktop(base::ProcessHandle desktop_process, |
88 IPC::PlatformFileForTransit desktop_pipe); | 93 IPC::PlatformFileForTransit desktop_pipe); |
89 | 94 |
90 // Binds |this| to a desktop session. | |
91 void ConnectToDesktopSession( | |
92 base::WeakPtr<DesktopSessionConnector> desktop_session_connector, | |
93 bool virtual_terminal); | |
94 | |
95 // Closes the connection to the desktop session agent and cleans up | 95 // Closes the connection to the desktop session agent and cleans up |
96 // the associated resources. | 96 // the associated resources. |
97 void DetachFromDesktop(); | 97 void DetachFromDesktop(); |
98 | 98 |
99 // Disconnects the client session that owns |this|. | 99 // Disconnects the client session that owns |this|. |
100 void DisconnectSession(); | 100 void DisconnectSession(); |
101 | 101 |
102 // Stores |audio_capturer| to be used to post captured audio packets. Called | 102 // Stores |audio_capturer| to be used to post captured audio packets. Called |
103 // on the |audio_capture_task_runner_| thread. | 103 // on the |audio_capture_task_runner_| thread. |
104 void SetAudioCapturer(const base::WeakPtr<IpcAudioCapturer>& audio_capturer); | 104 void SetAudioCapturer(const base::WeakPtr<IpcAudioCapturer>& audio_capturer); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 | 176 |
177 // Points to the audio capturer receiving captured audio packets. | 177 // Points to the audio capturer receiving captured audio packets. |
178 base::WeakPtr<IpcAudioCapturer> audio_capturer_; | 178 base::WeakPtr<IpcAudioCapturer> audio_capturer_; |
179 | 179 |
180 // Points to the client stub passed to StartInputInjector(). | 180 // Points to the client stub passed to StartInputInjector(). |
181 scoped_ptr<protocol::ClipboardStub> client_clipboard_; | 181 scoped_ptr<protocol::ClipboardStub> client_clipboard_; |
182 | 182 |
183 // Used to disconnect the client session. | 183 // Used to disconnect the client session. |
184 base::WeakPtr<ClientSessionControl> client_session_control_; | 184 base::WeakPtr<ClientSessionControl> client_session_control_; |
185 | 185 |
186 // Used to bind to a desktop session and receive notifications every time | 186 // Used to create a desktop session and receive notifications every time |
187 // the desktop process is replaced. | 187 // the desktop process is replaced. |
188 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; | 188 base::WeakPtr<DesktopSessionConnector> desktop_session_connector_; |
189 | 189 |
190 // Points to the video capturer receiving captured video frames. | 190 // Points to the video capturer receiving captured video frames. |
191 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; | 191 base::WeakPtr<IpcVideoFrameCapturer> video_capturer_; |
192 | 192 |
193 // IPC channel to the desktop session agent. | 193 // IPC channel to the desktop session agent. |
194 scoped_ptr<IPC::ChannelProxy> desktop_channel_; | 194 scoped_ptr<IPC::ChannelProxy> desktop_channel_; |
195 | 195 |
196 // Handle of the desktop process. | 196 // Handle of the desktop process. |
197 base::ProcessHandle desktop_process_; | 197 base::ProcessHandle desktop_process_; |
198 | 198 |
199 int pending_capture_frame_requests_; | 199 int pending_capture_frame_requests_; |
200 | 200 |
201 typedef std::map<int, scoped_refptr<media::SharedBuffer> > SharedBuffers; | 201 typedef std::map<int, scoped_refptr<media::SharedBuffer> > SharedBuffers; |
202 SharedBuffers shared_buffers_; | 202 SharedBuffers shared_buffers_; |
203 | 203 |
204 // Keeps the desired screen resolution so it can be passed to a newly attached | 204 // Keeps the desired screen resolution so it can be passed to a newly attached |
205 // desktop session agent. | 205 // desktop session agent. |
206 ScreenResolution screen_resolution_; | 206 ScreenResolution screen_resolution_; |
207 | 207 |
| 208 // True if the desktop session has been created already. |
| 209 bool is_desktop_session_created_; |
| 210 |
| 211 bool virtual_terminal_; |
| 212 |
208 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); | 213 DISALLOW_COPY_AND_ASSIGN(DesktopSessionProxy); |
209 }; | 214 }; |
210 | 215 |
211 // Destroys |DesktopSessionProxy| instances on the caller's thread. | 216 // Destroys |DesktopSessionProxy| instances on the caller's thread. |
212 struct DesktopSessionProxyTraits { | 217 struct DesktopSessionProxyTraits { |
213 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); | 218 static void Destruct(const DesktopSessionProxy* desktop_session_proxy); |
214 }; | 219 }; |
215 | 220 |
216 } // namespace remoting | 221 } // namespace remoting |
217 | 222 |
218 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ | 223 #endif // REMOTING_HOST_DESKTOP_SESSION_PROXY_H_ |
OLD | NEW |