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

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

Issue 2436903003: Extract ArcSupportMessageHost. (Closed)
Patch Set: Fix tests Created 4 years, 2 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
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>
(...skipping 18 matching lines...) Expand all
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 {
36 class PrefRegistrySyncable; 36 class PrefRegistrySyncable;
37 } 37 }
38 38
39 class ArcSupportHost;
40
39 namespace arc { 41 namespace arc {
40 42
41 class ArcAndroidManagementChecker; 43 class ArcAndroidManagementChecker;
42 class ArcAuthCodeFetcher; 44 class ArcAuthCodeFetcher;
43 class ArcAuthContext; 45 class ArcAuthContext;
44 enum class ProvisioningResult : int; 46 enum class ProvisioningResult : int;
45 47
46 // 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
47 // LSO. It lives on the UI thread. 49 // LSO. It lives on the UI thread.
48 class ArcAuthService : public ArcService, 50 class ArcAuthService : public ArcService,
(...skipping 24 matching lines...) Expand all
73 ERROR_WITH_FEEDBACK, // Arc start error page, plus feedback button. 75 ERROR_WITH_FEEDBACK, // Arc start error page, plus feedback button.
74 }; 76 };
75 77
76 class Observer { 78 class Observer {
77 public: 79 public:
78 virtual ~Observer() = default; 80 virtual ~Observer() = default;
79 81
80 // Called whenever Opt-In state of the ARC has been changed. 82 // Called whenever Opt-In state of the ARC has been changed.
81 virtual void OnOptInChanged(State state) {} 83 virtual void OnOptInChanged(State state) {}
82 84
83 // Called to notify that OptIn UI needs to be closed.
84 virtual void OnOptInUIClose() {}
85
86 // Called to notify that OptIn UI needs to show specific page.
87 virtual void OnOptInUIShowPage(UIPage page, const base::string16& status) {}
88
89 // Called to notify that ARC bridge is shut down. 85 // Called to notify that ARC bridge is shut down.
90 virtual void OnShutdownBridge() {} 86 virtual void OnShutdownBridge() {}
91 87
92 // Called to notify that ARC enabled state has been updated. 88 // Called to notify that ARC enabled state has been updated.
93 virtual void OnOptInEnabled(bool enabled) {} 89 virtual void OnOptInEnabled(bool enabled) {}
94 90
95 // Called to notify that ARC has been initialized successfully. 91 // Called to notify that ARC has been initialized successfully.
96 virtual void OnInitialStart() {} 92 virtual void OnInitialStart() {}
97 }; 93 };
98 94
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Removes the data if ARC is stopped. Otherwise, queue to remove the data 196 // Removes the data if ARC is stopped. Otherwise, queue to remove the data
201 // on ARC is stopped. 197 // on ARC is stopped.
202 void RemoveArcData(); 198 void RemoveArcData();
203 199
204 // Returns current page that has to be shown in OptIn UI. 200 // Returns current page that has to be shown in OptIn UI.
205 UIPage ui_page() const { return ui_page_; } 201 UIPage ui_page() const { return ui_page_; }
206 202
207 // Returns current page status, relevant to the specific page. 203 // Returns current page status, relevant to the specific page.
208 const base::string16& ui_page_status() { return ui_page_status_; } 204 const base::string16& ui_page_status() { return ui_page_status_; }
209 205
206 ArcSupportHost* support_host() { return support_host_.get(); }
207
210 private: 208 private:
211 void StartArc(); 209 void StartArc();
210 // TODO: move UI methods/fields to ArcSupportHost.
212 void ShowUI(UIPage page, const base::string16& status); 211 void ShowUI(UIPage page, const base::string16& status);
213 void CloseUI(); 212 void CloseUI();
214 void SetUIPage(UIPage page, const base::string16& status); 213 void SetUIPage(UIPage page, const base::string16& status);
215 void SetState(State state); 214 void SetState(State state);
216 void ShutdownBridge(); 215 void ShutdownBridge();
217 void ShutdownBridgeAndCloseUI(); 216 void ShutdownBridgeAndCloseUI();
218 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status); 217 void ShutdownBridgeAndShowUI(UIPage page, const base::string16& status);
219 void OnOptInPreferenceChanged(); 218 void OnOptInPreferenceChanged();
220 void StartUI(); 219 void StartUI();
221 void StartAndroidManagementClient(); 220 void StartAndroidManagementClient();
(...skipping 16 matching lines...) Expand all
238 GetAuthCodeCallback auth_callback_; 237 GetAuthCodeCallback auth_callback_;
239 GetAuthCodeAndAccountTypeCallback auth_account_callback_; 238 GetAuthCodeAndAccountTypeCallback auth_account_callback_;
240 bool initial_opt_in_ = false; 239 bool initial_opt_in_ = false;
241 bool disable_arc_from_ui_ = false; 240 bool disable_arc_from_ui_ = false;
242 UIPage ui_page_ = UIPage::NO_PAGE; 241 UIPage ui_page_ = UIPage::NO_PAGE;
243 base::string16 ui_page_status_; 242 base::string16 ui_page_status_;
244 bool clear_required_ = false; 243 bool clear_required_ = false;
245 bool reenable_arc_ = false; 244 bool reenable_arc_ = false;
246 base::OneShotTimer arc_sign_in_timer_; 245 base::OneShotTimer arc_sign_in_timer_;
247 246
247 // Temporarily keeps the ArcSupportHost instance.
248 // This should be moved to ArcSessionManager when the refactoring is
249 // done.
250 std::unique_ptr<ArcSupportHost> support_host_;
251
248 std::unique_ptr<ArcAuthContext> context_; 252 std::unique_ptr<ArcAuthContext> context_;
249 std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher_; 253 std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher_;
250 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; 254 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_;
251 255
252 base::Time sign_in_time_; 256 base::Time sign_in_time_;
253 257
254 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; 258 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_;
255 259
256 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); 260 DISALLOW_COPY_AND_ASSIGN(ArcAuthService);
257 }; 261 };
258 262
259 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); 263 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state);
260 264
261 } // namespace arc 265 } // namespace arc
262 266
263 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ 267 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698