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

Unified Diff: components/arc/arc_session.h

Issue 2720303002: Do nothing on OnSessionStopped if ARC is being restarted. (Closed)
Patch Set: Address comments. Created 3 years, 10 months 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/BUILD.gn ('k') | components/arc/arc_session.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/arc/arc_session.h
diff --git a/components/arc/arc_session.h b/components/arc/arc_session.h
index 25aeede5de523d4a4dac0010b85be5fcbd3d2cf0..4f9f38747abc5ec7e572e68342701760e0515568 100644
--- a/components/arc/arc_session.h
+++ b/components/arc/arc_session.h
@@ -14,11 +14,10 @@
#include "base/single_thread_task_runner.h"
#include "base/task_runner.h"
#include "components/arc/arc_bridge_service.h"
+#include "components/arc/arc_stop_reason.h"
namespace arc {
-class ArcSessionObserver;
-
// Starts the ARC instance and bootstraps the bridge connection.
// Clients should implement the Delegate to be notified upon communications
// being available.
@@ -28,6 +27,20 @@ class ArcSessionObserver;
// conflict.
class ArcSession {
public:
+ // Observer to notify events corresponding to one ARC session run.
+ class Observer {
+ public:
+ // Called when the connection with ARC instance has been established.
+ virtual void OnSessionReady() = 0;
+
+ // Called when ARC instance is stopped. This is called exactly once
+ // per instance which is Start()ed.
+ virtual void OnSessionStopped(ArcStopReason reason) = 0;
+
+ protected:
+ virtual ~Observer() = default;
+ };
+
// Creates a default instance of ArcSession.
static std::unique_ptr<ArcSession> Create(
ArcBridgeService* arc_bridge_service,
@@ -47,13 +60,13 @@ class ArcSession {
// loop is already stopped, and the instance will soon be deleted.
virtual void OnShutdown() = 0;
- void AddObserver(ArcSessionObserver* observer);
- void RemoveObserver(ArcSessionObserver* observer);
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
protected:
ArcSession();
- base::ObserverList<ArcSessionObserver> observer_list_;
+ base::ObserverList<Observer> observer_list_;
private:
DISALLOW_COPY_AND_ASSIGN(ArcSession);
« no previous file with comments | « components/arc/BUILD.gn ('k') | components/arc/arc_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698