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