| 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/chromoting_host.h" | 5 #include "remoting/host/chromoting_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 video_encode_task_runner_(video_encode_task_runner), | 75 video_encode_task_runner_(video_encode_task_runner), |
| 76 network_task_runner_(network_task_runner), | 76 network_task_runner_(network_task_runner), |
| 77 ui_task_runner_(ui_task_runner), | 77 ui_task_runner_(ui_task_runner), |
| 78 signal_strategy_(signal_strategy), | 78 signal_strategy_(signal_strategy), |
| 79 started_(false), | 79 started_(false), |
| 80 protocol_config_(protocol::CandidateSessionConfig::CreateDefault()), | 80 protocol_config_(protocol::CandidateSessionConfig::CreateDefault()), |
| 81 login_backoff_(&kDefaultBackoffPolicy), | 81 login_backoff_(&kDefaultBackoffPolicy), |
| 82 authenticating_client_(false), | 82 authenticating_client_(false), |
| 83 reject_authenticating_client_(false), | 83 reject_authenticating_client_(false), |
| 84 enable_curtaining_(false), | 84 enable_curtaining_(false), |
| 85 enable_gnubby_auth_(false), |
| 85 weak_factory_(this) { | 86 weak_factory_(this) { |
| 86 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 87 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 87 DCHECK(signal_strategy); | 88 DCHECK(signal_strategy); |
| 88 | 89 |
| 89 // VP9 encode is not yet supported. | 90 // VP9 encode is not yet supported. |
| 90 protocol::CandidateSessionConfig::DisableVideoCodec( | 91 protocol::CandidateSessionConfig::DisableVideoCodec( |
| 91 protocol_config_.get(), protocol::ChannelConfig::CODEC_VP9); | 92 protocol_config_.get(), protocol::ChannelConfig::CODEC_VP9); |
| 92 | 93 |
| 93 if (!desktop_environment_factory_->SupportsAudioCapture()) { | 94 if (!desktop_environment_factory_->SupportsAudioCapture()) { |
| 94 protocol::CandidateSessionConfig::DisableAudioChannel( | 95 protocol::CandidateSessionConfig::DisableAudioChannel( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // curtained sessions. | 163 // curtained sessions. |
| 163 if (enable_curtaining_) | 164 if (enable_curtaining_) |
| 164 DisconnectAllClients(); | 165 DisconnectAllClients(); |
| 165 } | 166 } |
| 166 | 167 |
| 167 void ChromotingHost::SetMaximumSessionDuration( | 168 void ChromotingHost::SetMaximumSessionDuration( |
| 168 const base::TimeDelta& max_session_duration) { | 169 const base::TimeDelta& max_session_duration) { |
| 169 max_session_duration_ = max_session_duration; | 170 max_session_duration_ = max_session_duration; |
| 170 } | 171 } |
| 171 | 172 |
| 173 void ChromotingHost::SetEnableGnubbyAuth(bool enable) { |
| 174 enable_gnubby_auth_ = enable; |
| 175 } |
| 176 |
| 172 //////////////////////////////////////////////////////////////////////////// | 177 //////////////////////////////////////////////////////////////////////////// |
| 173 // protocol::ClientSession::EventHandler implementation. | 178 // protocol::ClientSession::EventHandler implementation. |
| 174 bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) { | 179 bool ChromotingHost::OnSessionAuthenticated(ClientSession* client) { |
| 175 DCHECK(CalledOnValidThread()); | 180 DCHECK(CalledOnValidThread()); |
| 176 | 181 |
| 177 login_backoff_.Reset(); | 182 login_backoff_.Reset(); |
| 178 | 183 |
| 179 // Disconnect all other clients. |it| should be advanced before Disconnect() | 184 // Disconnect all other clients. |it| should be advanced before Disconnect() |
| 180 // is called to avoid it becoming invalid when the client is removed from | 185 // is called to avoid it becoming invalid when the client is removed from |
| 181 // the list. | 186 // the list. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 this, | 301 this, |
| 297 audio_task_runner_, | 302 audio_task_runner_, |
| 298 input_task_runner_, | 303 input_task_runner_, |
| 299 video_capture_task_runner_, | 304 video_capture_task_runner_, |
| 300 video_encode_task_runner_, | 305 video_encode_task_runner_, |
| 301 network_task_runner_, | 306 network_task_runner_, |
| 302 ui_task_runner_, | 307 ui_task_runner_, |
| 303 connection.Pass(), | 308 connection.Pass(), |
| 304 desktop_environment_factory_, | 309 desktop_environment_factory_, |
| 305 max_session_duration_, | 310 max_session_duration_, |
| 306 pairing_registry_); | 311 pairing_registry_, |
| 312 enable_gnubby_auth_); |
| 307 clients_.push_back(client); | 313 clients_.push_back(client); |
| 308 } | 314 } |
| 309 | 315 |
| 310 void ChromotingHost::set_protocol_config( | 316 void ChromotingHost::set_protocol_config( |
| 311 scoped_ptr<protocol::CandidateSessionConfig> config) { | 317 scoped_ptr<protocol::CandidateSessionConfig> config) { |
| 312 DCHECK(CalledOnValidThread()); | 318 DCHECK(CalledOnValidThread()); |
| 313 DCHECK(config.get()); | 319 DCHECK(config.get()); |
| 314 DCHECK(!started_); | 320 DCHECK(!started_); |
| 315 protocol_config_ = config.Pass(); | 321 protocol_config_ = config.Pass(); |
| 316 } | 322 } |
| 317 | 323 |
| 318 void ChromotingHost::DisconnectAllClients() { | 324 void ChromotingHost::DisconnectAllClients() { |
| 319 DCHECK(CalledOnValidThread()); | 325 DCHECK(CalledOnValidThread()); |
| 320 | 326 |
| 321 while (!clients_.empty()) { | 327 while (!clients_.empty()) { |
| 322 size_t size = clients_.size(); | 328 size_t size = clients_.size(); |
| 323 clients_.front()->DisconnectSession(); | 329 clients_.front()->DisconnectSession(); |
| 324 CHECK_EQ(clients_.size(), size - 1); | 330 CHECK_EQ(clients_.size(), size - 1); |
| 325 } | 331 } |
| 326 } | 332 } |
| 327 | 333 |
| 328 } // namespace remoting | 334 } // namespace remoting |
| OLD | NEW |