Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: remoting/host/client_session.cc

Issue 565263006: Remove legacy version of the control channel protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/message_loop/message_loop_proxy.h" 9 #include "base/message_loop/message_loop_proxy.h"
10 #include "remoting/base/capabilities.h" 10 #include "remoting/base/capabilities.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 << audio_control.enable() << ")"; 169 << audio_control.enable() << ")";
170 if (audio_scheduler_.get()) 170 if (audio_scheduler_.get())
171 audio_scheduler_->Pause(!audio_control.enable()); 171 audio_scheduler_->Pause(!audio_control.enable());
172 } 172 }
173 } 173 }
174 174
175 void ClientSession::SetCapabilities( 175 void ClientSession::SetCapabilities(
176 const protocol::Capabilities& capabilities) { 176 const protocol::Capabilities& capabilities) {
177 DCHECK(CalledOnValidThread()); 177 DCHECK(CalledOnValidThread());
178 178
179 // The client should not send protocol::Capabilities if it is not supported by
180 // the config channel.
181 if (!connection_->session()->config().SupportsCapabilities()) {
182 LOG(ERROR) << "Unexpected protocol::Capabilities has been received.";
183 return;
184 }
185
186 // Ignore all the messages but the 1st one. 179 // Ignore all the messages but the 1st one.
187 if (client_capabilities_) { 180 if (client_capabilities_) {
188 LOG(WARNING) << "protocol::Capabilities has been received already."; 181 LOG(WARNING) << "protocol::Capabilities has been received already.";
189 return; 182 return;
190 } 183 }
191 184
192 // Compute the set of capabilities supported by both client and host. 185 // Compute the set of capabilities supported by both client and host.
193 client_capabilities_ = make_scoped_ptr(new std::string()); 186 client_capabilities_ = make_scoped_ptr(new std::string());
194 if (capabilities.has_capabilities()) 187 if (capabilities.has_capabilities())
195 *client_capabilities_ = capabilities.capabilities(); 188 *client_capabilities_ = capabilities.capabilities();
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // Create the desktop environment. Drop the connection if it could not be 274 // Create the desktop environment. Drop the connection if it could not be
282 // created for any reason (for instance the curtain could not initialize). 275 // created for any reason (for instance the curtain could not initialize).
283 desktop_environment_ = 276 desktop_environment_ =
284 desktop_environment_factory_->Create(control_factory_.GetWeakPtr()); 277 desktop_environment_factory_->Create(control_factory_.GetWeakPtr());
285 if (!desktop_environment_) { 278 if (!desktop_environment_) {
286 DisconnectSession(); 279 DisconnectSession();
287 return; 280 return;
288 } 281 }
289 282
290 // Collate the set of capabilities to offer the client, if it supports them. 283 // Collate the set of capabilities to offer the client, if it supports them.
291 if (connection_->session()->config().SupportsCapabilities()) { 284 host_capabilities_ = desktop_environment_->GetCapabilities();
292 host_capabilities_ = desktop_environment_->GetCapabilities(); 285 if (!host_capabilities_.empty())
293 if (!host_capabilities_.empty()) { 286 host_capabilities_.append(" ");
294 host_capabilities_.append(" "); 287 host_capabilities_.append(extension_manager_->GetCapabilities());
295 }
296 host_capabilities_.append(extension_manager_->GetCapabilities());
297 } else {
298 VLOG(1) << "The client does not support any capabilities.";
299 desktop_environment_->SetCapabilities(std::string());
300 }
301 288
302 // Create the object that controls the screen resolution. 289 // Create the object that controls the screen resolution.
303 screen_controls_ = desktop_environment_->CreateScreenControls(); 290 screen_controls_ = desktop_environment_->CreateScreenControls();
304 291
305 // Create the event executor. 292 // Create the event executor.
306 input_injector_ = desktop_environment_->CreateInputInjector(); 293 input_injector_ = desktop_environment_->CreateInputInjector();
307 294
308 // Connect the host clipboard and input stubs. 295 // Connect the host clipboard and input stubs.
309 host_input_filter_.set_input_stub(input_injector_.get()); 296 host_input_filter_.set_input_stub(input_injector_.get());
310 clipboard_echo_filter_.set_host_stub(input_injector_.get()); 297 clipboard_echo_filter_.set_host_stub(input_injector_.get());
(...skipping 14 matching lines...) Expand all
325 gnubby_auth_handler_ = desktop_environment_->CreateGnubbyAuthHandler( 312 gnubby_auth_handler_ = desktop_environment_->CreateGnubbyAuthHandler(
326 connection_->client_stub()); 313 connection_->client_stub());
327 } 314 }
328 315
329 void ClientSession::OnConnectionChannelsConnected( 316 void ClientSession::OnConnectionChannelsConnected(
330 protocol::ConnectionToClient* connection) { 317 protocol::ConnectionToClient* connection) {
331 DCHECK(CalledOnValidThread()); 318 DCHECK(CalledOnValidThread());
332 DCHECK_EQ(connection_.get(), connection); 319 DCHECK_EQ(connection_.get(), connection);
333 320
334 // Negotiate capabilities with the client. 321 // Negotiate capabilities with the client.
335 if (connection_->session()->config().SupportsCapabilities()) { 322 VLOG(1) << "Host capabilities: " << host_capabilities_;
336 VLOG(1) << "Host capabilities: " << host_capabilities_;
337 323
338 protocol::Capabilities capabilities; 324 protocol::Capabilities capabilities;
339 capabilities.set_capabilities(host_capabilities_); 325 capabilities.set_capabilities(host_capabilities_);
340 connection_->client_stub()->SetCapabilities(capabilities); 326 connection_->client_stub()->SetCapabilities(capabilities);
341 }
342 327
343 // Start the event executor. 328 // Start the event executor.
344 input_injector_->Start(CreateClipboardProxy()); 329 input_injector_->Start(CreateClipboardProxy());
345 SetDisableInputs(false); 330 SetDisableInputs(false);
346 331
347 // Start recording video. 332 // Start recording video.
348 ResetVideoPipeline(); 333 ResetVideoPipeline();
349 334
350 // Start recording audio. 335 // Start recording audio.
351 if (connection_->session()->config().is_audio_enabled()) 336 if (connection_->session()->config().is_audio_enabled())
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim()); 514 return scoped_ptr<AudioEncoder>(new AudioEncoderVerbatim());
530 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) { 515 } else if (audio_config.codec == protocol::ChannelConfig::CODEC_OPUS) {
531 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus()); 516 return scoped_ptr<AudioEncoder>(new AudioEncoderOpus());
532 } 517 }
533 518
534 NOTREACHED(); 519 NOTREACHED();
535 return scoped_ptr<AudioEncoder>(); 520 return scoped_ptr<AudioEncoder>();
536 } 521 }
537 522
538 } // namespace remoting 523 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698