Chromium Code Reviews| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 | 332 |
| 333 // Create a client object. | 333 // Create a client object. |
| 334 scoped_ptr<protocol::ConnectionToClient> connection( | 334 scoped_ptr<protocol::ConnectionToClient> connection( |
| 335 new protocol::ConnectionToClient(session)); | 335 new protocol::ConnectionToClient(session)); |
| 336 ClientSession* client = new ClientSession( | 336 ClientSession* client = new ClientSession( |
| 337 this, connection.Pass(), desktop_environment_->event_executor(), | 337 this, connection.Pass(), desktop_environment_->event_executor(), |
| 338 desktop_environment_->capturer()); | 338 desktop_environment_->capturer()); |
| 339 clients_.push_back(client); | 339 clients_.push_back(client); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void ChromotingHost::set_protocol_config( | 342 void ChromotingHost::OnMouseMoved(const SkIPoint& new_pos) { |
| 343 protocol::CandidateSessionConfig* config) { | |
| 344 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); | |
| 345 DCHECK(config); | |
| 346 DCHECK_EQ(state_, kInitial); | |
| 347 protocol_config_.reset(config); | |
| 348 } | |
|
Jamie
2012/05/25 21:19:24
Did these functions need to be re-ordered? AFACT,
Sergey Ulanov
2012/05/25 21:59:30
I reordered them so that they are in the same orde
| |
| 349 | |
| 350 void ChromotingHost::LocalMouseMoved(const SkIPoint& new_pos) { | |
| 351 if (!context_->network_message_loop()->BelongsToCurrentThread()) { | 343 if (!context_->network_message_loop()->BelongsToCurrentThread()) { |
| 352 context_->network_message_loop()->PostTask( | 344 context_->network_message_loop()->PostTask( |
| 353 FROM_HERE, base::Bind(&ChromotingHost::LocalMouseMoved, this, new_pos)); | 345 FROM_HERE, base::Bind(&ChromotingHost::OnMouseMoved, this, new_pos)); |
| 354 return; | 346 return; |
| 355 } | 347 } |
| 356 | 348 |
| 357 ClientList::iterator client; | 349 ClientList::iterator client; |
| 358 for (client = clients_.begin(); client != clients_.end(); ++client) { | 350 for (client = clients_.begin(); client != clients_.end(); ++client) { |
| 359 (*client)->LocalMouseMoved(new_pos); | 351 (*client)->LocalMouseMoved(new_pos); |
| 360 } | 352 } |
| 361 } | 353 } |
| 362 | 354 |
| 355 void ChromotingHost::set_protocol_config( | |
| 356 protocol::CandidateSessionConfig* config) { | |
| 357 DCHECK(context_->network_message_loop()->BelongsToCurrentThread()); | |
| 358 DCHECK(config); | |
| 359 DCHECK_EQ(state_, kInitial); | |
| 360 protocol_config_.reset(config); | |
| 361 } | |
| 362 | |
| 363 void ChromotingHost::PauseSession(bool pause) { | 363 void ChromotingHost::PauseSession(bool pause) { |
| 364 if (!context_->network_message_loop()->BelongsToCurrentThread()) { | 364 if (!context_->network_message_loop()->BelongsToCurrentThread()) { |
| 365 context_->network_message_loop()->PostTask( | 365 context_->network_message_loop()->PostTask( |
| 366 FROM_HERE, base::Bind(&ChromotingHost::PauseSession, this, pause)); | 366 FROM_HERE, base::Bind(&ChromotingHost::PauseSession, this, pause)); |
| 367 return; | 367 return; |
| 368 } | 368 } |
| 369 | 369 |
| 370 ClientList::iterator client; | 370 ClientList::iterator client; |
| 371 for (client = clients_.begin(); client != clients_.end(); ++client) { | 371 for (client = clients_.begin(); client != clients_.end(); ++client) { |
| 372 (*client)->SetDisableInputs(pause); | 372 (*client)->SetDisableInputs(pause); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 435 OnShutdown()); | 435 OnShutdown()); |
| 436 | 436 |
| 437 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 437 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
| 438 it != shutdown_tasks_.end(); ++it) { | 438 it != shutdown_tasks_.end(); ++it) { |
| 439 it->Run(); | 439 it->Run(); |
| 440 } | 440 } |
| 441 shutdown_tasks_.clear(); | 441 shutdown_tasks_.clear(); |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace remoting | 444 } // namespace remoting |
| OLD | NEW |