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 "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "chrome/browser/chromeos/arc/arc_auth_code_fetcher_delegate.h" | 16 #include "chrome/browser/chromeos/arc/arc_auth_code_fetcher_delegate.h" |
17 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" | 17 #include "chrome/browser/chromeos/arc/arc_auth_context_delegate.h" |
18 #include "chrome/browser/chromeos/policy/android_management_client.h" | 18 #include "chrome/browser/chromeos/policy/android_management_client.h" |
19 #include "components/arc/arc_bridge_service.h" | 19 #include "components/arc/arc_bridge_service.h" |
20 #include "components/arc/arc_service.h" | 20 #include "components/arc/arc_service.h" |
21 #include "components/arc/common/auth.mojom.h" | 21 #include "components/arc/common/auth.mojom.h" |
22 #include "components/arc/instance_holder.h" | 22 #include "components/arc/instance_holder.h" |
23 #include "components/prefs/pref_change_registrar.h" | 23 #include "components/prefs/pref_change_registrar.h" |
24 #include "components/syncable_prefs/pref_service_syncable_observer.h" | 24 #include "components/sync_preferences/pref_service_syncable_observer.h" |
25 #include "components/syncable_prefs/synced_pref_observer.h" | 25 #include "components/sync_preferences/synced_pref_observer.h" |
26 #include "mojo/public/cpp/bindings/binding.h" | 26 #include "mojo/public/cpp/bindings/binding.h" |
27 | 27 |
28 class ArcAppLauncher; | 28 class ArcAppLauncher; |
29 class Profile; | 29 class Profile; |
30 | 30 |
31 namespace ash { | 31 namespace ash { |
32 class ShelfDelegate; | 32 class ShelfDelegate; |
33 } | 33 } |
34 | 34 |
35 namespace user_prefs { | 35 namespace user_prefs { |
(...skipping 10 matching lines...) Expand all Loading... |
46 enum class ProvisioningResult : int; | 46 enum class ProvisioningResult : int; |
47 | 47 |
48 // This class proxies the request from the client to fetch an auth code from | 48 // This class proxies the request from the client to fetch an auth code from |
49 // LSO. It lives on the UI thread. | 49 // LSO. It lives on the UI thread. |
50 class ArcAuthService : public ArcService, | 50 class ArcAuthService : public ArcService, |
51 public mojom::AuthHost, | 51 public mojom::AuthHost, |
52 public ArcBridgeService::Observer, | 52 public ArcBridgeService::Observer, |
53 public InstanceHolder<mojom::AuthInstance>::Observer, | 53 public InstanceHolder<mojom::AuthInstance>::Observer, |
54 public ArcAuthContextDelegate, | 54 public ArcAuthContextDelegate, |
55 public ArcAuthCodeFetcherDelegate, | 55 public ArcAuthCodeFetcherDelegate, |
56 public syncable_prefs::PrefServiceSyncableObserver, | 56 public sync_preferences::PrefServiceSyncableObserver, |
57 public syncable_prefs::SyncedPrefObserver { | 57 public sync_preferences::SyncedPrefObserver { |
58 public: | 58 public: |
59 enum class State { | 59 enum class State { |
60 NOT_INITIALIZED, // Service is not initialized. | 60 NOT_INITIALIZED, // Service is not initialized. |
61 STOPPED, // ARC is not running. | 61 STOPPED, // ARC is not running. |
62 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. | 62 FETCHING_CODE, // ARC may be running or not. Auth code is fetching. |
63 ACTIVE, // ARC is running. | 63 ACTIVE, // ARC is running. |
64 }; | 64 }; |
65 | 65 |
66 enum class UIPage { | 66 enum class UIPage { |
67 NO_PAGE, // Hide everything. | 67 NO_PAGE, // Hide everything. |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // Called from Arc support platform app when user cancels signing. | 159 // Called from Arc support platform app when user cancels signing. |
160 void CancelAuthCode(); | 160 void CancelAuthCode(); |
161 | 161 |
162 bool IsArcManaged() const; | 162 bool IsArcManaged() const; |
163 bool IsArcEnabled() const; | 163 bool IsArcEnabled() const; |
164 | 164 |
165 // This requires Arc to be allowed (|IsAllowed|)for current profile. | 165 // This requires Arc to be allowed (|IsAllowed|)for current profile. |
166 void EnableArc(); | 166 void EnableArc(); |
167 void DisableArc(); | 167 void DisableArc(); |
168 | 168 |
169 // syncable_prefs::PrefServiceSyncableObserver | 169 // sync_preferences::PrefServiceSyncableObserver |
170 void OnIsSyncingChanged() override; | 170 void OnIsSyncingChanged() override; |
171 | 171 |
172 // syncable_prefs::SyncedPrefObserver | 172 // sync_preferences::SyncedPrefObserver |
173 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; | 173 void OnSyncedPrefChanged(const std::string& path, bool from_sync) override; |
174 | 174 |
175 // ArcAuthContextDelegate: | 175 // ArcAuthContextDelegate: |
176 void OnContextReady() override; | 176 void OnContextReady() override; |
177 void OnPrepareContextFailed() override; | 177 void OnPrepareContextFailed() override; |
178 | 178 |
179 // ArcAuthCodeFetcherDelegate: | 179 // ArcAuthCodeFetcherDelegate: |
180 void OnAuthCodeSuccess(const std::string& auth_code) override; | 180 void OnAuthCodeSuccess(const std::string& auth_code) override; |
181 void OnAuthCodeFailed() override; | 181 void OnAuthCodeFailed() override; |
182 | 182 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 | 265 |
266 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 266 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
267 }; | 267 }; |
268 | 268 |
269 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 269 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
270 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 270 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
271 | 271 |
272 } // namespace arc | 272 } // namespace arc |
273 | 273 |
274 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 274 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
OLD | NEW |