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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); | 583 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); |
584 } | 584 } |
585 | 585 |
586 void ArcBridgeService::SetState(State state) { | 586 void ArcBridgeService::SetState(State state) { |
587 DCHECK(CalledOnValidThread()); | 587 DCHECK(CalledOnValidThread()); |
588 // DCHECK on enum classes not supported. | 588 // DCHECK on enum classes not supported. |
589 DCHECK(state_ != state); | 589 DCHECK(state_ != state); |
590 state_ = state; | 590 state_ = state; |
591 VLOG(2) << "State: " << static_cast<uint32_t>(state_); | 591 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
592 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); | 592 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); |
| 593 if (state_ == State::READY) |
| 594 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeReady()); |
| 595 else if (state == State::STOPPED) |
| 596 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeStopped()); |
593 } | 597 } |
594 | 598 |
595 void ArcBridgeService::SetAvailable(bool available) { | 599 void ArcBridgeService::SetAvailable(bool available) { |
596 DCHECK(CalledOnValidThread()); | 600 DCHECK(CalledOnValidThread()); |
597 DCHECK(available_ != available); | 601 DCHECK(available_ != available); |
598 available_ = available; | 602 available_ = available; |
599 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); | 603 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); |
600 } | 604 } |
601 | 605 |
602 bool ArcBridgeService::CalledOnValidThread() { | 606 bool ArcBridgeService::CalledOnValidThread() { |
(...skipping 18 matching lines...) Expand all Loading... |
621 CloseObbMounterChannel(); | 625 CloseObbMounterChannel(); |
622 ClosePolicyChannel(); | 626 ClosePolicyChannel(); |
623 ClosePowerChannel(); | 627 ClosePowerChannel(); |
624 CloseProcessChannel(); | 628 CloseProcessChannel(); |
625 CloseStorageManagerChannel(); | 629 CloseStorageManagerChannel(); |
626 CloseVideoChannel(); | 630 CloseVideoChannel(); |
627 CloseWindowManagerChannel(); | 631 CloseWindowManagerChannel(); |
628 } | 632 } |
629 | 633 |
630 } // namespace arc | 634 } // namespace arc |
OLD | NEW |