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 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); | 525 FOR_EACH_OBSERVER(Observer, observer_list(), OnWindowManagerInstanceClosed()); |
526 } | 526 } |
527 | 527 |
528 void ArcBridgeService::SetState(State state) { | 528 void ArcBridgeService::SetState(State state) { |
529 DCHECK(CalledOnValidThread()); | 529 DCHECK(CalledOnValidThread()); |
530 // DCHECK on enum classes not supported. | 530 // DCHECK on enum classes not supported. |
531 DCHECK(state_ != state); | 531 DCHECK(state_ != state); |
532 state_ = state; | 532 state_ = state; |
533 VLOG(2) << "State: " << static_cast<uint32_t>(state_); | 533 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
534 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); | 534 FOR_EACH_OBSERVER(Observer, observer_list(), OnStateChanged(state_)); |
| 535 if (state_ == State::READY) |
| 536 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeReady()); |
| 537 else if (state == State::STOPPED) |
| 538 FOR_EACH_OBSERVER(Observer, observer_list(), OnBridgeStopped()); |
535 } | 539 } |
536 | 540 |
537 void ArcBridgeService::SetAvailable(bool available) { | 541 void ArcBridgeService::SetAvailable(bool available) { |
538 DCHECK(CalledOnValidThread()); | 542 DCHECK(CalledOnValidThread()); |
539 DCHECK(available_ != available); | 543 DCHECK(available_ != available); |
540 available_ = available; | 544 available_ = available; |
541 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); | 545 FOR_EACH_OBSERVER(Observer, observer_list(), OnAvailableChanged(available_)); |
542 } | 546 } |
543 | 547 |
544 bool ArcBridgeService::CalledOnValidThread() { | 548 bool ArcBridgeService::CalledOnValidThread() { |
(...skipping 16 matching lines...) Expand all Loading... |
561 CloseNotificationsChannel(); | 565 CloseNotificationsChannel(); |
562 ClosePolicyChannel(); | 566 ClosePolicyChannel(); |
563 ClosePowerChannel(); | 567 ClosePowerChannel(); |
564 CloseProcessChannel(); | 568 CloseProcessChannel(); |
565 CloseStorageManagerChannel(); | 569 CloseStorageManagerChannel(); |
566 CloseVideoChannel(); | 570 CloseVideoChannel(); |
567 CloseWindowManagerChannel(); | 571 CloseWindowManagerChannel(); |
568 } | 572 } |
569 | 573 |
570 } // namespace arc | 574 } // namespace arc |
OLD | NEW |