| 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 #include "remoting/host/client_session.h" | 5 #include "remoting/host/client_session.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 | 42 |
| 43 } // namespace | 43 } // namespace |
| 44 | 44 |
| 45 ClientSession::ClientSession( | 45 ClientSession::ClientSession( |
| 46 EventHandler* event_handler, | 46 EventHandler* event_handler, |
| 47 std::unique_ptr<protocol::ConnectionToClient> connection, | 47 std::unique_ptr<protocol::ConnectionToClient> connection, |
| 48 DesktopEnvironmentFactory* desktop_environment_factory, | 48 DesktopEnvironmentFactory* desktop_environment_factory, |
| 49 const DesktopEnvironmentOptions& desktop_environment_options, | 49 const DesktopEnvironmentOptions& desktop_environment_options, |
| 50 const base::TimeDelta& max_duration, | 50 const base::TimeDelta& max_duration, |
| 51 scoped_refptr<protocol::PairingRegistry> pairing_registry, | 51 scoped_refptr<protocol::PairingRegistry> pairing_registry, |
| 52 const std::vector<HostExtension*>& extensions, | 52 const std::vector<HostExtension*>& extensions) |
| 53 const std::vector<protocol::DataChannelManager::NameCallbackPair>& | |
| 54 data_channel_callbacks) | |
| 55 : event_handler_(event_handler), | 53 : event_handler_(event_handler), |
| 56 connection_(std::move(connection)), | 54 connection_(std::move(connection)), |
| 57 client_jid_(connection_->session()->jid()), | 55 client_jid_(connection_->session()->jid()), |
| 58 desktop_environment_factory_(desktop_environment_factory), | 56 desktop_environment_factory_(desktop_environment_factory), |
| 59 desktop_environment_options_(desktop_environment_options), | 57 desktop_environment_options_(desktop_environment_options), |
| 60 input_tracker_(&host_input_filter_), | 58 input_tracker_(&host_input_filter_), |
| 61 remote_input_filter_(&input_tracker_), | 59 remote_input_filter_(&input_tracker_), |
| 62 mouse_clamping_filter_(&remote_input_filter_), | 60 mouse_clamping_filter_(&remote_input_filter_), |
| 63 disable_input_filter_(&mouse_clamping_filter_), | 61 disable_input_filter_(&mouse_clamping_filter_), |
| 64 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), | 62 disable_clipboard_filter_(clipboard_echo_filter_.host_filter()), |
| 65 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), | 63 client_clipboard_factory_(clipboard_echo_filter_.client_filter()), |
| 66 max_duration_(max_duration), | 64 max_duration_(max_duration), |
| 67 pairing_registry_(pairing_registry), | 65 pairing_registry_(pairing_registry), |
| 68 // Note that |lossless_video_color_| defaults to true, but actually only | 66 // Note that |lossless_video_color_| defaults to true, but actually only |
| 69 // controls VP9 video stream color quality. | 67 // controls VP9 video stream color quality. |
| 70 lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch( | 68 lossless_video_color_(!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 71 kDisableI444SwitchName)), | 69 kDisableI444SwitchName)), |
| 72 weak_factory_(this) { | 70 weak_factory_(this) { |
| 73 connection_->session()->AddPlugin(&host_experiment_session_plugin_); | 71 connection_->session()->AddPlugin(&host_experiment_session_plugin_); |
| 74 connection_->SetEventHandler(this); | 72 connection_->SetEventHandler(this); |
| 75 | 73 |
| 76 // Create a manager for the configured extensions, if any. | 74 // Create a manager for the configured extensions, if any. |
| 77 extension_manager_.reset(new HostExtensionSessionManager(extensions, this)); | 75 extension_manager_.reset(new HostExtensionSessionManager(extensions, this)); |
| 78 | 76 |
| 79 for (const auto& callback : data_channel_callbacks) { | |
| 80 data_channel_manager_.RegisterCreateHandlerCallback(callback.first, | |
| 81 callback.second); | |
| 82 } | |
| 83 | |
| 84 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
| 85 // LocalInputMonitorWin filters out an echo of the injected input before it | 78 // LocalInputMonitorWin filters out an echo of the injected input before it |
| 86 // reaches |remote_input_filter_|. | 79 // reaches |remote_input_filter_|. |
| 87 remote_input_filter_.SetExpectLocalEcho(false); | 80 remote_input_filter_.SetExpectLocalEcho(false); |
| 88 #endif // defined(OS_WIN) | 81 #endif // defined(OS_WIN) |
| 89 } | 82 } |
| 90 | 83 |
| 91 ClientSession::~ClientSession() { | 84 ClientSession::~ClientSession() { |
| 92 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 85 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 93 DCHECK(!audio_stream_); | 86 DCHECK(!audio_stream_); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 402 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 410 DCHECK(desktop_environment_); | 403 DCHECK(desktop_environment_); |
| 411 return desktop_environment_->GetDesktopSessionId(); | 404 return desktop_environment_->GetDesktopSessionId(); |
| 412 } | 405 } |
| 413 | 406 |
| 414 ClientSessionControl* ClientSession::session_control() { | 407 ClientSessionControl* ClientSession::session_control() { |
| 415 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 408 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 416 return this; | 409 return this; |
| 417 } | 410 } |
| 418 | 411 |
| 412 void ClientSession::RegisterCreateHandlerCallbackForTesting( |
| 413 const std::string& prefix, |
| 414 protocol::DataChannelManager::CreateHandlerCallback constructor) { |
| 415 data_channel_manager_.RegisterCreateHandlerCallback( |
| 416 prefix, std::move(constructor)); |
| 417 } |
| 418 |
| 419 void ClientSession::SetEventTimestampsSourceForTests( | 419 void ClientSession::SetEventTimestampsSourceForTests( |
| 420 scoped_refptr<protocol::InputEventTimestampsSource> | 420 scoped_refptr<protocol::InputEventTimestampsSource> |
| 421 event_timestamp_source) { | 421 event_timestamp_source) { |
| 422 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); | 422 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
| 423 event_timestamp_source_for_tests_ = event_timestamp_source; | 423 event_timestamp_source_for_tests_ = event_timestamp_source; |
| 424 if (video_stream_) | 424 if (video_stream_) |
| 425 video_stream_->SetEventTimestampsSource(event_timestamp_source_for_tests_); | 425 video_stream_->SetEventTimestampsSource(event_timestamp_source_for_tests_); |
| 426 } | 426 } |
| 427 | 427 |
| 428 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { | 428 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 connection_->client_stub()->SetVideoLayout(layout); | 469 connection_->client_stub()->SetVideoLayout(layout); |
| 470 } else { | 470 } else { |
| 471 pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); | 471 pending_video_layout_message_.reset(new protocol::VideoLayout(layout)); |
| 472 } | 472 } |
| 473 break; | 473 break; |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace remoting | 478 } // namespace remoting |
| OLD | NEW |