| 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 22 matching lines...) Expand all Loading... |
| 33 class PrefRegistrySyncable; | 33 class PrefRegistrySyncable; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace arc { | 36 namespace arc { |
| 37 | 37 |
| 38 class ArcAndroidManagementChecker; | 38 class ArcAndroidManagementChecker; |
| 39 class ArcAuthContext; | 39 class ArcAuthContext; |
| 40 | 40 |
| 41 // This class proxies the request from the client to fetch an auth code from | 41 // This class proxies the request from the client to fetch an auth code from |
| 42 // LSO. | 42 // LSO. |
| 43 class ArcAuthService : public ArcService, | 43 class ArcAuthService |
| 44 public mojom::AuthHost, | 44 : public ArcService, |
| 45 public ArcBridgeService::Observer, | 45 public mojom::AuthHost, |
| 46 public ArcAndroidManagementCheckerDelegate, | 46 public ArcBridgeService::Observer, |
| 47 public ArcAuthContextDelegate, | 47 public ArcBridgeService::InstanceObserver<mojom::AuthInstance>, |
| 48 public syncable_prefs::PrefServiceSyncableObserver, | 48 public ArcAndroidManagementCheckerDelegate, |
| 49 public syncable_prefs::SyncedPrefObserver { | 49 public ArcAuthContextDelegate, |
| 50 public syncable_prefs::PrefServiceSyncableObserver, |
| 51 public syncable_prefs::SyncedPrefObserver { |
| 50 public: | 52 public: |
| 51 enum class State { | 53 enum class State { |
| 52 NOT_INITIALIZED, // Service is not initialized. | 54 NOT_INITIALIZED, // Service is not initialized. |
| 53 STOPPED, // ARC is not running. | 55 STOPPED, // ARC is not running. |
| 54 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. | 56 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. |
| 55 ACTIVE, // ARC is running. | 57 ACTIVE, // ARC is running. |
| 56 }; | 58 }; |
| 57 | 59 |
| 58 enum class UIPage { | 60 enum class UIPage { |
| 59 NO_PAGE, // Hide everything. | 61 NO_PAGE, // Hide everything. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 116 |
| 115 State state() const { return state_; } | 117 State state() const { return state_; } |
| 116 | 118 |
| 117 std::string GetAndResetAuthCode(); | 119 std::string GetAndResetAuthCode(); |
| 118 | 120 |
| 119 // Adds or removes observers. | 121 // Adds or removes observers. |
| 120 void AddObserver(Observer* observer); | 122 void AddObserver(Observer* observer); |
| 121 void RemoveObserver(Observer* observer); | 123 void RemoveObserver(Observer* observer); |
| 122 | 124 |
| 123 // ArcBridgeService::Observer: | 125 // ArcBridgeService::Observer: |
| 124 void OnAuthInstanceReady() override; | |
| 125 void OnBridgeStopped() override; | 126 void OnBridgeStopped() override; |
| 126 | 127 |
| 128 // ArcBridgeService::InstanceObserver<mojom::AuthInstance>: |
| 129 void OnInstanceReady(mojom::AuthInstance* auth_instance, |
| 130 uint32_t version) override; |
| 131 |
| 127 // AuthHost: | 132 // AuthHost: |
| 128 // For security reason this code can be used only once and exists for specific | 133 // For security reason this code can be used only once and exists for specific |
| 129 // period of time. | 134 // period of time. |
| 130 void GetAuthCodeDeprecated( | 135 void GetAuthCodeDeprecated( |
| 131 const GetAuthCodeDeprecatedCallback& callback) override; | 136 const GetAuthCodeDeprecatedCallback& callback) override; |
| 132 void GetAuthCode(const GetAuthCodeCallback& callback) override; | 137 void GetAuthCode(const GetAuthCodeCallback& callback) override; |
| 133 void OnSignInComplete() override; | 138 void OnSignInComplete() override; |
| 134 void OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) override; | 139 void OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) override; |
| 135 // Callback is called with a bool that indicates the management status of the | 140 // Callback is called with a bool that indicates the management status of the |
| 136 // user. | 141 // user. |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 219 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 215 | 220 |
| 216 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 221 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 217 }; | 222 }; |
| 218 | 223 |
| 219 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 224 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 220 | 225 |
| 221 } // namespace arc | 226 } // namespace arc |
| 222 | 227 |
| 223 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 228 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |