| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 16 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| 17 #include "chrome/browser/chromeos/policy/android_management_client.h" | 17 #include "chrome/browser/chromeos/policy/android_management_client.h" |
| 18 #include "components/arc/arc_session_observer.h" | 18 #include "components/arc/arc_session_observer.h" |
| 19 #include "components/prefs/pref_change_registrar.h" | 19 #include "components/prefs/pref_change_registrar.h" |
| 20 #include "components/sync_preferences/pref_service_syncable_observer.h" | 20 #include "components/sync_preferences/pref_service_syncable_observer.h" |
| 21 #include "components/sync_preferences/synced_pref_observer.h" | |
| 22 | 21 |
| 23 class ArcAppLauncher; | 22 class ArcAppLauncher; |
| 24 class Profile; | 23 class Profile; |
| 25 | 24 |
| 26 namespace ash { | 25 namespace ash { |
| 27 class ShelfDelegate; | 26 class ShelfDelegate; |
| 28 } | 27 } |
| 29 | 28 |
| 30 namespace user_prefs { | 29 namespace user_prefs { |
| 31 class PrefRegistrySyncable; | 30 class PrefRegistrySyncable; |
| 32 } | 31 } |
| 33 | 32 |
| 34 namespace arc { | 33 namespace arc { |
| 35 | 34 |
| 36 class ArcAndroidManagementChecker; | 35 class ArcAndroidManagementChecker; |
| 37 class ArcAuthCodeFetcher; | 36 class ArcAuthCodeFetcher; |
| 38 class ArcAuthContext; | 37 class ArcAuthContext; |
| 39 class ArcSessionRunner; | 38 class ArcSessionRunner; |
| 40 class ArcTermsOfServiceNegotiator; | 39 class ArcTermsOfServiceNegotiator; |
| 41 enum class ProvisioningResult : int; | 40 enum class ProvisioningResult : int; |
| 42 | 41 |
| 43 // This class proxies the request from the client to fetch an auth code from | 42 // This class proxies the request from the client to fetch an auth code from |
| 44 // LSO. It lives on the UI thread. | 43 // LSO. It lives on the UI thread. |
| 45 class ArcSessionManager : public ArcSessionObserver, | 44 class ArcSessionManager : public ArcSessionObserver, |
| 46 public ArcSupportHost::Observer, | 45 public ArcSupportHost::Observer, |
| 47 public sync_preferences::PrefServiceSyncableObserver, | 46 public sync_preferences::PrefServiceSyncableObserver { |
| 48 public sync_preferences::SyncedPrefObserver { | |
| 49 public: | 47 public: |
| 50 // Represents each State of ARC session. | 48 // Represents each State of ARC session. |
| 51 // NOT_INITIALIZED: represents the state that the Profile is not yet ready | 49 // NOT_INITIALIZED: represents the state that the Profile is not yet ready |
| 52 // so that this service is not yet initialized, or Chrome is being shut | 50 // so that this service is not yet initialized, or Chrome is being shut |
| 53 // down so that this is destroyed. | 51 // down so that this is destroyed. |
| 54 // STOPPED: ARC session is not running, or being terminated. | 52 // STOPPED: ARC session is not running, or being terminated. |
| 55 // SHOWING_TERMS_OF_SERVICE: "Terms Of Service" page is shown on ARC support | 53 // SHOWING_TERMS_OF_SERVICE: "Terms Of Service" page is shown on ARC support |
| 56 // Chrome app. | 54 // Chrome app. |
| 57 // CHECKING_ANDROID_MANAGEMENT: Checking Android management status. Note that | 55 // CHECKING_ANDROID_MANAGEMENT: Checking Android management status. Note that |
| 58 // the status is checked for each ARC session starting, but this is the | 56 // the status is checked for each ARC session starting, but this is the |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 void EnableArc(); | 174 void EnableArc(); |
| 177 void DisableArc(); | 175 void DisableArc(); |
| 178 | 176 |
| 179 // Called from the Chrome OS metrics provider to record Arc.State | 177 // Called from the Chrome OS metrics provider to record Arc.State |
| 180 // periodically. | 178 // periodically. |
| 181 void RecordArcState(); | 179 void RecordArcState(); |
| 182 | 180 |
| 183 // sync_preferences::PrefServiceSyncableObserver | 181 // sync_preferences::PrefServiceSyncableObserver |
| 184 void OnIsSyncingChanged() override; | 182 void OnIsSyncingChanged() override; |
| 185 | 183 |
| 186 // sync_preferences::SyncedPrefObserver | |
| 187 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; | |
| 188 | |
| 189 // ArcSupportHost::Observer: | 184 // ArcSupportHost::Observer: |
| 190 void OnWindowClosed() override; | 185 void OnWindowClosed() override; |
| 191 void OnTermsAgreed(bool is_metrics_enabled, | 186 void OnTermsAgreed(bool is_metrics_enabled, |
| 192 bool is_backup_and_restore_enabled, | 187 bool is_backup_and_restore_enabled, |
| 193 bool is_location_service_enabled) override; | 188 bool is_location_service_enabled) override; |
| 194 void OnRetryClicked() override; | 189 void OnRetryClicked() override; |
| 195 void OnSendFeedbackClicked() override; | 190 void OnSendFeedbackClicked() override; |
| 196 | 191 |
| 197 // Stops ARC without changing ArcEnabled preference. | 192 // Stops ARC without changing ArcEnabled preference. |
| 198 void StopArc(); | 193 void StopArc(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 290 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 296 }; | 291 }; |
| 297 | 292 |
| 298 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 293 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 299 std::ostream& operator<<(std::ostream& os, | 294 std::ostream& operator<<(std::ostream& os, |
| 300 const ArcSessionManager::State& state); | 295 const ArcSessionManager::State& state); |
| 301 | 296 |
| 302 } // namespace arc | 297 } // namespace arc |
| 303 | 298 |
| 304 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 299 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |