Chromium Code Reviews| Index: chrome/browser/chromeos/arc/arc_session_manager.h |
| diff --git a/chrome/browser/chromeos/arc/arc_session_manager.h b/chrome/browser/chromeos/arc/arc_session_manager.h |
| index fba0655f2cd7932501d2c4b18af762c6ef266a8b..0407b7f9fc35b2e35f7b7d50615a245ab505c318 100644 |
| --- a/chrome/browser/chromeos/arc/arc_session_manager.h |
| +++ b/chrome/browser/chromeos/arc/arc_session_manager.h |
| @@ -15,7 +15,8 @@ |
| #include "base/timer/timer.h" |
| #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| #include "chrome/browser/chromeos/policy/android_management_client.h" |
| -#include "components/arc/arc_session_observer.h" |
| +#include "components/arc/arc_session_runner.h" |
| +#include "components/arc/arc_stop_reason.h" |
| #include "components/prefs/pref_change_registrar.h" |
| #include "components/sync_preferences/pref_service_syncable_observer.h" |
| @@ -31,13 +32,12 @@ namespace arc { |
| class ArcAndroidManagementChecker; |
| class ArcAuthInfoFetcher; |
| class ArcAuthContext; |
| -class ArcSessionRunner; |
| class ArcTermsOfServiceNegotiator; |
| enum class ProvisioningResult : int; |
| // This class proxies the request from the client to fetch an auth code from |
| // LSO. It lives on the UI thread. |
| -class ArcSessionManager : public ArcSessionObserver, |
| +class ArcSessionManager : public ArcSessionRunner::Observer, |
| public ArcSupportHost::Observer, |
| public sync_preferences::PrefServiceSyncableObserver { |
| public: |
| @@ -85,10 +85,9 @@ class ArcSessionManager : public ArcSessionObserver, |
| ACTIVE, |
| }; |
| + // Observer for those services outside of ARC which want to know ARC events. |
| class Observer { |
| public: |
| - virtual ~Observer() = default; |
| - |
| // Called to notify that whether Google Play Store is enabled or not, which |
| // is represented by "arc.enabled" preference, is updated. |
| virtual void OnArcPlayStoreEnabledChanged(bool enabled) {} |
| @@ -96,9 +95,18 @@ class ArcSessionManager : public ArcSessionObserver, |
| // Called to notify that ARC has been initialized successfully. |
| virtual void OnArcInitialStart() {} |
| + // Called when ARC session is stopped, and is not being restarted |
| + // automatically. |
| + virtual void OnArcSessionStopped(ArcStopReason stop_reason) {} |
| + |
| // Called to notify that Android data has been removed. Used in |
| // browser_tests |
| virtual void OnArcDataRemoved() {} |
| + |
| + protected: |
| + // Do not directly create/destroy the instance via the interface. |
| + Observer() = default; |
| + ~Observer() = default; |
|
Yusuke Sato
2017/03/01 15:51:01
qq: Thanks. Read the discussion. Is there any prac
hidehiko
2017/03/01 17:28:02
As for your example, no, it won't. However, it is
Yusuke Sato
2017/03/01 17:40:24
Sorry if my comment above was not clear enough, bu
hidehiko
2017/03/01 17:49:41
Sure, done.
Note that, removed ctor, too, consider
Luis Héctor Chávez
2017/03/01 18:26:52
I'll add this for posterity in the ARC++ style gui
hidehiko
2017/03/01 18:43:02
SG. Thanks!
|
| }; |
| explicit ArcSessionManager( |
| @@ -145,12 +153,6 @@ class ArcSessionManager : public ArcSessionObserver, |
| void AddObserver(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| - // Adds or removes ArcSessionObservers. |
| - // TODO(hidehiko): The observer should be migrated into |
| - // ArcSessionManager::Observer. |
| - void AddSessionObserver(ArcSessionObserver* observer); |
| - void RemoveSessionObserver(ArcSessionObserver* observer); |
| - |
| // Returns true if ARC instance is running/stopped, respectively. |
| // See ArcSessionRunner::IsRunning()/IsStopped() for details. |
| bool IsSessionRunning() const; |
| @@ -261,9 +263,8 @@ class ArcSessionManager : public ArcSessionObserver, |
| void OnBackgroundAndroidManagementChecked( |
| policy::AndroidManagementClient::Result result); |
| - // ArcSessionObserver: |
| - void OnSessionReady() override; |
| - void OnSessionStopped(StopReason reason) override; |
| + // ArcSessionRunner::Observer: |
| + void OnSessionStopped(ArcStopReason reason, bool restarting) override; |
| std::unique_ptr<ArcSessionRunner> arc_session_runner_; |
| @@ -280,7 +281,6 @@ class ArcSessionManager : public ArcSessionObserver, |
| // Internal state machine. See also State enum class. |
| State state_ = State::NOT_INITIALIZED; |
| base::ObserverList<Observer> observer_list_; |
| - base::ObserverList<ArcSessionObserver> arc_session_observer_list_; |
| std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| bool reenable_arc_ = false; |
| bool provisioning_reported_ = false; |