| 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 18 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 Loading... |
| 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() const { return ui_page_status_; } | 204 const base::string16& ui_page_status() const { 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 19 matching lines...) Expand all Loading... |
| 241 GetAuthCodeCallback auth_callback_; | 240 GetAuthCodeCallback auth_callback_; |
| 242 GetAuthCodeAndAccountTypeCallback auth_account_callback_; | 241 GetAuthCodeAndAccountTypeCallback auth_account_callback_; |
| 243 bool initial_opt_in_ = false; | 242 bool initial_opt_in_ = false; |
| 244 bool disable_arc_from_ui_ = false; | 243 bool disable_arc_from_ui_ = false; |
| 245 UIPage ui_page_ = UIPage::NO_PAGE; | 244 UIPage ui_page_ = UIPage::NO_PAGE; |
| 246 base::string16 ui_page_status_; | 245 base::string16 ui_page_status_; |
| 247 bool clear_required_ = false; | 246 bool clear_required_ = false; |
| 248 bool reenable_arc_ = false; | 247 bool reenable_arc_ = false; |
| 249 base::OneShotTimer arc_sign_in_timer_; | 248 base::OneShotTimer arc_sign_in_timer_; |
| 250 | 249 |
| 250 // Temporarily keeps the ArcSupportHost instance. |
| 251 // This should be moved to ArcSessionManager when the refactoring is |
| 252 // done. |
| 253 std::unique_ptr<ArcSupportHost> support_host_; |
| 254 |
| 251 std::unique_ptr<ArcAuthContext> context_; | 255 std::unique_ptr<ArcAuthContext> context_; |
| 252 std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher_; | 256 std::unique_ptr<ArcAuthCodeFetcher> auth_code_fetcher_; |
| 253 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; | 257 std::unique_ptr<ArcAndroidManagementChecker> android_management_checker_; |
| 254 | 258 |
| 255 base::Time sign_in_time_; | 259 base::Time sign_in_time_; |
| 256 | 260 |
| 257 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; | 261 base::WeakPtrFactory<ArcAuthService> weak_ptr_factory_; |
| 258 | 262 |
| 259 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 263 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 260 }; | 264 }; |
| 261 | 265 |
| 262 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 266 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 263 | 267 |
| 264 } // namespace arc | 268 } // namespace arc |
| 265 | 269 |
| 266 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 270 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |