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

Unified Diff: components/arc/arc_session_observer.h

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_session.cc ('k') | components/arc/arc_session_observer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_session_observer.h
diff --git a/components/arc/arc_session_observer.h b/components/arc/arc_session_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..2751e35ec7bc24b3abab4d6f216cffbcef06d7ec
--- /dev/null
+++ b/components/arc/arc_session_observer.h
@@ -0,0 +1,48 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_
+#define COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_
+
+#include <ostream>
+
+namespace arc {
+
+// Interface to observe the ARC instance running state.
+class ArcSessionObserver {
+ public:
+ // Describes the reason the ARC instance is stopped.
+ enum class StopReason {
+ // ARC instance has been gracefully shut down.
+ SHUTDOWN,
+
+ // Errors occurred during the ARC instance boot. This includes any failures
+ // before the instance is actually attempted to be started, and also
+ // failures on bootstrapping IPC channels with Android.
+ GENERIC_BOOT_FAILURE,
+
+ // The device is critically low on disk space.
+ LOW_DISK_SPACE,
+
+ // ARC instance has crashed.
+ CRASH,
+ };
+
+ virtual ~ArcSessionObserver() = default;
+
+ // Called when the connection with ARC instance has been established.
+ virtual void OnSessionReady() {}
+
+ // Called when ARC instance is stopped. This is called exactly once
+ // per instance which is Start()ed.
+ virtual void OnSessionStopped(StopReason reason) {}
+};
+
+// Defines "<<" operator for LOGging purpose.
+std::ostream& operator<<(std::ostream& os,
+ ArcSessionObserver::StopReason reason);
+
+} // namespace arc
+
+#endif // COMPONENTS_ARC_ARC_SESSION_OBSERVER_H_
« no previous file with comments | « components/arc/arc_session.cc ('k') | components/arc/arc_session_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698