OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/arc/arc_bridge_service.h" | 5 #include "components/arc/arc_bridge_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
494 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); | 494 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); |
495 } | 495 } |
496 | 496 |
497 void ArcBridgeService::SetState(State state) { | 497 void ArcBridgeService::SetState(State state) { |
498 DCHECK(CalledOnValidThread()); | 498 DCHECK(CalledOnValidThread()); |
499 // DCHECK on enum classes not supported. | 499 // DCHECK on enum classes not supported. |
500 DCHECK(state_ != state); | 500 DCHECK(state_ != state); |
501 state_ = state; | 501 state_ = state; |
502 VLOG(2) << "State: " << static_cast<uint32_t>(state_); | 502 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
503 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); | 503 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); |
504 if (state_ == State::READY) | |
505 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeReady()); | |
506 if (state == State::STOPPED) | |
Luis Héctor Chávez
2016/05/19 16:10:27
nit: else if
dspaid
2016/05/20 07:27:07
Done.
| |
507 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeStopped()); | |
504 } | 508 } |
505 | 509 |
506 void ArcBridgeService::SetAvailable(bool available) { | 510 void ArcBridgeService::SetAvailable(bool available) { |
507 DCHECK(CalledOnValidThread()); | 511 DCHECK(CalledOnValidThread()); |
508 DCHECK(available_ != available); | 512 DCHECK(available_ != available); |
509 available_ = available; | 513 available_ = available; |
510 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); | 514 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); |
511 } | 515 } |
512 | 516 |
513 bool ArcBridgeService::CalledOnValidThread() { | 517 bool ArcBridgeService::CalledOnValidThread() { |
(...skipping 15 matching lines...) Expand all Loading... | |
529 CloseNetChannel(); | 533 CloseNetChannel(); |
530 CloseNotificationsChannel(); | 534 CloseNotificationsChannel(); |
531 ClosePolicyChannel(); | 535 ClosePolicyChannel(); |
532 ClosePowerChannel(); | 536 ClosePowerChannel(); |
533 CloseProcessChannel(); | 537 CloseProcessChannel(); |
534 CloseVideoChannel(); | 538 CloseVideoChannel(); |
535 CloseWindowManagerChannel(); | 539 CloseWindowManagerChannel(); |
536 } | 540 } |
537 | 541 |
538 } // namespace arc | 542 } // namespace arc |
OLD | NEW |