| 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> |
| 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 "chrome/browser/chromeos/arc/arc_android_management_checker_delegate.h" | 15 #include "chrome/browser/chromeos/arc/arc_android_management_checker_delegate.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" | 16 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" |
| 17 #include "components/arc/arc_bridge_service.h" | 17 #include "components/arc/arc_bridge_service.h" |
| 18 #include "components/arc/arc_service.h" | 18 #include "components/arc/arc_service.h" |
| 19 #include "components/arc/common/auth.mojom.h" | 19 #include "components/arc/common/auth.mojom.h" |
| 20 #include "components/arc/instance_holder.h" | 20 #include "components/arc/instance_holder.h" |
| 21 #include "components/prefs/pref_change_registrar.h" | 21 #include "components/prefs/pref_change_registrar.h" |
| 22 #include "components/syncable_prefs/pref_service_syncable_observer.h" | |
| 23 #include "components/syncable_prefs/synced_pref_observer.h" | |
| 24 #include "mojo/public/cpp/bindings/binding.h" | 22 #include "mojo/public/cpp/bindings/binding.h" |
| 25 | 23 |
| 26 class ArcAppLauncher; | 24 class ArcAppLauncher; |
| 27 class Profile; | 25 class Profile; |
| 28 | 26 |
| 29 namespace ash { | 27 namespace ash { |
| 30 class ShelfDelegate; | 28 class ShelfDelegate; |
| 31 } | 29 } |
| 32 | 30 |
| 33 namespace user_prefs { | 31 namespace user_prefs { |
| 34 class PrefRegistrySyncable; | 32 class PrefRegistrySyncable; |
| 35 } | 33 } |
| 36 | 34 |
| 37 namespace arc { | 35 namespace arc { |
| 38 | 36 |
| 39 class ArcAndroidManagementChecker; | 37 class ArcAndroidManagementChecker; |
| 40 class ArcAuthContext; | 38 class ArcAuthContext; |
| 41 enum class ProvisioningResult : int; | 39 enum class ProvisioningResult : int; |
| 42 | 40 |
| 43 // 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 |
| 44 // LSO. It lives on the UI thread. | 42 // LSO. It lives on the UI thread. |
| 45 class ArcAuthService : public ArcService, | 43 class ArcAuthService : public ArcService, |
| 46 public mojom::AuthHost, | 44 public mojom::AuthHost, |
| 47 public ArcBridgeService::Observer, | 45 public ArcBridgeService::Observer, |
| 48 public InstanceHolder<mojom::AuthInstance>::Observer, | 46 public InstanceHolder<mojom::AuthInstance>::Observer, |
| 49 public ArcAndroidManagementCheckerDelegate, | 47 public ArcAndroidManagementCheckerDelegate, |
| 50 public ArcAuthContextDelegate, | 48 public ArcAuthContextDelegate { |
| 51 public syncable_prefs::PrefServiceSyncableObserver, | |
| 52 public syncable_prefs::SyncedPrefObserver { | |
| 53 public: | 49 public: |
| 54 enum class State { | 50 enum class State { |
| 55 NOT_INITIALIZED, // Service is not initialized. | 51 NOT_INITIALIZED, // Service is not initialized. |
| 56 STOPPED, // ARC is not running. | 52 STOPPED, // ARC is not running. |
| 57 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. | 53 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. |
| 58 ACTIVE, // ARC is running. | 54 ACTIVE, // ARC is running. |
| 59 }; | 55 }; |
| 60 | 56 |
| 61 enum class UIPage { | 57 enum class UIPage { |
| 62 NO_PAGE, // Hide everything. | 58 NO_PAGE, // Hide everything. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // Called from Arc support platform app when user cancels signing. | 153 // Called from Arc support platform app when user cancels signing. |
| 158 void CancelAuthCode(); | 154 void CancelAuthCode(); |
| 159 | 155 |
| 160 bool IsArcManaged() const; | 156 bool IsArcManaged() const; |
| 161 bool IsArcEnabled() const; | 157 bool IsArcEnabled() const; |
| 162 | 158 |
| 163 // This requires Arc to be allowed (|IsAllowed|)for current profile. | 159 // This requires Arc to be allowed (|IsAllowed|)for current profile. |
| 164 void EnableArc(); | 160 void EnableArc(); |
| 165 void DisableArc(); | 161 void DisableArc(); |
| 166 | 162 |
| 167 // syncable_prefs::PrefServiceSyncableObserver | |
| 168 void OnIsSyncingChanged() override; | |
| 169 | |
| 170 // syncable_prefs::SyncedPrefObserver | |
| 171 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; | |
| 172 | |
| 173 // ArcAuthContextDelegate: | 163 // ArcAuthContextDelegate: |
| 174 void OnContextReady() override; | 164 void OnContextReady() override; |
| 175 void OnPrepareContextFailed() override; | 165 void OnPrepareContextFailed() override; |
| 176 | 166 |
| 177 // ArcAndroidManagementCheckerDelegate: | 167 // ArcAndroidManagementCheckerDelegate: |
| 178 void OnAndroidManagementChecked( | 168 void OnAndroidManagementChecked( |
| 179 policy::AndroidManagementClient::Result result) override; | 169 policy::AndroidManagementClient::Result result) override; |
| 180 | 170 |
| 181 // Stops ARC without changing ArcEnabled preference. | 171 // Stops ARC without changing ArcEnabled preference. |
| 182 void StopArc(); | 172 void StopArc(); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 219 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 230 | 220 |
| 231 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 221 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 232 }; | 222 }; |
| 233 | 223 |
| 234 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 224 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 235 | 225 |
| 236 } // namespace arc | 226 } // namespace arc |
| 237 | 227 |
| 238 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 228 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |