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" |
| 18 #include "remoting/host/extension.h" | |
| 19 #include "remoting/host/extension_session.h" | |
| 17 #include "remoting/host/gnubby_auth_handler.h" | 20 #include "remoting/host/gnubby_auth_handler.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" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 // connected. | 84 // connected. |
| 82 virtual void OnSessionRouteChange( | 85 virtual void OnSessionRouteChange( |
| 83 ClientSession* client, | 86 ClientSession* client, |
| 84 const std::string& channel_name, | 87 const std::string& channel_name, |
| 85 const protocol::TransportRoute& route) = 0; | 88 const protocol::TransportRoute& route) = 0; |
| 86 | 89 |
| 87 protected: | 90 protected: |
| 88 virtual ~EventHandler() {} | 91 virtual ~EventHandler() {} |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 // |event_handler| and |desktop_environment_factory| must outlive |this|. | 94 // |event_handler|, |desktop_environment_factory| and |extensions| must |
| 95 // outlive |this|. | |
| 92 ClientSession( | 96 ClientSession( |
| 93 EventHandler* event_handler, | 97 EventHandler* event_handler, |
| 94 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, | 98 scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner, |
| 95 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, | 99 scoped_refptr<base::SingleThreadTaskRunner> input_task_runner, |
| 96 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, | 100 scoped_refptr<base::SingleThreadTaskRunner> video_capture_task_runner, |
| 97 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, | 101 scoped_refptr<base::SingleThreadTaskRunner> video_encode_task_runner, |
| 98 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, | 102 scoped_refptr<base::SingleThreadTaskRunner> network_task_runner, |
| 99 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 103 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 100 scoped_ptr<protocol::ConnectionToClient> connection, | 104 scoped_ptr<protocol::ConnectionToClient> connection, |
| 101 DesktopEnvironmentFactory* desktop_environment_factory, | 105 DesktopEnvironmentFactory* desktop_environment_factory, |
| 102 const base::TimeDelta& max_duration, | 106 const base::TimeDelta& max_duration, |
| 103 scoped_refptr<protocol::PairingRegistry> pairing_registry); | 107 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
| 108 const ExtensionList* extensions); | |
|
Wez
2014/05/28 01:05:59
Ouch. It's a shame to have to keep a bare pointer
dcaiafa
2014/05/28 22:44:58
Removed.
| |
| 104 virtual ~ClientSession(); | 109 virtual ~ClientSession(); |
| 105 | 110 |
| 106 // protocol::HostStub interface. | 111 // protocol::HostStub interface. |
| 107 virtual void NotifyClientResolution( | 112 virtual void NotifyClientResolution( |
| 108 const protocol::ClientResolution& resolution) OVERRIDE; | 113 const protocol::ClientResolution& resolution) OVERRIDE; |
| 109 virtual void ControlVideo( | 114 virtual void ControlVideo( |
| 110 const protocol::VideoControl& video_control) OVERRIDE; | 115 const protocol::VideoControl& video_control) OVERRIDE; |
| 111 virtual void ControlAudio( | 116 virtual void ControlAudio( |
| 112 const protocol::AudioControl& audio_control) OVERRIDE; | 117 const protocol::AudioControl& audio_control) OVERRIDE; |
| 113 virtual void SetCapabilities( | 118 virtual void SetCapabilities( |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 142 | 147 |
| 143 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); | 148 void SetGnubbyAuthHandlerForTesting(GnubbyAuthHandler* gnubby_auth_handler); |
| 144 | 149 |
| 145 protocol::ConnectionToClient* connection() const { | 150 protocol::ConnectionToClient* connection() const { |
| 146 return connection_.get(); | 151 return connection_.get(); |
| 147 } | 152 } |
| 148 | 153 |
| 149 bool is_authenticated() { return auth_input_filter_.enabled(); } | 154 bool is_authenticated() { return auth_input_filter_.enabled(); } |
| 150 | 155 |
| 151 private: | 156 private: |
| 157 typedef ScopedVector<ExtensionSession> ExtensionSessionList; | |
| 158 | |
| 152 // Creates a proxy for sending clipboard events to the client. | 159 // Creates a proxy for sending clipboard events to the client. |
| 153 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); | 160 scoped_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
| 154 | 161 |
| 155 // Creates an audio encoder for the specified configuration. | 162 // Creates an audio encoder for the specified configuration. |
| 156 static scoped_ptr<AudioEncoder> CreateAudioEncoder( | 163 static scoped_ptr<AudioEncoder> CreateAudioEncoder( |
| 157 const protocol::SessionConfig& config); | 164 const protocol::SessionConfig& config); |
| 158 | 165 |
| 159 // Creates a video encoder for the specified configuration. | 166 // Creates a video encoder for the specified configuration. |
| 160 static scoped_ptr<VideoEncoder> CreateVideoEncoder( | 167 static scoped_ptr<VideoEncoder> CreateVideoEncoder( |
| 161 const protocol::SessionConfig& config); | 168 const protocol::SessionConfig& config); |
| 162 | 169 |
| 170 // Creates extension sessions for this client. Must be called after the client | |
| 171 // has reported its capabilities. | |
| 172 void CreateExtensionSessions(); | |
| 173 | |
| 163 EventHandler* event_handler_; | 174 EventHandler* event_handler_; |
| 164 | 175 |
| 165 // The connection to the client. | 176 // The connection to the client. |
| 166 scoped_ptr<protocol::ConnectionToClient> connection_; | 177 scoped_ptr<protocol::ConnectionToClient> connection_; |
| 167 | 178 |
| 168 std::string client_jid_; | 179 std::string client_jid_; |
| 169 | 180 |
| 170 // Used to disable callbacks to |this| once DisconnectSession() has been | 181 // Used to disable callbacks to |this| once DisconnectSession() has been |
| 171 // called. | 182 // called. |
| 172 base::WeakPtrFactory<ClientSessionControl> control_factory_; | 183 base::WeakPtrFactory<ClientSessionControl> control_factory_; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 237 | 248 |
| 238 // Used to apply client-requested changes in screen resolution. | 249 // Used to apply client-requested changes in screen resolution. |
| 239 scoped_ptr<ScreenControls> screen_controls_; | 250 scoped_ptr<ScreenControls> screen_controls_; |
| 240 | 251 |
| 241 // The pairing registry for PIN-less authentication. | 252 // The pairing registry for PIN-less authentication. |
| 242 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 253 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
| 243 | 254 |
| 244 // Used to proxy gnubby auth traffic. | 255 // Used to proxy gnubby auth traffic. |
| 245 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; | 256 scoped_ptr<GnubbyAuthHandler> gnubby_auth_handler_; |
| 246 | 257 |
| 258 // List of host extensions. | |
| 259 const ExtensionList* extensions_; | |
| 260 | |
| 261 // List of host extension sessions. These are created from |extensions_|, | |
| 262 // which are shared by all clients, specifically for this client. | |
| 263 ExtensionSessionList extension_sessions_; | |
| 264 | |
| 247 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 265 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 248 }; | 266 }; |
| 249 | 267 |
| 250 } // namespace remoting | 268 } // namespace remoting |
| 251 | 269 |
| 252 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 270 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |