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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 71 // | 71 // |
| 72 // State transition should be as follows: | 72 // State transition should be as follows: |
| 73 // | 73 // |
| 74 // NOT_INITIALIZED -> STOPPED: when the primary Profile gets ready. | 74 // NOT_INITIALIZED -> STOPPED: when the primary Profile gets ready. |
| 75 // ...(any)... -> NOT_INITIALIZED: when the Chrome is being shutdown. | 75 // ...(any)... -> NOT_INITIALIZED: when the Chrome is being shutdown. |
| 76 // ...(any)... -> STOPPED: on error. | 76 // ...(any)... -> STOPPED: on error. |
| 77 // | 77 // |
| 78 // In the first boot case (no OOBE case): | 78 // In the first boot case (no OOBE case): |
| 79 // STOPPED -> SHOWING_TERMS_OF_SERVICE: when arc.enabled preference is set. | 79 // STOPPED -> SHOWING_TERMS_OF_SERVICE: when arc.enabled preference is set. |
| 80 // SHOWING_TERMS_OF_SERVICE -> CHECKING_ANDROID_MANAGEMENT: when a user | 80 // SHOWING_TERMS_OF_SERVICE -> CHECKING_ANDROID_MANAGEMENT: when a user |
| 81 // agree with "Terms Of Service" | 81 // accepts "Terms Of Service" |
|
hidehiko
2016/12/20 15:20:45
Wow, thanks!
khmel
2016/12/20 16:27:58
Acknowledged.
| |
| 82 // CHECKING_ANDROID_MANAGEMENT -> FETCHING_CODE: when Android management | 82 // CHECKING_ANDROID_MANAGEMENT -> FETCHING_CODE: when Android management |
| 83 // check passes. | 83 // check passes. |
| 84 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. | 84 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. |
| 85 // | 85 // |
| 86 // In the first boot case (OOBE case): | 86 // In the first boot case (OOBE case): |
| 87 // STOPPED -> FETCHING_CODE: When arc.enabled preference is set. | 87 // STOPPED -> FETCHING_CODE: When arc.enabled preference is set. |
| 88 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. | 88 // FETCHING_CODE -> ACTIVE: when the auth token is successfully fetched. |
| 89 // | 89 // |
| 90 // In the second (or later) boot case: | 90 // In the second (or later) boot case: |
| 91 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is | 91 // STOPPED -> ACTIVE: when arc.enabled preference is checked that it is |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 void RecordArcState(); | 172 void RecordArcState(); |
| 173 | 173 |
| 174 // sync_preferences::PrefServiceSyncableObserver | 174 // sync_preferences::PrefServiceSyncableObserver |
| 175 void OnIsSyncingChanged() override; | 175 void OnIsSyncingChanged() override; |
| 176 | 176 |
| 177 // sync_preferences::SyncedPrefObserver | 177 // sync_preferences::SyncedPrefObserver |
| 178 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; | 178 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; |
| 179 | 179 |
| 180 // ArcSupportHost::Observer: | 180 // ArcSupportHost::Observer: |
| 181 void OnWindowClosed() override; | 181 void OnWindowClosed() override; |
| 182 void OnTermsAgreed(bool is_metrics_enabled, | 182 void OnTermsAccepted(bool is_metrics_enabled, |
| 183 bool is_backup_and_restore_enabled, | 183 bool is_backup_and_restore_enabled, |
| 184 bool is_location_service_enabled) override; | 184 bool is_location_service_enabled) override; |
| 185 void OnRetryClicked() override; | 185 void OnRetryClicked() override; |
| 186 void OnSendFeedbackClicked() override; | 186 void OnSendFeedbackClicked() override; |
| 187 | 187 |
| 188 // Stops ARC without changing ArcEnabled preference. | 188 // Stops ARC without changing ArcEnabled preference. |
| 189 void StopArc(); | 189 void StopArc(); |
| 190 | 190 |
| 191 // StopArc(), then EnableArc(). Between them data clear may happens. | 191 // StopArc(), then EnableArc(). Between them data clear may happens. |
| 192 // This is a special method to support enterprise device lost case. | 192 // This is a special method to support enterprise device lost case. |
| 193 // This can be called only when ARC is running. | 193 // This can be called only when ARC is running. |
| 194 void StopAndEnableArc(); | 194 void StopAndEnableArc(); |
| 195 | 195 |
| 196 // Removes the data if ARC is stopped. Otherwise, queue to remove the data | 196 // Removes the data if ARC is stopped. Otherwise, queue to remove the data |
| 197 // on ARC is stopped. | 197 // on ARC is stopped. |
| 198 void RemoveArcData(); | 198 void RemoveArcData(); |
| 199 | 199 |
| 200 ArcSupportHost* support_host() { return support_host_.get(); } | 200 ArcSupportHost* support_host() { return support_host_.get(); } |
| 201 | 201 |
| 202 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext | 202 // TODO(hidehiko): Get rid of the getter by migration between ArcAuthContext |
| 203 // and ArcAuthCodeFetcher. | 203 // and ArcAuthCodeFetcher. |
| 204 ArcAuthContext* auth_context() { return context_.get(); } | 204 ArcAuthContext* auth_context() { return context_.get(); } |
| 205 | 205 |
| 206 void StartArc(); | 206 void StartArc(); |
| 207 | 207 |
| 208 void OnProvisioningFinished(ProvisioningResult result); | 208 void OnProvisioningFinished(ProvisioningResult result); |
| 209 | 209 |
| 210 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); | 210 void SetAttemptUserExitCallbackForTesting(const base::Closure& callback); |
| 211 | 211 |
| 212 private: | 212 private: |
| 213 // Negotiates the terms of service to user. | 213 // Negotiates the terms of service to user. |
| 214 void StartTermsOfServiceNegotiation(); | 214 void StartTermsOfServiceNegotiation(bool initial_run); |
| 215 void OnTermsOfServiceNegotiated(bool accepted); | 215 void OnTermsOfServiceNegotiated(bool accepted); |
| 216 | 216 |
| 217 void SetState(State state); | 217 void SetState(State state); |
| 218 void ShutdownBridge(); | 218 void ShutdownBridge(); |
| 219 void OnOptInPreferenceChanged(); | 219 void OnOptInPreferenceChanged(bool initial_run); |
| 220 void OnAndroidManagementPassed(); | 220 void OnAndroidManagementPassed(); |
| 221 void OnArcDataRemoved(bool success); | 221 void OnArcDataRemoved(bool success); |
| 222 void OnArcSignInTimeout(); | 222 void OnArcSignInTimeout(); |
| 223 void FetchAuthCode(); | 223 void FetchAuthCode(); |
| 224 void PrepareContextForAuthCodeRequest(); | 224 void PrepareContextForAuthCodeRequest(); |
| 225 | 225 |
| 226 void StartArcAndroidManagementCheck(); | 226 void StartArcAndroidManagementCheck(); |
| 227 void MaybeReenableArc(); | 227 void MaybeReenableArc(); |
| 228 | 228 |
| 229 // Called when the Android management check is done in opt-in flow or | 229 // Called when the Android management check is done in opt-in flow or |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 264 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); | 264 DISALLOW_COPY_AND_ASSIGN(ArcSessionManager); |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 267 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 268 std::ostream& operator<<(std::ostream& os, | 268 std::ostream& operator<<(std::ostream& os, |
| 269 const ArcSessionManager::State& state); | 269 const ArcSessionManager::State& state); |
| 270 | 270 |
| 271 } // namespace arc | 271 } // namespace arc |
| 272 | 272 |
| 273 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ | 273 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_SESSION_MANAGER_H_ |
| OLD | NEW |