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