| 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 233 |
| 234 // StopArc(), then EnableArc(). Between them data clear may happens. | 234 // StopArc(), then EnableArc(). Between them data clear may happens. |
| 235 // This is a special method to support enterprise device lost case. | 235 // This is a special method to support enterprise device lost case. |
| 236 // This can be called only when ARC is running. | 236 // This can be called only when ARC is running. |
| 237 void StopAndEnableArc(); | 237 void StopAndEnableArc(); |
| 238 | 238 |
| 239 // Removes the data if ARC is stopped. Otherwise, queue to remove the data | 239 // Removes the data if ARC is stopped. Otherwise, queue to remove the data |
| 240 // on ARC is stopped. | 240 // on ARC is stopped. |
| 241 void RemoveArcData(); | 241 void RemoveArcData(); |
| 242 | 242 |
| 243 // Returns current page that has to be shown in OptIn UI. | |
| 244 ArcSupportHost::UIPage ui_page() const { return ui_page_; } | |
| 245 | |
| 246 // Returns current page status, relevant to the specific page. | |
| 247 const base::string16& ui_page_status() const { return ui_page_status_; } | |
| 248 | |
| 249 ArcSupportHost* support_host() { return support_host_.get(); } | 243 ArcSupportHost* support_host() { return support_host_.get(); } |
| 250 | 244 |
| 251 void StartArc(); | 245 void StartArc(); |
| 252 | 246 |
| 253 private: | 247 private: |
| 254 using AccountInfoCallback = base::Callback<void(mojom::AccountInfoPtr)>; | 248 using AccountInfoCallback = base::Callback<void(mojom::AccountInfoPtr)>; |
| 255 class AccountInfoNotifier; | 249 class AccountInfoNotifier; |
| 256 | 250 |
| 257 // TODO(hidehiko): move UI methods/fields to ArcSupportHost. | 251 // TODO(hidehiko): move UI methods/fields to ArcSupportHost. |
| 258 void ShowUI(ArcSupportHost::UIPage page, const base::string16& status); | |
| 259 void CloseUI(); | |
| 260 void SetUIPage(ArcSupportHost::UIPage page, const base::string16& status); | |
| 261 void SetState(State state); | 252 void SetState(State state); |
| 262 void ShutdownBridge(); | 253 void ShutdownBridge(); |
| 263 void ShutdownBridgeAndCloseUI(); | |
| 264 void ShutdownBridgeAndShowUI(ArcSupportHost::UIPage page, | |
| 265 const base::string16& status); | |
| 266 void OnOptInPreferenceChanged(); | 254 void OnOptInPreferenceChanged(); |
| 267 void StartUI(); | 255 void StartUI(); |
| 268 void OnAndroidManagementPassed(); | 256 void OnAndroidManagementPassed(); |
| 269 void OnArcDataRemoved(bool success); | 257 void OnArcDataRemoved(bool success); |
| 270 void OnArcSignInTimeout(); | 258 void OnArcSignInTimeout(); |
| 271 bool IsAuthCodeRequest() const; | 259 bool IsAuthCodeRequest() const; |
| 272 void FetchAuthCode(); | 260 void FetchAuthCode(); |
| 273 void PrepareContextForAuthCodeRequest(); | 261 void PrepareContextForAuthCodeRequest(); |
| 274 void RequestAccountInfoInternal( | 262 void RequestAccountInfoInternal( |
| 275 std::unique_ptr<AccountInfoNotifier> account_info_notifier); | 263 std::unique_ptr<AccountInfoNotifier> account_info_notifier); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 291 // Unowned pointer. Keeps current profile. | 279 // Unowned pointer. Keeps current profile. |
| 292 Profile* profile_ = nullptr; | 280 Profile* profile_ = nullptr; |
| 293 | 281 |
| 294 // Registrar used to monitor ARC enabled state. | 282 // Registrar used to monitor ARC enabled state. |
| 295 PrefChangeRegistrar pref_change_registrar_; | 283 PrefChangeRegistrar pref_change_registrar_; |
| 296 | 284 |
| 297 mojo::Binding<AuthHost> binding_; | 285 mojo::Binding<AuthHost> binding_; |
| 298 State state_ = State::NOT_INITIALIZED; | 286 State state_ = State::NOT_INITIALIZED; |
| 299 base::ObserverList<Observer> observer_list_; | 287 base::ObserverList<Observer> observer_list_; |
| 300 std::unique_ptr<ArcAppLauncher> playstore_launcher_; | 288 std::unique_ptr<ArcAppLauncher> playstore_launcher_; |
| 301 ArcSupportHost::UIPage ui_page_ = ArcSupportHost::UIPage::NO_PAGE; | |
| 302 base::string16 ui_page_status_; | |
| 303 bool clear_required_ = false; | 289 bool clear_required_ = false; |
| 304 bool reenable_arc_ = false; | 290 bool reenable_arc_ = false; |
| 305 base::OneShotTimer arc_sign_in_timer_; | 291 base::OneShotTimer arc_sign_in_timer_; |
| 306 | 292 |
| 307 // Notifies the correct callback whenever the auth_code is ready. | 293 // Notifies the correct callback whenever the auth_code is ready. |
| 308 std::unique_ptr<AccountInfoNotifier> account_info_notifier_; | 294 std::unique_ptr<AccountInfoNotifier> account_info_notifier_; |
| 309 | 295 |
| 310 // Temporarily keeps the ArcSupportHost instance. | 296 // Temporarily keeps the ArcSupportHost instance. |
| 311 // This should be moved to ArcSessionManager when the refactoring is | 297 // This should be moved to ArcSessionManager when the refactoring is |
| 312 // done. | 298 // done. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 325 | 311 |
| 326 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); | 312 DISALLOW_COPY_AND_ASSIGN(ArcAuthService); |
| 327 }; | 313 }; |
| 328 | 314 |
| 329 // Outputs the stringified |state| to |os|. This is only for logging purposes. | 315 // Outputs the stringified |state| to |os|. This is only for logging purposes. |
| 330 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); | 316 std::ostream& operator<<(std::ostream& os, const ArcAuthService::State& state); |
| 331 | 317 |
| 332 } // namespace arc | 318 } // namespace arc |
| 333 | 319 |
| 334 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ | 320 #endif // CHROME_BROWSER_CHROMEOS_ARC_ARC_AUTH_SERVICE_H_ |
| OLD | NEW |