| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_LOGIN_ARC_KIOSK_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ARC_KIOSK_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ARC_KIOSK_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ARC_KIOSK_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" | 10 #include "chrome/browser/chromeos/app_mode/arc/arc_kiosk_app_service.h" |
| 11 #include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_actor.h" | 11 #include "chrome/browser/chromeos/login/screens/arc_kiosk_splash_screen_view.h" |
| 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 12 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 13 #include "chromeos/login/auth/login_performer.h" | 13 #include "chromeos/login/auth/login_performer.h" |
| 14 | 14 |
| 15 class AccountId; | 15 class AccountId; |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class OneShotTimer; | 19 class OneShotTimer; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 class LoginDisplayHost; | 24 class LoginDisplayHost; |
| 25 class OobeUI; | 25 class OobeUI; |
| 26 class UserContext; | 26 class UserContext; |
| 27 | 27 |
| 28 // Controller for the ARC kiosk launch process, responsible for | 28 // Controller for the ARC kiosk launch process, responsible for |
| 29 // coordinating loading the ARC kiosk profile, and | 29 // coordinating loading the ARC kiosk profile, and |
| 30 // updating the splash screen UI. | 30 // updating the splash screen UI. |
| 31 class ArcKioskController : public LoginPerformer::Delegate, | 31 class ArcKioskController : public LoginPerformer::Delegate, |
| 32 public UserSessionManagerDelegate, | 32 public UserSessionManagerDelegate, |
| 33 public ArcKioskAppService::Delegate, | 33 public ArcKioskAppService::Delegate, |
| 34 public ArcKioskSplashScreenActor::Delegate { | 34 public ArcKioskSplashScreenView::Delegate { |
| 35 public: | 35 public: |
| 36 ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui); | 36 ArcKioskController(LoginDisplayHost* host, OobeUI* oobe_ui); |
| 37 | 37 |
| 38 ~ArcKioskController() override; | 38 ~ArcKioskController() override; |
| 39 | 39 |
| 40 // Starts ARC kiosk splash screen. | 40 // Starts ARC kiosk splash screen. |
| 41 void StartArcKiosk(const AccountId& account_id); | 41 void StartArcKiosk(const AccountId& account_id); |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 void CleanUp(); | 44 void CleanUp(); |
| 45 void CloseSplashScreen(); | 45 void CloseSplashScreen(); |
| 46 | 46 |
| 47 // LoginPerformer::Delegate implementation: | 47 // LoginPerformer::Delegate implementation: |
| 48 void OnAuthFailure(const AuthFailure& error) override; | 48 void OnAuthFailure(const AuthFailure& error) override; |
| 49 void OnAuthSuccess(const UserContext& user_context) override; | 49 void OnAuthSuccess(const UserContext& user_context) override; |
| 50 void WhiteListCheckFailed(const std::string& email) override; | 50 void WhiteListCheckFailed(const std::string& email) override; |
| 51 void PolicyLoadFailed() override; | 51 void PolicyLoadFailed() override; |
| 52 void SetAuthFlowOffline(bool offline) override; | 52 void SetAuthFlowOffline(bool offline) override; |
| 53 | 53 |
| 54 // UserSessionManagerDelegate implementation: | 54 // UserSessionManagerDelegate implementation: |
| 55 void OnProfilePrepared(Profile* profile, bool browser_launched) override; | 55 void OnProfilePrepared(Profile* profile, bool browser_launched) override; |
| 56 | 56 |
| 57 // ArcKioskAppService::Delegate implementation: | 57 // ArcKioskAppService::Delegate implementation: |
| 58 void OnAppStarted() override; | 58 void OnAppStarted() override; |
| 59 void OnAppWindowLaunched() override; | 59 void OnAppWindowLaunched() override; |
| 60 | 60 |
| 61 // ArcKioskSplashScreenActor::Delegate implementation: | 61 // ArcKioskSplashScreenView::Delegate implementation: |
| 62 void OnCancelArcKioskLaunch() override; | 62 void OnCancelArcKioskLaunch() override; |
| 63 | 63 |
| 64 // LoginDisplayHost owns itself. | 64 // LoginDisplayHost owns itself. |
| 65 LoginDisplayHost* const host_; | 65 LoginDisplayHost* const host_; |
| 66 // Owned by OobeUI. | 66 // Owned by OobeUI. |
| 67 ArcKioskSplashScreenActor* const arc_kiosk_splash_screen_actor_; | 67 ArcKioskSplashScreenView* const arc_kiosk_splash_screen_view_; |
| 68 // Not owning here. | 68 // Not owning here. |
| 69 Profile* profile_ = nullptr; | 69 Profile* profile_ = nullptr; |
| 70 | 70 |
| 71 // Used to execute login operations. | 71 // Used to execute login operations. |
| 72 std::unique_ptr<LoginPerformer> login_performer_ = nullptr; | 72 std::unique_ptr<LoginPerformer> login_performer_ = nullptr; |
| 73 | 73 |
| 74 // A timer to ensure the app splash is shown for a minimum amount of time. | 74 // A timer to ensure the app splash is shown for a minimum amount of time. |
| 75 base::OneShotTimer splash_wait_timer_; | 75 base::OneShotTimer splash_wait_timer_; |
| 76 bool launched_ = false; | 76 bool launched_ = false; |
| 77 base::WeakPtrFactory<ArcKioskController> weak_ptr_factory_; | 77 base::WeakPtrFactory<ArcKioskController> weak_ptr_factory_; |
| 78 | 78 |
| 79 DISALLOW_COPY_AND_ASSIGN(ArcKioskController); | 79 DISALLOW_COPY_AND_ASSIGN(ArcKioskController); |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace chromeos | 82 } // namespace chromeos |
| 83 | 83 |
| 84 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ARC_KIOSK_CONTROLLER_H_ | 84 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ARC_KIOSK_CONTROLLER_H_ |
| OLD | NEW |