Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: chrome/browser/chromeos/arc/arc_auth_service.h

Issue 2133503002: arc: Revamp the ArcBridgeService interface (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: More rebasing Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_auth_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/prefs/pref_change_registrar.h" 21 #include "components/prefs/pref_change_registrar.h"
21 #include "components/syncable_prefs/pref_service_syncable_observer.h" 22 #include "components/syncable_prefs/pref_service_syncable_observer.h"
22 #include "components/syncable_prefs/synced_pref_observer.h" 23 #include "components/syncable_prefs/synced_pref_observer.h"
23 #include "mojo/public/cpp/bindings/binding.h" 24 #include "mojo/public/cpp/bindings/binding.h"
24 25
25 class ArcAppLauncher; 26 class ArcAppLauncher;
26 class Profile; 27 class Profile;
27 28
28 namespace ash { 29 namespace ash {
29 class ShelfDelegate; 30 class ShelfDelegate;
30 } 31 }
31 32
32 namespace user_prefs { 33 namespace user_prefs {
33 class PrefRegistrySyncable; 34 class PrefRegistrySyncable;
34 } 35 }
35 36
36 namespace arc { 37 namespace arc {
37 38
38 class ArcAndroidManagementChecker; 39 class ArcAndroidManagementChecker;
39 class ArcAuthContext; 40 class ArcAuthContext;
40 41
41 // This class proxies the request from the client to fetch an auth code from 42 // This class proxies the request from the client to fetch an auth code from
42 // LSO. It lives on the UI thread. 43 // LSO. It lives on the UI thread.
43 class ArcAuthService : public ArcService, 44 class ArcAuthService : public ArcService,
44 public mojom::AuthHost, 45 public mojom::AuthHost,
45 public ArcBridgeService::Observer, 46 public ArcBridgeService::Observer,
47 public InstanceHolder<mojom::AuthInstance>::Observer,
46 public ArcAndroidManagementCheckerDelegate, 48 public ArcAndroidManagementCheckerDelegate,
47 public ArcAuthContextDelegate, 49 public ArcAuthContextDelegate,
48 public syncable_prefs::PrefServiceSyncableObserver, 50 public syncable_prefs::PrefServiceSyncableObserver,
49 public syncable_prefs::SyncedPrefObserver { 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.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 117
116 State state() const { return state_; } 118 State state() const { return state_; }
117 119
118 std::string GetAndResetAuthCode(); 120 std::string GetAndResetAuthCode();
119 121
120 // Adds or removes observers. 122 // Adds or removes observers.
121 void AddObserver(Observer* observer); 123 void AddObserver(Observer* observer);
122 void RemoveObserver(Observer* observer); 124 void RemoveObserver(Observer* observer);
123 125
124 // ArcBridgeService::Observer: 126 // ArcBridgeService::Observer:
125 void OnAuthInstanceReady() override;
126 void OnBridgeStopped() override; 127 void OnBridgeStopped() override;
127 128
129 // InstanceHolder<mojom::AuthInstance>::Observer:
130 void OnInstanceReady() override;
131
128 // AuthHost: 132 // AuthHost:
129 // 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
130 // period of time. 134 // period of time.
131 void GetAuthCodeDeprecated( 135 void GetAuthCodeDeprecated(
132 const GetAuthCodeDeprecatedCallback& callback) override; 136 const GetAuthCodeDeprecatedCallback& callback) override;
133 void GetAuthCode(const GetAuthCodeCallback& callback) override; 137 void GetAuthCode(const GetAuthCodeCallback& callback) override;
134 void OnSignInComplete() override; 138 void OnSignInComplete() override;
135 void OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) override; 139 void OnSignInFailed(arc::mojom::ArcSignInFailureReason reason) override;
136 // 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
137 // user. 141 // user.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; 219 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_;
216 220
217 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); 221 DISALLOW_COPY_AND_ASSIGN(ArcAuthService);
218 }; 222 };
219 223
220 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); 224 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state);
221 225
222 } // namespace arc 226 } // namespace arc
223 227
224 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ 228 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/arc/arc_auth_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698