Chromium Code Reviews| Index: components/arc/arc_session.h |
| diff --git a/components/arc/arc_session.h b/components/arc/arc_session.h |
| index 25aeede5de523d4a4dac0010b85be5fcbd3d2cf0..7791fd69953e6b64fa1afac8c9147d1e1809d200 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; |
|
Yusuke Sato
2017/03/01 15:51:01
'git grep ArcSessionObserver' please, just to make
hidehiko
2017/03/01 17:28:03
Yes, I had done, and no ArcSessionObserver should
|
| - |
| // Starts the ARC instance and bootstraps the bridge connection. |
| // Clients should implement the Delegate to be notified upon communications |
| // being available. |
| @@ -28,6 +27,21 @@ class ArcSessionObserver; |
| // conflict. |
| class ArcSession { |
| public: |
| + class Observer { |
|
Yusuke Sato
2017/03/01 15:51:01
nit: comment on who should use it?
hidehiko
2017/03/01 17:28:02
I added a brief comment, thought I wonder if it is
|
| + 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: |
| + // Do not directly create/destroy the instance via the interface. |
| + Observer() = default; |
| + ~Observer() = default; |
| + }; |
| + |
| // Creates a default instance of ArcSession. |
| static std::unique_ptr<ArcSession> Create( |
| ArcBridgeService* arc_bridge_service, |
| @@ -47,13 +61,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); |