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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 namespace remoting { | 38 namespace remoting { |
39 | 39 |
40 class AudioPump; | 40 class AudioPump; |
41 class DesktopEnvironment; | 41 class DesktopEnvironment; |
42 class DesktopEnvironmentFactory; | 42 class DesktopEnvironmentFactory; |
43 class InputInjector; | 43 class InputInjector; |
44 class MouseShapePump; | 44 class MouseShapePump; |
45 class ScreenControls; | 45 class ScreenControls; |
46 | 46 |
| 47 namespace protocol { |
| 48 class VideoLayout; |
| 49 } // namespace protocol |
| 50 |
47 // A ClientSession keeps a reference to a connection to a client, and maintains | 51 // A ClientSession keeps a reference to a connection to a client, and maintains |
48 // per-client state. | 52 // per-client state. |
49 class ClientSession | 53 class ClientSession : public base::NonThreadSafe, |
50 : public base::NonThreadSafe, | 54 public protocol::HostStub, |
51 public protocol::HostStub, | 55 public protocol::ConnectionToClient::EventHandler, |
52 public protocol::ConnectionToClient::EventHandler, | 56 public ClientSessionControl { |
53 public ClientSessionControl { | |
54 public: | 57 public: |
55 // Callback interface for passing events to the ChromotingHost. | 58 // Callback interface for passing events to the ChromotingHost. |
56 class EventHandler { | 59 class EventHandler { |
57 public: | 60 public: |
58 // Called after authentication has started. | 61 // Called after authentication has started. |
59 virtual void OnSessionAuthenticating(ClientSession* client) = 0; | 62 virtual void OnSessionAuthenticating(ClientSession* client) = 0; |
60 | 63 |
61 // Called after authentication has finished successfully. | 64 // Called after authentication has finished successfully. |
62 virtual void OnSessionAuthenticated(ClientSession* client) = 0; | 65 virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
63 | 66 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 void SetCapabilities(const protocol::Capabilities& capabilities) override; | 108 void SetCapabilities(const protocol::Capabilities& capabilities) override; |
106 void RequestPairing( | 109 void RequestPairing( |
107 const remoting::protocol::PairingRequest& pairing_request) override; | 110 const remoting::protocol::PairingRequest& pairing_request) override; |
108 void DeliverClientMessage(const protocol::ExtensionMessage& message) override; | 111 void DeliverClientMessage(const protocol::ExtensionMessage& message) override; |
109 | 112 |
110 // protocol::ConnectionToClient::EventHandler interface. | 113 // protocol::ConnectionToClient::EventHandler interface. |
111 void OnConnectionAuthenticating( | 114 void OnConnectionAuthenticating( |
112 protocol::ConnectionToClient* connection) override; | 115 protocol::ConnectionToClient* connection) override; |
113 void OnConnectionAuthenticated( | 116 void OnConnectionAuthenticated( |
114 protocol::ConnectionToClient* connection) override; | 117 protocol::ConnectionToClient* connection) override; |
| 118 void CreateVideoStreams(protocol::ConnectionToClient* connection) override; |
115 void OnConnectionChannelsConnected( | 119 void OnConnectionChannelsConnected( |
116 protocol::ConnectionToClient* connection) override; | 120 protocol::ConnectionToClient* connection) override; |
117 void OnConnectionClosed(protocol::ConnectionToClient* connection, | 121 void OnConnectionClosed(protocol::ConnectionToClient* connection, |
118 protocol::ErrorCode error) override; | 122 protocol::ErrorCode error) override; |
119 void OnInputEventReceived(protocol::ConnectionToClient* connection, | 123 void OnInputEventReceived(protocol::ConnectionToClient* connection, |
120 int64_t timestamp) override; | 124 int64_t timestamp) override; |
121 void OnRouteChange(protocol::ConnectionToClient* connection, | 125 void OnRouteChange(protocol::ConnectionToClient* connection, |
122 const std::string& channel_name, | 126 const std::string& channel_name, |
123 const protocol::TransportRoute& route) override; | 127 const protocol::TransportRoute& route) override; |
124 | 128 |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // Used to apply client-requested changes in screen resolution. | 216 // Used to apply client-requested changes in screen resolution. |
213 std::unique_ptr<ScreenControls> screen_controls_; | 217 std::unique_ptr<ScreenControls> screen_controls_; |
214 | 218 |
215 // The pairing registry for PIN-less authentication. | 219 // The pairing registry for PIN-less authentication. |
216 scoped_refptr<protocol::PairingRegistry> pairing_registry_; | 220 scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
217 | 221 |
218 // Used to manage extension functionality. | 222 // Used to manage extension functionality. |
219 std::unique_ptr<HostExtensionSessionManager> extension_manager_; | 223 std::unique_ptr<HostExtensionSessionManager> extension_manager_; |
220 | 224 |
221 // Set to true if the client was authenticated successfully. | 225 // Set to true if the client was authenticated successfully. |
222 bool is_authenticated_; | 226 bool is_authenticated_ = false; |
| 227 |
| 228 // Set to true after all data channels have been connected. |
| 229 bool channels_connected_ = false; |
223 | 230 |
224 // Used to store video channel pause & lossless parameters. | 231 // Used to store video channel pause & lossless parameters. |
225 bool pause_video_; | 232 bool pause_video_ = false; |
226 bool lossless_video_encode_; | 233 bool lossless_video_encode_ = false; |
227 bool lossless_video_color_; | 234 bool lossless_video_color_ = false; |
| 235 |
| 236 // VideoLayout is sent only after the control channel is connected. Until |
| 237 // then it's stored in |pending_video_layout_message_|. |
| 238 std::unique_ptr<protocol::VideoLayout> pending_video_layout_message_; |
228 | 239 |
229 // Used to disable callbacks to |this| once DisconnectSession() has been | 240 // Used to disable callbacks to |this| once DisconnectSession() has been |
230 // called. | 241 // called. |
231 base::WeakPtrFactory<ClientSessionControl> weak_factory_; | 242 base::WeakPtrFactory<ClientSessionControl> weak_factory_; |
232 | 243 |
233 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 244 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
234 }; | 245 }; |
235 | 246 |
236 } // namespace remoting | 247 } // namespace remoting |
237 | 248 |
238 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 249 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
OLD | NEW |