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 <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 OnCreateVideoStreams(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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 scoped_ptr<HostExtensionSessionManager> extension_manager_; | 223 scoped_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_; |
| 223 | 227 |
| 224 // Used to store video channel pause & lossless parameters. | 228 // Used to store video channel pause & lossless parameters. |
| 225 bool pause_video_; | 229 bool pause_video_; |
| 226 bool lossless_video_encode_; | 230 bool lossless_video_encode_; |
| 227 bool lossless_video_color_; | 231 bool lossless_video_color_; |
| 228 | 232 |
| 233 // VideoLayout is sent only after the capabilities are negotiated with the | |
| 234 // client. Until then it's stored in |pending_video_layout_message_|. | |
|
Jamie
2016/04/04 18:21:47
Maybe expand on this a bit to explain why the mess
Sergey Ulanov
2016/04/05 21:21:54
My thinking was that in the future we may need to
| |
| 235 scoped_ptr<protocol::VideoLayout> pending_video_layout_message_; | |
| 236 | |
| 229 // Used to disable callbacks to |this| once DisconnectSession() has been | 237 // Used to disable callbacks to |this| once DisconnectSession() has been |
| 230 // called. | 238 // called. |
| 231 base::WeakPtrFactory<ClientSessionControl> weak_factory_; | 239 base::WeakPtrFactory<ClientSessionControl> weak_factory_; |
| 232 | 240 |
| 233 DISALLOW_COPY_AND_ASSIGN(ClientSession); | 241 DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 234 }; | 242 }; |
| 235 | 243 |
| 236 } // namespace remoting | 244 } // namespace remoting |
| 237 | 245 |
| 238 #endif // REMOTING_HOST_CLIENT_SESSION_H_ | 246 #endif // REMOTING_HOST_CLIENT_SESSION_H_ |
| OLD | NEW |