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

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

Issue 11028128: [Chromoting] Request the daemon to open a terminal once a connection has been accepted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromoting_host.h" 5 #include "remoting/host/chromoting_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "remoting/base/constants.h" 12 #include "remoting/base/constants.h"
13 #include "remoting/host/chromoting_host_context.h" 13 #include "remoting/host/chromoting_host_context.h"
14 #include "remoting/host/desktop_environment.h"
15 #include "remoting/host/desktop_environment_factory.h" 14 #include "remoting/host/desktop_environment_factory.h"
16 #include "remoting/host/event_executor.h" 15 #include "remoting/host/event_executor.h"
17 #include "remoting/host/host_config.h" 16 #include "remoting/host/host_config.h"
18 #include "remoting/protocol/connection_to_client.h" 17 #include "remoting/protocol/connection_to_client.h"
19 #include "remoting/protocol/client_stub.h" 18 #include "remoting/protocol/client_stub.h"
20 #include "remoting/protocol/host_stub.h" 19 #include "remoting/protocol/host_stub.h"
21 #include "remoting/protocol/input_stub.h" 20 #include "remoting/protocol/input_stub.h"
22 #include "remoting/protocol/session_config.h" 21 #include "remoting/protocol/session_config.h"
23 22
24 using remoting::protocol::ConnectionToClient; 23 using remoting::protocol::ConnectionToClient;
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 *response = protocol::SessionManager::INCOMPATIBLE; 299 *response = protocol::SessionManager::INCOMPATIBLE;
301 return; 300 return;
302 } 301 }
303 302
304 session->set_config(config); 303 session->set_config(config);
305 304
306 *response = protocol::SessionManager::ACCEPT; 305 *response = protocol::SessionManager::ACCEPT;
307 306
308 LOG(INFO) << "Client connected: " << session->jid(); 307 LOG(INFO) << "Client connected: " << session->jid();
309 308
310 // Create the desktop integration implementation for the client to use.
311 scoped_ptr<DesktopEnvironment> desktop_environment =
312 desktop_environment_factory_->Create();
313
314 // Create a client object. 309 // Create a client object.
315 scoped_ptr<protocol::ConnectionToClient> connection( 310 scoped_ptr<protocol::ConnectionToClient> connection(
316 new protocol::ConnectionToClient(session)); 311 new protocol::ConnectionToClient(session));
317 scoped_refptr<ClientSession> client = new ClientSession( 312 scoped_refptr<ClientSession> client = new ClientSession(
318 this, 313 this,
319 capture_task_runner_, 314 capture_task_runner_,
320 encode_task_runner_, 315 encode_task_runner_,
321 network_task_runner_, 316 network_task_runner_,
322 connection.Pass(), 317 connection.Pass(),
323 desktop_environment.Pass(), 318 desktop_environment_factory_,
324 max_session_duration_); 319 max_session_duration_);
325 clients_.push_back(client); 320 clients_.push_back(client);
326 clients_count_++; 321 clients_count_++;
327 } 322 }
328 323
329 void ChromotingHost::set_protocol_config( 324 void ChromotingHost::set_protocol_config(
330 scoped_ptr<protocol::CandidateSessionConfig> config) { 325 scoped_ptr<protocol::CandidateSessionConfig> config) {
331 DCHECK(network_task_runner_->BelongsToCurrentThread()); 326 DCHECK(network_task_runner_->BelongsToCurrentThread());
332 DCHECK(config.get()); 327 DCHECK(config.get());
333 DCHECK_EQ(state_, kInitial); 328 DCHECK_EQ(state_, kInitial);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return; 363 return;
369 } 364 }
370 365
371 while (!clients_.empty()) { 366 while (!clients_.empty()) {
372 size_t size = clients_.size(); 367 size_t size = clients_.size();
373 clients_.front()->Disconnect(); 368 clients_.front()->Disconnect();
374 CHECK_EQ(clients_.size(), size - 1); 369 CHECK_EQ(clients_.size(), size - 1);
375 } 370 }
376 } 371 }
377 372
373 void ChromotingHost::DisconnectClient(DesktopEnvironment* desktop_environment) {
374 DCHECK(network_task_runner_->BelongsToCurrentThread());
375
376 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) {
377 if ((*i)->desktop_environment() == desktop_environment) {
378 (*i)->Disconnect();
379 break;
380 }
381 }
382 }
383
378 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) { 384 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) {
379 DCHECK(network_task_runner_->BelongsToCurrentThread()); 385 DCHECK(network_task_runner_->BelongsToCurrentThread());
380 DCHECK_EQ(state_, kInitial); 386 DCHECK_EQ(state_, kInitial);
381 387
382 ui_strings_ = ui_strings; 388 ui_strings_ = ui_strings;
383 } 389 }
384 390
385 void ChromotingHost::OnClientStopped() { 391 void ChromotingHost::OnClientStopped() {
386 DCHECK(network_task_runner_->BelongsToCurrentThread()); 392 DCHECK(network_task_runner_->BelongsToCurrentThread());
387 393
(...skipping 25 matching lines...) Expand all
413 OnShutdown()); 419 OnShutdown());
414 420
415 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); 421 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin();
416 it != shutdown_tasks_.end(); ++it) { 422 it != shutdown_tasks_.end(); ++it) {
417 it->Run(); 423 it->Run();
418 } 424 }
419 shutdown_tasks_.clear(); 425 shutdown_tasks_.clear();
420 } 426 }
421 427
422 } // namespace remoting 428 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698