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_AUTH_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 public mojom::AuthHost, | 52 public mojom::AuthHost, |
| 53 public ArcBridgeService::Observer, | 53 public ArcBridgeService::Observer, |
| 54 public InstanceHolder<mojom::AuthInstance>::Observer, | 54 public InstanceHolder<mojom::AuthInstance>::Observer, |
| 55 public ArcSupportHost::Observer, | 55 public ArcSupportHost::Observer, |
| 56 public ArcOptInPreferenceHandlerObserver, | 56 public ArcOptInPreferenceHandlerObserver, |
| 57 public ArcAuthContextDelegate, | 57 public ArcAuthContextDelegate, |
| 58 public ArcAuthCodeFetcherDelegate, | 58 public ArcAuthCodeFetcherDelegate, |
| 59 public sync_preferences::PrefServiceSyncableObserver, | 59 public sync_preferences::PrefServiceSyncableObserver, |
| 60 public sync_preferences::SyncedPrefObserver { | 60 public sync_preferences::SyncedPrefObserver { |
| 61 public: | 61 public: |
| 62 enum class State { | 62 enum class State { |
|
Luis Héctor Chávez
2016/11/10 23:30:58
Can you add a state transition diagram here simila
hidehiko
2016/11/14 10:55:09
Done.
| |
| 63 NOT_INITIALIZED, // Service is not initialized. | 63 NOT_INITIALIZED, // Service is not initialized. |
| 64 STOPPED, // ARC is not running. | 64 STOPPED, // ARC is not running. |
| 65 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. | 65 TERMS, // Showing "Terms Of Service" to user. |
|
Mr4D (OOO till 08-26)
2016/11/10 16:12:30
Could TERMS be replaced with something more expres
Luis Héctor Chávez
2016/11/10 23:30:58
Also, let's try to use a convention of using prese
hidehiko
2016/11/14 10:55:09
Done.
| |
| 66 ACTIVE, // ARC is running. | 66 ANDROID_MANAGEMENT_CHECK, // Checkng Android management status. |
|
Luis Héctor Chávez
2016/11/10 23:30:58
nit: s/Checkng/Checking/
hidehiko
2016/11/14 10:55:09
Done.
| |
| 67 FETCHING_CODE, // ARC is not yet running. Fetching auth token. | |
| 68 ACTIVE, // ARC is running. | |
| 67 }; | 69 }; |
| 68 | 70 |
| 69 class Observer { | 71 class Observer { |
| 70 public: | 72 public: |
| 71 virtual ~Observer() = default; | 73 virtual ~Observer() = default; |
| 72 | 74 |
| 73 // Called to notify that ARC bridge is shut down. | 75 // Called to notify that ARC bridge is shut down. |
| 74 virtual void OnShutdownBridge() {} | 76 virtual void OnShutdownBridge() {} |
| 75 | 77 |
| 76 // Called to notify that ARC enabled state has been updated. | 78 // Called to notify that ARC enabled state has been updated. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 // ArcAuthCodeFetcherDelegate: | 178 // ArcAuthCodeFetcherDelegate: |
| 177 void OnAuthCodeSuccess(const std::string& auth_code) override; | 179 void OnAuthCodeSuccess(const std::string& auth_code) override; |
| 178 void OnAuthCodeFailed() override; | 180 void OnAuthCodeFailed() override; |
| 179 | 181 |
| 180 // ArcSupportHost::Observer: | 182 // ArcSupportHost::Observer: |
| 181 void OnWindowClosed() override; | 183 void OnWindowClosed() override; |
| 182 void OnTermsAgreed(bool is_metrics_enabled, | 184 void OnTermsAgreed(bool is_metrics_enabled, |
| 183 bool is_backup_and_restore_enabled, | 185 bool is_backup_and_restore_enabled, |
| 184 bool is_location_service_enabled) override; | 186 bool is_location_service_enabled) override; |
| 185 void OnAuthSucceeded(const std::string& auth_code) override; | 187 void OnAuthSucceeded(const std::string& auth_code) override; |
| 188 void OnRetryClicked() override; | |
| 186 void OnSendFeedbackClicked() override; | 189 void OnSendFeedbackClicked() override; |
| 187 | 190 |
| 188 // arc::ArcOptInPreferenceHandlerObserver: | 191 // arc::ArcOptInPreferenceHandlerObserver: |
| 189 void OnMetricsModeChanged(bool enabled, bool managed) override; | 192 void OnMetricsModeChanged(bool enabled, bool managed) override; |
| 190 void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override; | 193 void OnBackupAndRestoreModeChanged(bool enabled, bool managed) override; |
| 191 void OnLocationServicesModeChanged(bool enabled, bool managed) override; | 194 void OnLocationServicesModeChanged(bool enabled, bool managed) override; |
| 192 | 195 |
| 193 // Stops ARC without changing ArcEnabled preference. | 196 // Stops ARC without changing ArcEnabled preference. |
| 194 void StopArc(); | 197 void StopArc(); |
| 195 | 198 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 219 void ShowUI(ArcSupportHost::UIPage page, const base::string16& status); | 222 void ShowUI(ArcSupportHost::UIPage page, const base::string16& status); |
| 220 void CloseUI(); | 223 void CloseUI(); |
| 221 void SetUIPage(ArcSupportHost::UIPage page, const base::string16& status); | 224 void SetUIPage(ArcSupportHost::UIPage page, const base::string16& status); |
| 222 void SetState(State state); | 225 void SetState(State state); |
| 223 void ShutdownBridge(); | 226 void ShutdownBridge(); |
| 224 void ShutdownBridgeAndCloseUI(); | 227 void ShutdownBridgeAndCloseUI(); |
| 225 void ShutdownBridgeAndShowUI(ArcSupportHost::UIPage page, | 228 void ShutdownBridgeAndShowUI(ArcSupportHost::UIPage page, |
| 226 const base::string16& status); | 229 const base::string16& status); |
| 227 void OnOptInPreferenceChanged(); | 230 void OnOptInPreferenceChanged(); |
| 228 void StartUI(); | 231 void StartUI(); |
| 229 void StartAndroidManagementClient(); | |
|
hidehiko
2016/11/10 01:46:23
Note: No implemention. No usage...
| |
| 230 void OnAndroidManagementPassed(); | 232 void OnAndroidManagementPassed(); |
| 231 void OnArcDataRemoved(bool success); | 233 void OnArcDataRemoved(bool success); |
| 232 void OnArcSignInTimeout(); | 234 void OnArcSignInTimeout(); |
| 233 bool IsAuthCodeRequest() const; | 235 bool IsAuthCodeRequest() const; |
| 234 void FetchAuthCode(); | 236 void FetchAuthCode(); |
| 235 void PrepareContextForAuthCodeRequest(); | 237 void PrepareContextForAuthCodeRequest(); |
| 236 void RequestAccountInfoInternal( | 238 void RequestAccountInfoInternal( |
| 237 std::unique_ptr<AccountInfoNotifier> account_info_notifier); | 239 std::unique_ptr<AccountInfoNotifier> account_info_notifier); |
| 238 void OnAccountInfoReady(mojom::AccountInfoPtr account_info); | 240 void OnAccountInfoReady(mojom::AccountInfoPtr account_info); |
| 239 | 241 |
| 242 void StartArcAndroidManagementCheck(); | |
| 243 | |
| 240 // Called when the Android management check is done in opt-in flow or | 244 // Called when the Android management check is done in opt-in flow or |
| 241 // re-auth flow. | 245 // re-auth flow. |
| 242 void OnAndroidManagementChecked( | 246 void OnAndroidManagementChecked( |
| 243 policy::AndroidManagementClient::Result result); | 247 policy::AndroidManagementClient::Result result); |
| 244 | 248 |
| 245 // Called when the background Android management check is done. It is | 249 // Called when the background Android management check is done. It is |
| 246 // triggered when the second or later ARC boot timing. | 250 // triggered when the second or later ARC boot timing. |
| 247 void OnBackgroundAndroidManagementChecked( | 251 void OnBackgroundAndroidManagementChecked( |
| 248 policy::AndroidManagementClient::Result result); | 252 policy::AndroidManagementClient::Result result); |
| 249 | 253 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 | 288 |
| 285 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 289 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 286 }; | 290 }; |
| 287 | 291 |
| 288 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 292 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 289 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 293 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 290 | 294 |
| 291 } // namespace arc | 295 } // namespace arc |
| 292 | 296 |
| 293 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 297 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |