[email protected] | 91e4b7f6 | 2012-01-25 23:23:02 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef REMOTING_HOST_CLIENT_SESSION_H_ |
| 6 | #define REMOTING_HOST_CLIENT_SESSION_H_ |
| 7 | |
joedow | 4fa09d9 | 2016-06-27 21:26:17 | [diff] [blame] | 8 | #include <cstdint> |
| 9 | #include <memory> |
[email protected] | a5d181f | 2013-04-19 14:55:37 | [diff] [blame] | 10 | #include <string> |
[email protected] | c78669c9 | 2011-06-13 22:42:38 | [diff] [blame] | 11 | |
avi | c5960f3 | 2015-12-22 22:49:48 | [diff] [blame] | 12 | #include "base/macros.h" |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 13 | #include "base/memory/ref_counted.h" |
[email protected] | ce404ca | 2013-01-16 17:23:53 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
gab | bf77513a | 2017-06-01 14:35:34 | [diff] [blame] | 15 | #include "base/sequence_checker.h" |
[email protected] | fb44196 | 2013-05-08 05:35:24 | [diff] [blame] | 16 | #include "base/sequenced_task_runner_helpers.h" |
[email protected] | 5d7eb86 | 2013-06-28 15:21:24 | [diff] [blame] | 17 | #include "base/time/time.h" |
| 18 | #include "base/timer/timer.h" |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 19 | #include "remoting/host/client_session_control.h" |
joedow | 4fa09d9 | 2016-06-27 21:26:17 | [diff] [blame] | 20 | #include "remoting/host/client_session_details.h" |
Jamie Walch | 044a8cd38 | 2020-02-04 00:27:40 | [diff] [blame] | 21 | #include "remoting/host/desktop_and_cursor_conditional_composer.h" |
Gary Kacmarcik | ebe85a81 | 2019-01-23 20:11:54 | [diff] [blame] | 22 | #include "remoting/host/desktop_display_info.h" |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 23 | #include "remoting/host/desktop_environment_options.h" |
zijiehe | f38c972 | 2017-02-08 02:05:29 | [diff] [blame] | 24 | #include "remoting/host/host_experiment_session_plugin.h" |
[email protected] | 1b478ba | 2014-07-31 12:51:43 | [diff] [blame] | 25 | #include "remoting/host/host_extension_session_manager.h" |
Jamie Walch | c3b6126f | 2020-01-27 22:34:50 | [diff] [blame] | 26 | #include "remoting/host/pointer_lock_detector.h" |
[email protected] | 86cbe6b | 2012-04-03 00:56:18 | [diff] [blame] | 27 | #include "remoting/host/remote_input_filter.h" |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 28 | #include "remoting/proto/action.pb.h" |
[email protected] | ff3761a1 | 2012-05-22 22:29:24 | [diff] [blame] | 29 | #include "remoting/protocol/clipboard_echo_filter.h" |
[email protected] | 34df2ab | 2012-08-19 06:54:23 | [diff] [blame] | 30 | #include "remoting/protocol/clipboard_filter.h" |
[email protected] | e265ad7 | 2012-03-16 17:28:03 | [diff] [blame] | 31 | #include "remoting/protocol/clipboard_stub.h" |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 32 | #include "remoting/protocol/connection_to_client.h" |
Joseph Arhar | 5f69f39 | 2017-07-01 00:33:20 | [diff] [blame] | 33 | #include "remoting/protocol/data_channel_manager.h" |
Gary Kacmarcik | fe08e31 | 2019-09-13 23:04:04 | [diff] [blame] | 34 | #include "remoting/protocol/display_size.h" |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 35 | #include "remoting/protocol/host_stub.h" |
[email protected] | 86cbe6b | 2012-04-03 00:56:18 | [diff] [blame] | 36 | #include "remoting/protocol/input_event_tracker.h" |
| 37 | #include "remoting/protocol/input_filter.h" |
| 38 | #include "remoting/protocol/input_stub.h" |
sergeyu | a609b7a | 2015-11-30 06:25:39 | [diff] [blame] | 39 | #include "remoting/protocol/mouse_input_filter.h" |
[email protected] | 8835692 | 2013-06-04 06:26:01 | [diff] [blame] | 40 | #include "remoting/protocol/pairing_registry.h" |
sergeyu | ad51be8 | 2016-06-22 06:04:39 | [diff] [blame] | 41 | #include "remoting/protocol/video_stream.h" |
Gary Kacmarcik | ebe85a81 | 2019-01-23 20:11:54 | [diff] [blame] | 42 | #include "third_party/webrtc/modules/desktop_capture/desktop_capture_types.h" |
[email protected] | 8c83a71c | 2013-12-16 18:02:58 | [diff] [blame] | 43 | #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" |
Jamie Walch | 758a02d9 | 2020-01-28 01:32:13 | [diff] [blame] | 44 | #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h" |
Jamie Walch | c3b6126f | 2020-01-27 22:34:50 | [diff] [blame] | 45 | #include "third_party/webrtc/modules/desktop_capture/mouse_cursor_monitor.h" |
Jamie Walch | 6e3a4229 | 2019-05-03 02:19:21 | [diff] [blame] | 46 | #include "ui/events/event.h" |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 47 | |
| 48 | namespace remoting { |
| 49 | |
sergeyu | cd16e206 | 2016-09-12 19:28:35 | [diff] [blame] | 50 | class AudioStream; |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 51 | class DesktopEnvironment; |
[email protected] | 8190479 | 2012-10-18 04:16:28 | [diff] [blame] | 52 | class DesktopEnvironmentFactory; |
[email protected] | b0b72f11 | 2013-03-24 03:42:42 | [diff] [blame] | 53 | class InputInjector; |
Erik Jensen | b887667 | 2019-12-03 04:30:05 | [diff] [blame] | 54 | class KeyboardLayoutMonitor; |
sergeyu | 1afb35a1 | 2015-02-13 18:45:30 | [diff] [blame] | 55 | class MouseShapePump; |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 56 | class ScreenControls; |
sergeyu | 4d20800 | 2015-11-23 22:27:43 | [diff] [blame] | 57 | |
sergeyu | 9102cff | 2016-04-07 19:14:01 | [diff] [blame] | 58 | namespace protocol { |
| 59 | class VideoLayout; |
| 60 | } // namespace protocol |
| 61 | |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 62 | // A ClientSession keeps a reference to a connection to a client, and maintains |
| 63 | // per-client state. |
gab | bf77513a | 2017-06-01 14:35:34 | [diff] [blame] | 64 | class ClientSession : public protocol::HostStub, |
sergeyu | 9102cff | 2016-04-07 19:14:01 | [diff] [blame] | 65 | public protocol::ConnectionToClient::EventHandler, |
sergeyu | ad51be8 | 2016-06-22 06:04:39 | [diff] [blame] | 66 | public protocol::VideoStream::Observer, |
joedow | 4fa09d9 | 2016-06-27 21:26:17 | [diff] [blame] | 67 | public ClientSessionControl, |
Jamie Walch | c3b6126f | 2020-01-27 22:34:50 | [diff] [blame] | 68 | public ClientSessionDetails, |
Jamie Walch | 758a02d9 | 2020-01-28 01:32:13 | [diff] [blame] | 69 | public PointerLockDetector::EventHandler, |
| 70 | public webrtc::MouseCursorMonitor::Callback { |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 71 | public: |
| 72 | // Callback interface for passing events to the ChromotingHost. |
| 73 | class EventHandler { |
| 74 | public: |
[email protected] | 064128c | 2014-04-07 22:33:28 | [diff] [blame] | 75 | // Called after authentication has started. |
| 76 | virtual void OnSessionAuthenticating(ClientSession* client) = 0; |
| 77 | |
sergeyu | 21c899e | 2015-11-24 16:39:55 | [diff] [blame] | 78 | // Called after authentication has finished successfully. |
| 79 | virtual void OnSessionAuthenticated(ClientSession* client) = 0; |
[email protected] | 1f249e2 | 2011-11-29 20:19:59 | [diff] [blame] | 80 | |
[email protected] | cba6f81 | 2012-03-27 01:01:50 | [diff] [blame] | 81 | // Called after we've finished connecting all channels. |
| 82 | virtual void OnSessionChannelsConnected(ClientSession* client) = 0; |
| 83 | |
[email protected] | 1f249e2 | 2011-11-29 20:19:59 | [diff] [blame] | 84 | // Called after authentication has failed. Must not tear down this |
| 85 | // object. OnSessionClosed() is notified after this handler |
| 86 | // returns. |
| 87 | virtual void OnSessionAuthenticationFailed(ClientSession* client) = 0; |
| 88 | |
| 89 | // Called after connection has failed or after the client closed it. |
[email protected] | ee910fd | 2011-11-10 18:23:31 | [diff] [blame] | 90 | virtual void OnSessionClosed(ClientSession* client) = 0; |
[email protected] | 1f249e2 | 2011-11-29 20:19:59 | [diff] [blame] | 91 | |
[email protected] | 91e4b7f6 | 2012-01-25 23:23:02 | [diff] [blame] | 92 | // Called on notification of a route change event, when a channel is |
| 93 | // connected. |
[email protected] | 17af2ab | 2012-02-02 04:07:52 | [diff] [blame] | 94 | virtual void OnSessionRouteChange( |
| 95 | ClientSession* client, |
| 96 | const std::string& channel_name, |
[email protected] | be451c8 | 2012-03-20 22:24:47 | [diff] [blame] | 97 | const protocol::TransportRoute& route) = 0; |
[email protected] | 512d03f | 2012-06-26 01:06:06 | [diff] [blame] | 98 | |
| 99 | protected: |
| 100 | virtual ~EventHandler() {} |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 101 | }; |
| 102 | |
[email protected] | 233bb94 | 2013-03-15 07:18:17 | [diff] [blame] | 103 | // |event_handler| and |desktop_environment_factory| must outlive |this|. |
[email protected] | 1b478ba | 2014-07-31 12:51:43 | [diff] [blame] | 104 | // All |HostExtension|s in |extensions| must outlive |this|. |
Joseph Arhar | 5f69f39 | 2017-07-01 00:33:20 | [diff] [blame] | 105 | ClientSession( |
| 106 | EventHandler* event_handler, |
| 107 | std::unique_ptr<protocol::ConnectionToClient> connection, |
| 108 | DesktopEnvironmentFactory* desktop_environment_factory, |
| 109 | const DesktopEnvironmentOptions& desktop_environment_options, |
| 110 | const base::TimeDelta& max_duration, |
| 111 | scoped_refptr<protocol::PairingRegistry> pairing_registry, |
zijiehe | b7da6242 | 2017-07-11 01:17:15 | [diff] [blame] | 112 | const std::vector<HostExtension*>& extensions); |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 113 | ~ClientSession() override; |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 114 | |
[email protected] | 1b478ba | 2014-07-31 12:51:43 | [diff] [blame] | 115 | // Returns the set of capabilities negotiated between client and host. |
| 116 | const std::string& capabilities() const { return capabilities_; } |
[email protected] | 399b4f6 | 2014-05-30 20:13:15 | [diff] [blame] | 117 | |
[email protected] | f2b9cf3 | 2012-04-27 00:13:43 | [diff] [blame] | 118 | // protocol::HostStub interface. |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 119 | void NotifyClientResolution( |
mostynb | 11d989c | 2014-10-08 16:58:09 | [diff] [blame] | 120 | const protocol::ClientResolution& resolution) override; |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 121 | void ControlVideo(const protocol::VideoControl& video_control) override; |
| 122 | void ControlAudio(const protocol::AudioControl& audio_control) override; |
| 123 | void SetCapabilities(const protocol::Capabilities& capabilities) override; |
| 124 | void RequestPairing( |
mostynb | 11d989c | 2014-10-08 16:58:09 | [diff] [blame] | 125 | const remoting::protocol::PairingRequest& pairing_request) override; |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 126 | void DeliverClientMessage(const protocol::ExtensionMessage& message) override; |
Gary Kacmarcik | 0c56fda | 2019-01-17 03:10:12 | [diff] [blame] | 127 | void SelectDesktopDisplay( |
| 128 | const protocol::SelectDesktopDisplayRequest& select_display) override; |
Yuwei Huang | ef53007 | 2020-06-19 02:33:44 | [diff] [blame] | 129 | void ControlPeerConnection( |
| 130 | const protocol::PeerConnectionParameters& parameters) override; |
[email protected] | f2b9cf3 | 2012-04-27 00:13:43 | [diff] [blame] | 131 | |
[email protected] | ee910fd | 2011-11-10 18:23:31 | [diff] [blame] | 132 | // protocol::ConnectionToClient::EventHandler interface. |
sergeyu | 4e1f4cd | 2016-09-27 00:42:52 | [diff] [blame] | 133 | void OnConnectionAuthenticating() override; |
| 134 | void OnConnectionAuthenticated() override; |
| 135 | void CreateMediaStreams() override; |
| 136 | void OnConnectionChannelsConnected() override; |
| 137 | void OnConnectionClosed(protocol::ErrorCode error) override; |
Yuwei Huang | cf7fdff | 2020-05-04 19:46:43 | [diff] [blame] | 138 | void OnTransportProtocolChange(const std::string& protocol) override; |
sergeyu | 4e1f4cd | 2016-09-27 00:42:52 | [diff] [blame] | 139 | void OnRouteChange(const std::string& channel_name, |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 140 | const protocol::TransportRoute& route) override; |
Joseph Arhar | 5f69f39 | 2017-07-01 00:33:20 | [diff] [blame] | 141 | void OnIncomingDataChannel( |
| 142 | const std::string& channel_name, |
| 143 | std::unique_ptr<protocol::MessagePipe> pipe) override; |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 144 | |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 145 | // ClientSessionControl interface. |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 146 | const std::string& client_jid() const override; |
sergeyu | ec77d854 | 2015-11-03 22:31:00 | [diff] [blame] | 147 | void DisconnectSession(protocol::ErrorCode error) override; |
Jamie Walch | f297c51 | 2019-08-20 21:09:11 | [diff] [blame] | 148 | void OnLocalKeyPressed(uint32_t usb_keycode) override; |
Jamie Walch | 6e3a4229 | 2019-05-03 02:19:21 | [diff] [blame] | 149 | void OnLocalPointerMoved(const webrtc::DesktopVector& position, |
| 150 | ui::EventType type) override; |
dcheng | 562aba5 | 2014-10-21 12:30:14 | [diff] [blame] | 151 | void SetDisableInputs(bool disable_inputs) override; |
Gary Kacmarcik | 91f5ed4 | 2018-11-29 22:24:14 | [diff] [blame] | 152 | void OnDesktopDisplayChanged( |
| 153 | std::unique_ptr<protocol::VideoLayout> layout) override; |
[email protected] | 1ce457a | 2011-05-19 19:59:48 | [diff] [blame] | 154 | |
joedow | 4fa09d9 | 2016-06-27 21:26:17 | [diff] [blame] | 155 | // ClientSessionDetails interface. |
| 156 | uint32_t desktop_session_id() const override; |
| 157 | ClientSessionControl* session_control() override; |
| 158 | |
Jamie Walch | c3b6126f | 2020-01-27 22:34:50 | [diff] [blame] | 159 | // PointerLockDetector::EventHandler interface |
| 160 | void OnPointerLockChanged(bool active) override; |
| 161 | |
Jamie Walch | 758a02d9 | 2020-01-28 01:32:13 | [diff] [blame] | 162 | // webrtc::MouseCursorMonitor::Callback implementation. |
| 163 | void OnMouseCursor(webrtc::MouseCursor* mouse_cursor) override; |
| 164 | void OnMouseCursorPosition(const webrtc::DesktopVector& position) override; |
| 165 | |
sergeyu | 6ad12dc | 2016-04-02 00:01:32 | [diff] [blame] | 166 | protocol::ConnectionToClient* connection() const { return connection_.get(); } |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 167 | |
sergeyu | 6ad12dc | 2016-04-02 00:01:32 | [diff] [blame] | 168 | bool is_authenticated() { return is_authenticated_; } |
[email protected] | dda4da3b | 2012-05-22 00:51:26 | [diff] [blame] | 169 | |
[email protected] | 399b4f6 | 2014-05-30 20:13:15 | [diff] [blame] | 170 | const std::string* client_capabilities() const { |
| 171 | return client_capabilities_.get(); |
| 172 | } |
| 173 | |
zijiehe | b7da6242 | 2017-07-11 01:17:15 | [diff] [blame] | 174 | // Registers a DataChannelManager callback for testing. |
| 175 | void RegisterCreateHandlerCallbackForTesting( |
| 176 | const std::string& prefix, |
| 177 | protocol::DataChannelManager::CreateHandlerCallback constructor); |
| 178 | |
sergeyu | b047307a | 2016-10-18 17:19:29 | [diff] [blame] | 179 | void SetEventTimestampsSourceForTests( |
| 180 | scoped_refptr<protocol::InputEventTimestampsSource> |
| 181 | event_timestamp_source); |
| 182 | |
Gary Kacmarcik | 7230792 | 2019-05-22 02:48:47 | [diff] [blame] | 183 | // Public for tests. |
| 184 | void UpdateMouseClampingFilterOffset(); |
| 185 | |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 186 | private: |
[email protected] | 7f44ba4 | 2012-05-31 20:26:29 | [diff] [blame] | 187 | // Creates a proxy for sending clipboard events to the client. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 188 | std::unique_ptr<protocol::ClipboardStub> CreateClipboardProxy(); |
[email protected] | 7f44ba4 | 2012-05-31 20:26:29 | [diff] [blame] | 189 | |
Gary Kacmarcik | fe08e31 | 2019-09-13 23:04:04 | [diff] [blame] | 190 | void SetMouseClampingFilter(const DisplaySize& size); |
Gary Kacmarcik | 7230792 | 2019-05-22 02:48:47 | [diff] [blame] | 191 | |
sergeyu | ad51be8 | 2016-06-22 06:04:39 | [diff] [blame] | 192 | // protocol::VideoStream::Observer implementation. |
| 193 | void OnVideoSizeChanged(protocol::VideoStream* stream, |
| 194 | const webrtc::DesktopSize& size, |
| 195 | const webrtc::DesktopVector& dpi) override; |
sergeyu | a609b7a | 2015-11-30 06:25:39 | [diff] [blame] | 196 | |
Joe Downing | b511e4a9 | 2018-11-16 21:10:13 | [diff] [blame] | 197 | void CreateActionMessageHandler( |
| 198 | std::vector<protocol::ActionRequest::Action> capabilities, |
| 199 | const std::string& channel_name, |
| 200 | std::unique_ptr<protocol::MessagePipe> pipe); |
| 201 | |
Joseph Arhar | 91537d5 | 2017-08-14 22:31:10 | [diff] [blame] | 202 | void CreateFileTransferMessageHandler( |
| 203 | const std::string& channel_name, |
| 204 | std::unique_ptr<protocol::MessagePipe> pipe); |
| 205 | |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 206 | EventHandler* event_handler_; |
[email protected] | 4ea2c7c | 2011-03-31 14:20:06 | [diff] [blame] | 207 | |
[email protected] | 233bb94 | 2013-03-15 07:18:17 | [diff] [blame] | 208 | // Used to create a DesktopEnvironment instance for this session. |
| 209 | DesktopEnvironmentFactory* desktop_environment_factory_; |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 210 | |
zijiehe | 4aa6ea4 | 2016-11-12 01:28:16 | [diff] [blame] | 211 | // The DesktopEnvironmentOptions used to initialize DesktopEnvironment. |
| 212 | DesktopEnvironmentOptions desktop_environment_options_; |
| 213 | |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 214 | // The DesktopEnvironment instance for this session. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 215 | std::unique_ptr<DesktopEnvironment> desktop_environment_; |
[email protected] | 231316a | 2013-03-25 06:01:12 | [diff] [blame] | 216 | |
[email protected] | eccc2d4 | 2013-01-10 19:35:14 | [diff] [blame] | 217 | // Filter used as the final element in the input pipeline. |
| 218 | protocol::InputFilter host_input_filter_; |
[email protected] | 4ea2c7c | 2011-03-31 14:20:06 | [diff] [blame] | 219 | |
[email protected] | 86cbe6b | 2012-04-03 00:56:18 | [diff] [blame] | 220 | // Tracker used to release pressed keys and buttons when disconnecting. |
| 221 | protocol::InputEventTracker input_tracker_; |
| 222 | |
| 223 | // Filter used to disable remote inputs during local input activity. |
| 224 | RemoteInputFilter remote_input_filter_; |
| 225 | |
[email protected] | f5d62e36 | 2012-04-30 20:54:37 | [diff] [blame] | 226 | // Filter used to clamp mouse events to the current display dimensions. |
sergeyu | a609b7a | 2015-11-30 06:25:39 | [diff] [blame] | 227 | protocol::MouseInputFilter mouse_clamping_filter_; |
[email protected] | f5d62e36 | 2012-04-30 20:54:37 | [diff] [blame] | 228 | |
Jamie Walch | c3b6126f | 2020-01-27 22:34:50 | [diff] [blame] | 229 | // Filter used to detect transitions into and out of client-side pointer lock. |
| 230 | PointerLockDetector pointer_lock_detector_; |
| 231 | |
[email protected] | 750ae6b | 2012-08-20 22:52:40 | [diff] [blame] | 232 | // Filter to used to stop clipboard items sent from the client being echoed |
[email protected] | eccc2d4 | 2013-01-10 19:35:14 | [diff] [blame] | 233 | // back to it. It is the final element in the clipboard (client -> host) |
| 234 | // pipeline. |
[email protected] | 750ae6b | 2012-08-20 22:52:40 | [diff] [blame] | 235 | protocol::ClipboardEchoFilter clipboard_echo_filter_; |
| 236 | |
[email protected] | 34df2ab | 2012-08-19 06:54:23 | [diff] [blame] | 237 | // Filters used to manage enabling & disabling of input & clipboard. |
[email protected] | 86cbe6b | 2012-04-03 00:56:18 | [diff] [blame] | 238 | protocol::InputFilter disable_input_filter_; |
[email protected] | 34df2ab | 2012-08-19 06:54:23 | [diff] [blame] | 239 | protocol::ClipboardFilter disable_clipboard_filter_; |
[email protected] | 86cbe6b | 2012-04-03 00:56:18 | [diff] [blame] | 240 | |
[email protected] | 7f44ba4 | 2012-05-31 20:26:29 | [diff] [blame] | 241 | // Factory for weak pointers to the client clipboard stub. |
| 242 | // This must appear after |clipboard_echo_filter_|, so that it won't outlive |
| 243 | // it. |
[email protected] | 34df2ab | 2012-08-19 06:54:23 | [diff] [blame] | 244 | base::WeakPtrFactory<protocol::ClipboardStub> client_clipboard_factory_; |
[email protected] | 7f44ba4 | 2012-05-31 20:26:29 | [diff] [blame] | 245 | |
[email protected] | 5dc5b12a | 2012-06-23 01:05:14 | [diff] [blame] | 246 | // The maximum duration of this session. |
| 247 | // There is no maximum if this value is <= 0. |
| 248 | base::TimeDelta max_duration_; |
| 249 | |
| 250 | // A timer that triggers a disconnect when the maximum session duration |
| 251 | // is reached. |
danakj | 8c3eb80 | 2015-09-24 07:53:00 | [diff] [blame] | 252 | base::OneShotTimer max_duration_timer_; |
[email protected] | 5dc5b12a | 2012-06-23 01:05:14 | [diff] [blame] | 253 | |
Erik Jensen | c08ecf11 | 2019-12-19 00:29:49 | [diff] [blame] | 254 | // Objects responsible for sending video, audio. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 255 | std::unique_ptr<protocol::VideoStream> video_stream_; |
sergeyu | cd16e206 | 2016-09-12 19:28:35 | [diff] [blame] | 256 | std::unique_ptr<protocol::AudioStream> audio_stream_; |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 257 | |
[email protected] | a5d181f | 2013-04-19 14:55:37 | [diff] [blame] | 258 | // The set of all capabilities supported by the client. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 259 | std::unique_ptr<std::string> client_capabilities_; |
[email protected] | a5d181f | 2013-04-19 14:55:37 | [diff] [blame] | 260 | |
| 261 | // The set of all capabilities supported by the host. |
| 262 | std::string host_capabilities_; |
| 263 | |
[email protected] | 1b478ba | 2014-07-31 12:51:43 | [diff] [blame] | 264 | // The set of all capabilities negotiated between client and host. |
| 265 | std::string capabilities_; |
| 266 | |
[email protected] | b0b72f11 | 2013-03-24 03:42:42 | [diff] [blame] | 267 | // Used to inject mouse and keyboard input and handle clipboard events. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 268 | std::unique_ptr<InputInjector> input_injector_; |
[email protected] | 170cba4 | 2012-09-12 22:28:39 | [diff] [blame] | 269 | |
[email protected] | 6f526ce | 2013-03-18 04:38:56 | [diff] [blame] | 270 | // Used to apply client-requested changes in screen resolution. |
dcheng | 0765c49 | 2016-04-06 22:41:53 | [diff] [blame] | 271 | std::unique_ptr<ScreenControls> screen_controls_; |
[email protected] | 61cfdc5 | 2013-03-09 03:04:56 | [diff] [blame] | 272 | |
Gary Kacmarcik | ebe85a81 | 2019-01-23 20:11:54 | [diff] [blame] | 273 | // Contains the most recently gathered info about the desktop displays; |
| 274 | DesktopDisplayInfo desktop_display_info_; |
| 275 | |
Gary Kacmarcik | e555ea6f | 2019-05-15 17:19:56 | [diff] [blame] | 276 | // Default DPI values to use if a display reports 0 for DPI. |
| 277 | int default_x_dpi_; |
| 278 | int default_y_dpi_; |
| 279 | |
Gary Kacmarcik | ebe85a81 | 2019-01-23 20:11:54 | [diff] [blame] | 280 | // The id of the desktop display to show to the user. |
Gary Kacmarcik | 5dac99c | 2020-03-05 22:55:40 | [diff] [blame] | 281 | // Default is webrtc::kInvalidScreenScreenId because we need to perform |
| 282 | // an initial capture to determine if the current setup support capturing |
| 283 | // the entire desktop or if it is restricted to a single display. |
| 284 | webrtc::ScreenId show_display_id_ = webrtc::kInvalidScreenId; |
| 285 | |
| 286 | // The initial video size captured by WebRTC. |
| 287 | // This will be the full desktop unless webrtc cannot capture the entire |
| 288 | // desktop (e.g., because the DPIs don't match). In that case, it will |
| 289 | // be equal to the dimensions of the default display. |
| 290 | DisplaySize default_webrtc_desktop_size_; |
| 291 | |
| 292 | // The current size of the area being captured by webrtc. This will be |
| 293 | // equal to the size of the entire desktop, or to a single display. |
| 294 | DisplaySize webrtc_capture_size_; |
| 295 | |
| 296 | // Set to true if the current display configuration supports capturing the |
| 297 | // entire desktop. |
| 298 | bool can_capture_full_desktop_ = true; |
Gary Kacmarcik | ebe85a81 | 2019-01-23 20:11:54 | [diff] [blame] | 299 | |
[email protected] | 8835692 | 2013-06-04 06:26:01 | [diff] [blame] | 300 | // The pairing registry for PIN-less authentication. |
| 301 | scoped_refptr<protocol::PairingRegistry> pairing_registry_; |
| 302 | |
Joseph Arhar | 5f69f39 | 2017-07-01 00:33:20 | [diff] [blame] | 303 | // Used to dispatch new data channels to factory methods. |
| 304 | protocol::DataChannelManager data_channel_manager_; |
| 305 | |
sergeyu | 1f8cd50 | 2015-02-13 21:45:53 | [diff] [blame] | 306 | // Set to true if the client was authenticated successfully. |
sergeyu | 9102cff | 2016-04-07 19:14:01 | [diff] [blame] | 307 | bool is_authenticated_ = false; |
| 308 | |
| 309 | // Set to true after all data channels have been connected. |
| 310 | bool channels_connected_ = false; |
sergeyu | 1f8cd50 | 2015-02-13 21:45:53 | [diff] [blame] | 311 | |
[email protected] | 1b478ba | 2014-07-31 12:51:43 | [diff] [blame] | 312 | // Used to store video channel pause & lossless parameters. |
sergeyu | 9102cff | 2016-04-07 19:14:01 | [diff] [blame] | 313 | bool pause_video_ = false; |
| 314 | bool lossless_video_encode_ = false; |
| 315 | bool lossless_video_color_ = false; |
| 316 | |
| 317 | // VideoLayout is sent only after the control channel is connected. Until |
| 318 | // then it's stored in |pending_video_layout_message_|. |
| 319 | std::unique_ptr<protocol::VideoLayout> pending_video_layout_message_; |
[email protected] | 399b4f6 | 2014-05-30 20:13:15 | [diff] [blame] | 320 | |
sergeyu | b047307a | 2016-10-18 17:19:29 | [diff] [blame] | 321 | scoped_refptr<protocol::InputEventTimestampsSource> |
| 322 | event_timestamp_source_for_tests_; |
| 323 | |
zijiehe | f38c972 | 2017-02-08 02:05:29 | [diff] [blame] | 324 | HostExperimentSessionPlugin host_experiment_session_plugin_; |
| 325 | |
Erik Jensen | c08ecf11 | 2019-12-19 00:29:49 | [diff] [blame] | 326 | // The connection to the client. |
| 327 | std::unique_ptr<protocol::ConnectionToClient> connection_; |
| 328 | |
| 329 | std::string client_jid_; |
| 330 | |
| 331 | // Used to manage extension functionality. |
| 332 | std::unique_ptr<HostExtensionSessionManager> extension_manager_; |
| 333 | |
| 334 | // Objects to monitor and send updates for mouse shape and keyboard layout. |
| 335 | std::unique_ptr<MouseShapePump> mouse_shape_pump_; |
| 336 | std::unique_ptr<KeyboardLayoutMonitor> keyboard_layout_monitor_; |
| 337 | |
Jamie Walch | 044a8cd38 | 2020-02-04 00:27:40 | [diff] [blame] | 338 | base::WeakPtr<DesktopAndCursorConditionalComposer> |
| 339 | desktop_and_cursor_composer_; |
Jamie Walch | 758a02d9 | 2020-01-28 01:32:13 | [diff] [blame] | 340 | |
gab | bf77513a | 2017-06-01 14:35:34 | [diff] [blame] | 341 | SEQUENCE_CHECKER(sequence_checker_); |
| 342 | |
kulkarni.a | 933aeaf | 2014-09-20 13:19:17 | [diff] [blame] | 343 | // Used to disable callbacks to |this| once DisconnectSession() has been |
| 344 | // called. |
Jeremy Roman | 7c5cfabd | 2019-08-12 15:45:27 | [diff] [blame] | 345 | base::WeakPtrFactory<ClientSessionControl> weak_factory_{this}; |
kulkarni.a | 933aeaf | 2014-09-20 13:19:17 | [diff] [blame] | 346 | |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 347 | DISALLOW_COPY_AND_ASSIGN(ClientSession); |
| 348 | }; |
| 349 | |
[email protected] | 44f6076 | 2011-03-23 12:13:35 | [diff] [blame] | 350 | } // namespace remoting |
| 351 | |
| 352 | #endif // REMOTING_HOST_CLIENT_SESSION_H_ |