| 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 "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" |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 302 } |
| 303 | 303 |
| 304 session->set_config(config); | 304 session->set_config(config); |
| 305 | 305 |
| 306 *response = protocol::SessionManager::ACCEPT; | 306 *response = protocol::SessionManager::ACCEPT; |
| 307 | 307 |
| 308 LOG(INFO) << "Client connected: " << session->jid(); | 308 LOG(INFO) << "Client connected: " << session->jid(); |
| 309 | 309 |
| 310 // Create the desktop integration implementation for the client to use. | 310 // Create the desktop integration implementation for the client to use. |
| 311 scoped_ptr<DesktopEnvironment> desktop_environment = | 311 scoped_ptr<DesktopEnvironment> desktop_environment = |
| 312 desktop_environment_factory_->Create(); | 312 desktop_environment_factory_->Create(this); |
| 313 | 313 |
| 314 // Create a client object. | 314 // Create a client object. |
| 315 scoped_ptr<protocol::ConnectionToClient> connection( | 315 scoped_ptr<protocol::ConnectionToClient> connection( |
| 316 new protocol::ConnectionToClient(session)); | 316 new protocol::ConnectionToClient(session)); |
| 317 scoped_refptr<ClientSession> client = new ClientSession( | 317 scoped_refptr<ClientSession> client = new ClientSession( |
| 318 this, | 318 this, |
| 319 capture_task_runner_, | 319 capture_task_runner_, |
| 320 encode_task_runner_, | 320 encode_task_runner_, |
| 321 network_task_runner_, | 321 network_task_runner_, |
| 322 connection.Pass(), | 322 connection.Pass(), |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return; | 368 return; |
| 369 } | 369 } |
| 370 | 370 |
| 371 while (!clients_.empty()) { | 371 while (!clients_.empty()) { |
| 372 size_t size = clients_.size(); | 372 size_t size = clients_.size(); |
| 373 clients_.front()->Disconnect(); | 373 clients_.front()->Disconnect(); |
| 374 CHECK_EQ(clients_.size(), size - 1); | 374 CHECK_EQ(clients_.size(), size - 1); |
| 375 } | 375 } |
| 376 } | 376 } |
| 377 | 377 |
| 378 void ChromotingHost::DisconnectClient(DesktopEnvironment* desktop_environment) { |
| 379 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 380 |
| 381 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) { |
| 382 if ((*i)->desktop_environment() == desktop_environment) { |
| 383 (*i)->Disconnect(); |
| 384 break; |
| 385 } |
| 386 } |
| 387 } |
| 388 |
| 378 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) { | 389 void ChromotingHost::SetUiStrings(const UiStrings& ui_strings) { |
| 379 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 390 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 380 DCHECK_EQ(state_, kInitial); | 391 DCHECK_EQ(state_, kInitial); |
| 381 | 392 |
| 382 ui_strings_ = ui_strings; | 393 ui_strings_ = ui_strings; |
| 383 } | 394 } |
| 384 | 395 |
| 385 void ChromotingHost::OnClientStopped() { | 396 void ChromotingHost::OnClientStopped() { |
| 386 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 397 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
| 387 | 398 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 413 OnShutdown()); | 424 OnShutdown()); |
| 414 | 425 |
| 415 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 426 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
| 416 it != shutdown_tasks_.end(); ++it) { | 427 it != shutdown_tasks_.end(); ++it) { |
| 417 it->Run(); | 428 it->Run(); |
| 418 } | 429 } |
| 419 shutdown_tasks_.clear(); | 430 shutdown_tasks_.clear(); |
| 420 } | 431 } |
| 421 | 432 |
| 422 } // namespace remoting | 433 } // namespace remoting |
| OLD | NEW |