Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(942)

Unified Diff: components/arc/arc_bridge_service.cc

Issue 2567083002: Migrate ArcBridgeService::Observer and ArcSession::Observer. (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_bridge_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_bridge_service.cc
diff --git a/components/arc/arc_bridge_service.cc b/components/arc/arc_bridge_service.cc
index b9b5d92567f4403bc6aab53dc09e6e1542e90244..73c96d862789f0e47385f3f2760037f3f422c445 100644
--- a/components/arc/arc_bridge_service.cc
+++ b/components/arc/arc_bridge_service.cc
@@ -23,7 +23,7 @@ const base::Feature kArcEnabledFeature{"EnableARC",
ArcBridgeService::ArcBridgeService()
: state_(State::STOPPED),
- stop_reason_(StopReason::SHUTDOWN),
+ stop_reason_(ArcSessionObserver::StopReason::SHUTDOWN),
weak_factory_(this) {}
ArcBridgeService::~ArcBridgeService() {
@@ -55,12 +55,12 @@ void ArcBridgeService::OnShutdown() {
NOTREACHED();
}
-void ArcBridgeService::AddObserver(Observer* observer) {
+void ArcBridgeService::AddObserver(ArcSessionObserver* observer) {
DCHECK(CalledOnValidThread());
observer_list_.AddObserver(observer);
}
-void ArcBridgeService::RemoveObserver(Observer* observer) {
+void ArcBridgeService::RemoveObserver(ArcSessionObserver* observer) {
DCHECK(CalledOnValidThread());
observer_list_.RemoveObserver(observer);
}
@@ -72,14 +72,15 @@ void ArcBridgeService::SetState(State state) {
VLOG(2) << "State: " << static_cast<uint32_t>(state_);
if (state_ == State::READY) {
for (auto& observer : observer_list())
- observer.OnBridgeReady();
+ observer.OnSessionReady();
} else if (state == State::STOPPED) {
for (auto& observer : observer_list())
- observer.OnBridgeStopped(stop_reason_);
+ observer.OnSessionStopped(stop_reason_);
}
}
-void ArcBridgeService::SetStopReason(StopReason stop_reason) {
+void ArcBridgeService::SetStopReason(
+ ArcSessionObserver::StopReason stop_reason) {
DCHECK(CalledOnValidThread());
stop_reason_ = stop_reason;
}
@@ -88,22 +89,4 @@ bool ArcBridgeService::CalledOnValidThread() {
return thread_checker_.CalledOnValidThread();
}
-std::ostream& operator<<(
- std::ostream& os, ArcBridgeService::StopReason reason) {
- switch (reason) {
-#define CASE_IMPL(val) \
- case ArcBridgeService::StopReason::val: \
- return os << #val
-
- CASE_IMPL(SHUTDOWN);
- CASE_IMPL(GENERIC_BOOT_FAILURE);
- CASE_IMPL(LOW_DISK_SPACE);
- CASE_IMPL(CRASH);
-#undef CASE_IMPL
- }
-
- // In case of unexpected value, output the int value.
- return os << "StopReason(" << static_cast<int>(reason) << ")";
-}
-
} // namespace arc
« no previous file with comments | « components/arc/arc_bridge_service.h ('k') | components/arc/arc_bridge_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698