| 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_CLIENT_SESSION_H_ | 5 #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
| 6 #define REMOTING_HOST_CLIENT_SESSION_H_ | 6 #define REMOTING_HOST_CLIENT_SESSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/scoped_vector.h" | |
| 12 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 13 #include "base/sequenced_task_runner_helpers.h" | 12 #include "base/sequenced_task_runner_helpers.h" |
| 14 #include "base/threading/non_thread_safe.h" | 13 #include "base/threading/non_thread_safe.h" |
| 15 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 16 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 17 #include "remoting/host/client_session_control.h" | 16 #include "remoting/host/client_session_control.h" |
| 18 #include "remoting/host/gnubby_auth_handler.h" | 17 #include "remoting/host/gnubby_auth_handler.h" |
| 19 #include "remoting/host/host_extension.h" | |
| 20 #include "remoting/host/host_extension_session.h" | |
| 21 #include "remoting/host/mouse_clamping_filter.h" | 18 #include "remoting/host/mouse_clamping_filter.h" |
| 22 #include "remoting/host/remote_input_filter.h" | 19 #include "remoting/host/remote_input_filter.h" |
| 23 #include "remoting/protocol/clipboard_echo_filter.h" | 20 #include "remoting/protocol/clipboard_echo_filter.h" |
| 24 #include "remoting/protocol/clipboard_filter.h" | 21 #include "remoting/protocol/clipboard_filter.h" |
| 25 #include "remoting/protocol/clipboard_stub.h" | 22 #include "remoting/protocol/clipboard_stub.h" |
| 26 #include "remoting/protocol/connection_to_client.h" | 23 #include "remoting/protocol/connection_to_client.h" |
| 27 #include "remoting/protocol/host_stub.h" | 24 #include "remoting/protocol/host_stub.h" |
| 28 #include "remoting/protocol/input_event_tracker.h" | 25 #include "remoting/protocol/input_event_tracker.h" |
| 29 #include "remoting/protocol/input_filter.h" | 26 #include "remoting/protocol/input_filter.h" |
| 30 #include "remoting/protocol/input_stub.h" | 27 #include "remoting/protocol/input_stub.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 60 // Called after authentication has started. | 57 // Called after authentication has started. |
| 61 virtual void OnSessionAuthenticating(ClientSession* client) = 0; | 58 virtual void OnSessionAuthenticating(ClientSession* client) = 0; |
| 62 | 59 |
| 63 // Called after authentication has finished successfully. Returns true if | 60 // Called after authentication has finished successfully. Returns true if |
| 64 // the connection is allowed, or false otherwise. | 61 // the connection is allowed, or false otherwise. |
| 65 virtual bool OnSessionAuthenticated(ClientSession* client) = 0; | 62 virtual bool OnSessionAuthenticated(ClientSession* client) = 0; |
| 66 | 63 |
| 67 // Called after we've finished connecting all channels. | 64 // Called after we've finished connecting all channels. |
| 68 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; | 65 virtual void OnSessionChannelsConnected(ClientSession* client) = 0; |
| 69 | 66 |
| 70 // Called after client has reported capabilities. | |
| 71 virtual void OnSessionClientCapabilities(ClientSession* client) = 0; | |
| 72 | |
| 73 // Called after authentication has failed. Must not tear down this | 67 // Called after authentication has failed. Must not tear down this |
| 74 // object. OnSessionClosed() is notified after this handler | 68 // object. OnSessionClosed() is notified after this handler |
| 75 // returns. | 69 // returns. |
| 76 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; | 70 virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
| 77 | 71 |
| 78 // Called after connection has failed or after the client closed it. | 72 // Called after connection has failed or after the client closed it. |
| 79 virtual void OnSessionClosed(ClientSession* client) = 0; | 73 virtual void OnSessionClosed(ClientSession* client) = 0; |
| 80 | 74 |
| 81 // Called to notify of each message's sequence number. The | 75 // Called to notify of each message's sequence number. The |
| 82 // callback must not tear down this object. | 76 // callback must not tear down this object. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 102 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 96 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 103 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 97 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
| 104 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 98 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 105 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 106 scoped_ptr<protocol::ConnectionToClient> connection, | 100 scoped_ptr<protocol::ConnectionToClient> connection, |
| 107 DesktopEnvironmentFactory* desktop_environment_factory, | 101 DesktopEnvironmentFactory* desktop_environment_factory, |
| 108 const base::TimeDelta& max_duration, | 102 const base::TimeDelta& max_duration, |
| 109 scoped_refptr<protocol::PairingRegistry> pairing_registry); | 103 scoped_refptr<protocol::PairingRegistry> pairing_registry); |
| 110 virtual ~ClientSession(); | 104 virtual ~ClientSession(); |
| 111 | 105 |
| 112 // Adds an extension to client to handle extension messages. | |
| 113 void AddExtensionSession(scoped_ptr<HostExtensionSession> extension_session); | |
| 114 | |
| 115 // Adds extended capabilities to advertise to the client, e.g. those | |
| 116 // implemented by |DesktopEnvironment| or |HostExtension|s. | |
| 117 void AddHostCapabilities(const std::string& capability); | |
| 118 | |
| 119 // protocol::HostStub interface. | 106 // protocol::HostStub interface. |
| 120 virtual void NotifyClientResolution( | 107 virtual void NotifyClientResolution( |
| 121 const protocol::ClientResolution& resolution) OVERRIDE; | 108 const protocol::ClientResolution& resolution) OVERRIDE; |
| 122 virtual void ControlVideo( | 109 virtual void ControlVideo( |
| 123 const protocol::VideoControl& video_control) OVERRIDE; | 110 const protocol::VideoControl& video_control) OVERRIDE; |
| 124 virtual void ControlAudio( | 111 virtual void ControlAudio( |
| 125 const protocol::AudioControl& audio_control) OVERRIDE; | 112 const protocol::AudioControl& audio_control) OVERRIDE; |
| 126 virtual void SetCapabilities( | 113 virtual void SetCapabilities( |
| 127 const protocol::Capabilities& capabilities) OVERRIDE; | 114 const protocol::Capabilities& capabilities) OVERRIDE; |
| 128 virtual void RequestPairing( | 115 virtual void RequestPairing( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 154 virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; | 141 virtual void SetDisableInputs(bool disable_inputs) OVERRIDE; |
| 155 | 142 |
| 156 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); | 143 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); |
| 157 | 144 |
| 158 protocol::ConnectionToClient* connection() const { | 145 protocol::ConnectionToClient* connection() const { |
| 159 return connection_.get(); | 146 return connection_.get(); |
| 160 } | 147 } |
| 161 | 148 |
| 162 bool is_authenticated() { return auth_input_filter_.enabled(); } | 149 bool is_authenticated() { return auth_input_filter_.enabled(); } |
| 163 | 150 |
| 164 const std::string* client_capabilities() const { | |
| 165 return client_capabilities_.get(); | |
| 166 } | |
| 167 | |
| 168 private: | 151 private: |
| 169 typedef ScopedVector<HostExtensionSession> HostExtensionSessionList; | |
| 170 | |
| 171 // Creates a proxy for sending clipboard events to the client. | 152 // Creates a proxy for sending clipboard events to the client. |
| 172 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); | 153 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
| 173 | 154 |
| 174 // Creates an audio encoder for the specified configuration. | 155 // Creates an audio encoder for the specified configuration. |
| 175 static scoped_ptr<AudioEncoder> CreateAudioEncoder( | 156 static scoped_ptr<AudioEncoder> CreateAudioEncoder( |
| 176 const protocol::SessionConfig& config); | 157 const protocol::SessionConfig& config); |
| 177 | 158 |
| 178 // Creates a video encoder for the specified configuration. | 159 // Creates a video encoder for the specified configuration. |
| 179 static scoped_ptr<VideoEncoder> CreateVideoEncoder( | 160 static scoped_ptr<VideoEncoder> CreateVideoEncoder( |
| 180 const protocol::SessionConfig& config); | 161 const protocol::SessionConfig& config); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 237 |
| 257 // Used to apply client-requested changes in screen resolution. | 238 // Used to apply client-requested changes in screen resolution. |
| 258 scoped_ptr<ScreenControls> screen_controls_; | 239 scoped_ptr<ScreenControls> screen_controls_; |
| 259 | 240 |
| 260 // The pairing registry for PIN-less authentication. | 241 // The pairing registry for PIN-less authentication. |
| 261 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 242 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
| 262 | 243 |
| 263 // Used to proxy gnubby auth traffic. | 244 // Used to proxy gnubby auth traffic. |
| 264 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; | 245 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; |
| 265 | 246 |
| 266 // Host extension sessions, used to handle extension messages. | |
| 267 HostExtensionSessionList extension_sessions_; | |
| 268 | |
| 269 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 247 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 270 }; | 248 }; |
| 271 | 249 |
| 272 } // namespace remoting | 250 } // namespace remoting |
| 273 | 251 |
| 274 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 252 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |