| 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/feature_list.h" | 10 #include "base/feature_list.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 void ArcBridgeService::RemoveObserver(ArcSessionObserver* observer) { | 63 void ArcBridgeService::RemoveObserver(ArcSessionObserver* observer) { |
| 64 DCHECK(CalledOnValidThread()); | 64 DCHECK(CalledOnValidThread()); |
| 65 observer_list_.RemoveObserver(observer); | 65 observer_list_.RemoveObserver(observer); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void ArcBridgeService::SetState(State state) { | 68 void ArcBridgeService::SetState(State state) { |
| 69 DCHECK(CalledOnValidThread()); | 69 DCHECK(CalledOnValidThread()); |
| 70 DCHECK_NE(state_, state); | 70 DCHECK_NE(state_, state); |
| 71 state_ = state; | 71 state_ = state; |
| 72 VLOG(2) << "State: " << static_cast<uint32_t>(state_); | 72 VLOG(2) << "State: " << static_cast<uint32_t>(state_); |
| 73 if (state_ == State::READY) { | 73 if (state_ == State::RUNNING) { |
| 74 for (auto& observer : observer_list()) | 74 for (auto& observer : observer_list()) |
| 75 observer.OnSessionReady(); | 75 observer.OnSessionReady(); |
| 76 } else if (state == State::STOPPED) { | 76 } else if (state == State::STOPPED) { |
| 77 for (auto& observer : observer_list()) | 77 for (auto& observer : observer_list()) |
| 78 observer.OnSessionStopped(stop_reason_); | 78 observer.OnSessionStopped(stop_reason_); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void ArcBridgeService::SetStopReason( | 82 void ArcBridgeService::SetStopReason( |
| 83 ArcSessionObserver::StopReason stop_reason) { | 83 ArcSessionObserver::StopReason stop_reason) { |
| 84 DCHECK(CalledOnValidThread()); | 84 DCHECK(CalledOnValidThread()); |
| 85 stop_reason_ = stop_reason; | 85 stop_reason_ = stop_reason; |
| 86 } | 86 } |
| 87 | 87 |
| 88 bool ArcBridgeService::CalledOnValidThread() { | 88 bool ArcBridgeService::CalledOnValidThread() { |
| 89 return thread_checker_.CalledOnValidThread(); | 89 return thread_checker_.CalledOnValidThread(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace arc | 92 } // namespace arc |
| OLD | NEW |