Chromium Code Reviews| 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> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. | 87 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. |
| 88 // | 88 // |
| 89 // In the second (or later) boot case: | 89 // In the second (or later) boot case: |
| 90 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is | 90 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is |
| 91 // true. Practically, this is when the primary Profile gets ready. | 91 // true. Practically, this is when the primary Profile gets ready. |
| 92 enum class State { | 92 enum class State { |
| 93 NOT_INITIALIZED, | 93 NOT_INITIALIZED, |
| 94 STOPPED, | 94 STOPPED, |
| 95 SHOWING_TERMS_OF_SERVICE, | 95 SHOWING_TERMS_OF_SERVICE, |
| 96 CHECKING_ANDROID_MANAGEMENT, | 96 CHECKING_ANDROID_MANAGEMENT, |
| 97 DELETING_DATA_FOLDER, | |
|
hidehiko
2016/12/06 05:05:30
REMOVING_DATA_DIR or REMOVING_DATA_DIRECTORY for c
khmel
2016/12/06 18:16:13
Good catch.
| |
| 97 ACTIVE, | 98 ACTIVE, |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 class Observer { | 101 class Observer { |
| 101 public: | 102 public: |
| 102 virtual ~Observer() = default; | 103 virtual ~Observer() = default; |
| 103 | 104 |
| 104 // Called to notify that ARC bridge is shut down. | 105 // Called to notify that ARC bridge is shut down. |
| 105 virtual void OnShutdownBridge() {} | 106 virtual void OnShutdownBridge() {} |
| 106 | 107 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 void SetState(State state); | 210 void SetState(State state); |
| 210 void ShutdownBridge(); | 211 void ShutdownBridge(); |
| 211 void OnOptInPreferenceChanged(); | 212 void OnOptInPreferenceChanged(); |
| 212 void OnAndroidManagementPassed(); | 213 void OnAndroidManagementPassed(); |
| 213 void OnArcDataRemoved(bool success); | 214 void OnArcDataRemoved(bool success); |
| 214 void OnArcSignInTimeout(); | 215 void OnArcSignInTimeout(); |
| 215 void FetchAuthCode(); | 216 void FetchAuthCode(); |
| 216 void PrepareContextForAuthCodeRequest(); | 217 void PrepareContextForAuthCodeRequest(); |
| 217 | 218 |
| 218 void StartArcAndroidManagementCheck(); | 219 void StartArcAndroidManagementCheck(); |
| 220 void MaybeReenableArc(); | |
| 219 | 221 |
| 220 // Called when the Android management check is done in opt-in flow or | 222 // Called when the Android management check is done in opt-in flow or |
| 221 // re-auth flow. | 223 // re-auth flow. |
| 222 void OnAndroidManagementChecked( | 224 void OnAndroidManagementChecked( |
| 223 policy::AndroidManagementClient::Result result); | 225 policy::AndroidManagementClient::Result result); |
| 224 | 226 |
| 225 // Called when the background Android management check is done. It is | 227 // Called when the background Android management check is done. It is |
| 226 // triggered when the second or later ARC boot timing. | 228 // triggered when the second or later ARC boot timing. |
| 227 void OnBackgroundAndroidManagementChecked( | 229 void OnBackgroundAndroidManagementChecked( |
| 228 policy::AndroidManagementClient::Result result); | 230 policy::AndroidManagementClient::Result result); |
| 229 | 231 |
| 230 // Unowned pointer. Keeps current profile. | 232 // Unowned pointer. Keeps current profile. |
| 231 Profile* profile_ = nullptr; | 233 Profile* profile_ = nullptr; |
| 232 | 234 |
| 233 // Registrar used to monitor ARC enabled state. | 235 // Registrar used to monitor ARC enabled state. |
| 234 PrefChangeRegistrar pref_change_registrar_; | 236 PrefChangeRegistrar pref_change_registrar_; |
| 235 | 237 |
| 236 State state_ = State::NOT_INITIALIZED; | 238 State state_ = State::NOT_INITIALIZED; |
| 237 base::ObserverList<Observer> observer_list_; | 239 base::ObserverList<Observer> observer_list_; |
| 238 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 240 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 239 bool clear_required_ = false; | |
| 240 bool reenable_arc_ = false; | 241 bool reenable_arc_ = false; |
| 241 base::OneShotTimer arc_sign_in_timer_; | 242 base::OneShotTimer arc_sign_in_timer_; |
| 242 | 243 |
| 243 std::unique_ptr<ArcSupportHost> support_host_; | 244 std::unique_ptr<ArcSupportHost> support_host_; |
| 244 | 245 |
| 245 std::unique_ptr<ArcTermsOfServiceNegotiator> terms_of_service_negotiator_; | 246 std::unique_ptr<ArcTermsOfServiceNegotiator> terms_of_service_negotiator_; |
| 246 | 247 |
| 247 std::unique_ptr<ArcAuthContext> context_; | 248 std::unique_ptr<ArcAuthContext> context_; |
| 248 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; | 249 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; |
| 249 | 250 |
| 250 base::Time sign_in_time_; | 251 base::Time sign_in_time_; |
| 251 | 252 |
| 252 base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_; | 253 base::WeakPtrFactory<ArcSessionManager> weak_ptr_factory_; |
| 253 | 254 |
| 254 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 255 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 255 }; | 256 }; |
| 256 | 257 |
| 257 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 258 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 258 std::ostream& operator<<(std::ostream& os, | 259 std::ostream& operator<<(std::ostream& os, |
| 259 const ArcSessionManager::State& state); | 260 const ArcSessionManager::State& state); |
| 260 | 261 |
| 261 } // namespace arc | 262 } // namespace arc |
| 262 | 263 |
| 263 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 264 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |