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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 } | 322 } |
323 | 323 |
324 void ChromotingHost::set_protocol_config( | 324 void ChromotingHost::set_protocol_config( |
325 scoped_ptr<protocol::CandidateSessionConfig> config) { | 325 scoped_ptr<protocol::CandidateSessionConfig> config) { |
326 DCHECK(network_task_runner_->BelongsToCurrentThread()); | 326 DCHECK(network_task_runner_->BelongsToCurrentThread()); |
327 DCHECK(config.get()); | 327 DCHECK(config.get()); |
328 DCHECK_EQ(state_, kInitial); | 328 DCHECK_EQ(state_, kInitial); |
329 protocol_config_ = config.Pass(); | 329 protocol_config_ = config.Pass(); |
330 } | 330 } |
331 | 331 |
332 void ChromotingHost::PauseSession(bool pause) { | |
333 if (!network_task_runner_->BelongsToCurrentThread()) { | |
334 network_task_runner_->PostTask( | |
335 FROM_HERE, base::Bind(&ChromotingHost::PauseSession, this, pause)); | |
336 return; | |
337 } | |
338 | |
339 ClientList::iterator client; | |
340 for (client = clients_.begin(); client != clients_.end(); ++client) { | |
341 (*client)->SetDisableInputs(pause); | |
342 } | |
343 } | |
344 | |
345 void ChromotingHost::DisconnectAllClients() { | 332 void ChromotingHost::DisconnectAllClients() { |
346 if (!network_task_runner_->BelongsToCurrentThread()) { | 333 if (!network_task_runner_->BelongsToCurrentThread()) { |
347 network_task_runner_->PostTask( | 334 network_task_runner_->PostTask( |
348 FROM_HERE, base::Bind(&ChromotingHost::DisconnectAllClients, this)); | 335 FROM_HERE, base::Bind(&ChromotingHost::DisconnectAllClients, this)); |
349 return; | 336 return; |
350 } | 337 } |
351 | 338 |
352 while (!clients_.empty()) { | 339 while (!clients_.empty()) { |
353 size_t size = clients_.size(); | 340 size_t size = clients_.size(); |
354 clients_.front()->DisconnectSession(); | 341 clients_.front()->DisconnectSession(); |
(...skipping 26 matching lines...) Expand all Loading... |
381 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); | 368 for (std::vector<base::Closure>::iterator it = shutdown_tasks_.begin(); |
382 it != shutdown_tasks_.end(); ++it) { | 369 it != shutdown_tasks_.end(); ++it) { |
383 it->Run(); | 370 it->Run(); |
384 } | 371 } |
385 shutdown_tasks_.clear(); | 372 shutdown_tasks_.clear(); |
386 | 373 |
387 weak_factory_.InvalidateWeakPtrs(); | 374 weak_factory_.InvalidateWeakPtrs(); |
388 } | 375 } |
389 | 376 |
390 } // namespace remoting | 377 } // namespace remoting |
OLD | NEW |