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 30 matching lines...) Expand all Loading... |
41 namespace { | 41 namespace { |
42 | 42 |
43 // Name of command-line flag to disable use of I444 by default. | 43 // Name of command-line flag to disable use of I444 by default. |
44 const char kDisableI444SwitchName[] = "disable-i444"; | 44 const char kDisableI444SwitchName[] = "disable-i444"; |
45 | 45 |
46 std::unique_ptr<AudioEncoder> CreateAudioEncoder( | 46 std::unique_ptr<AudioEncoder> CreateAudioEncoder( |
47 const protocol::SessionConfig& config) { | 47 const protocol::SessionConfig& config) { |
48 const protocol::ChannelConfig& audio_config = config.audio_config(); | 48 const protocol::ChannelConfig& audio_config = config.audio_config(); |
49 | 49 |
50 if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { | 50 if (audio_config.codec == protocol::ChannelConfig::CODEC_VERBATIM) { |
51 return base::WrapUnique(new AudioEncoderVerbatim()); | 51 return base::MakeUnique<AudioEncoderVerbatim>(); |
52 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { | 52 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { |
53 return base::WrapUnique(new AudioEncoderOpus()); | 53 return base::MakeUnique<AudioEncoderOpus>(); |
54 } | 54 } |
55 | 55 |
56 NOTREACHED(); | 56 NOTREACHED(); |
57 return nullptr; | 57 return nullptr; |
58 } | 58 } |
59 | 59 |
60 } // namespace | 60 } // namespace |
61 | 61 |
62 ClientSession::ClientSession( | 62 ClientSession::ClientSession( |
63 EventHandler* event_handler, | 63 EventHandler* event_handler, |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 const protocol::Capabilities& capabilities) { | 182 const protocol::Capabilities& capabilities) { |
183 DCHECK(CalledOnValidThread()); | 183 DCHECK(CalledOnValidThread()); |
184 | 184 |
185 // Ignore all the messages but the 1st one. | 185 // Ignore all the messages but the 1st one. |
186 if (client_capabilities_) { | 186 if (client_capabilities_) { |
187 LOG(WARNING) << "protocol::Capabilities has been received already."; | 187 LOG(WARNING) << "protocol::Capabilities has been received already."; |
188 return; | 188 return; |
189 } | 189 } |
190 | 190 |
191 // Compute the set of capabilities supported by both client and host. | 191 // Compute the set of capabilities supported by both client and host. |
192 client_capabilities_ = base::WrapUnique(new std::string()); | 192 client_capabilities_ = base::MakeUnique<std::string>(); |
193 if (capabilities.has_capabilities()) | 193 if (capabilities.has_capabilities()) |
194 *client_capabilities_ = capabilities.capabilities(); | 194 *client_capabilities_ = capabilities.capabilities(); |
195 capabilities_ = IntersectCapabilities(*client_capabilities_, | 195 capabilities_ = IntersectCapabilities(*client_capabilities_, |
196 host_capabilities_); | 196 host_capabilities_); |
197 extension_manager_->OnNegotiatedCapabilities( | 197 extension_manager_->OnNegotiatedCapabilities( |
198 connection_->client_stub(), capabilities_); | 198 connection_->client_stub(), capabilities_); |
199 | 199 |
200 VLOG(1) << "Client capabilities: " << *client_capabilities_; | 200 VLOG(1) << "Client capabilities: " << *client_capabilities_; |
201 | 201 |
202 desktop_environment_->SetCapabilities(capabilities_); | 202 desktop_environment_->SetCapabilities(capabilities_); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } | 443 } |
444 | 444 |
445 ClientSessionControl* ClientSession::session_control() { | 445 ClientSessionControl* ClientSession::session_control() { |
446 DCHECK(CalledOnValidThread()); | 446 DCHECK(CalledOnValidThread()); |
447 return this; | 447 return this; |
448 } | 448 } |
449 | 449 |
450 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { | 450 std::unique_ptr<protocol::ClipboardStub> ClientSession::CreateClipboardProxy() { |
451 DCHECK(CalledOnValidThread()); | 451 DCHECK(CalledOnValidThread()); |
452 | 452 |
453 return base::WrapUnique( | 453 return base::MakeUnique<protocol::ClipboardThreadProxy>( |
454 new protocol::ClipboardThreadProxy(client_clipboard_factory_.GetWeakPtr(), | 454 client_clipboard_factory_.GetWeakPtr(), |
455 base::ThreadTaskRunnerHandle::Get())); | 455 base::ThreadTaskRunnerHandle::Get()); |
456 } | 456 } |
457 | 457 |
458 void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream, | 458 void ClientSession::OnVideoSizeChanged(protocol::VideoStream* video_stream, |
459 const webrtc::DesktopSize& size, | 459 const webrtc::DesktopSize& size, |
460 const webrtc::DesktopVector& dpi) { | 460 const webrtc::DesktopVector& dpi) { |
461 DCHECK(CalledOnValidThread()); | 461 DCHECK(CalledOnValidThread()); |
462 | 462 |
463 mouse_clamping_filter_.set_output_size(size); | 463 mouse_clamping_filter_.set_output_size(size); |
464 | 464 |
465 switch (connection_->session()->config().protocol()) { | 465 switch (connection_->session()->config().protocol()) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
501 void ClientSession::OnVideoFrameSent(protocol::VideoStream* stream, | 501 void ClientSession::OnVideoFrameSent(protocol::VideoStream* stream, |
502 uint32_t frame_id, | 502 uint32_t frame_id, |
503 int64_t input_event_timestamp) { | 503 int64_t input_event_timestamp) { |
504 // TODO(sergeyu): Send a message to the client to notify about the new frame. | 504 // TODO(sergeyu): Send a message to the client to notify about the new frame. |
505 } | 505 } |
506 | 506 |
507 } // namespace remoting | 507 } // namespace remoting |
OLD | NEW |