| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen_
actor.h" |
| 11 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" | 12 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" |
| 12 #include "chrome/browser/chromeos/login/screens/error_screen.h" | 13 #include "chrome/browser/chromeos/login/screens/error_screen.h" |
| 13 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 14 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 class ScreenObserver; | 18 class ScreenObserver; |
| 18 | 19 |
| 19 // Handles the control flow after OOBE auto-update completes to wait for the | 20 // Handles the control flow after OOBE auto-update completes to wait for the |
| 20 // enterprise auto-enrollment check that happens as part of OOBE. This includes | 21 // enterprise auto-enrollment check that happens as part of OOBE. This includes |
| 21 // keeping track of current auto-enrollment state and displaying and updating | 22 // keeping track of current auto-enrollment state and displaying and updating |
| 22 // the error screen upon failures. Similar to a screen controller, but it | 23 // the error screen upon failures. Similar to a screen controller, but it |
| 23 // doesn't actually drive a dedicated screen. | 24 // doesn't actually drive a dedicated screen. |
| 24 class AutoEnrollmentCheckStep : NetworkPortalDetector::Observer { | 25 class AutoEnrollmentCheckScreen |
| 26 : public AutoEnrollmentCheckScreenActor::Delegate, |
| 27 public WizardScreen, |
| 28 public NetworkPortalDetector::Observer { |
| 25 public: | 29 public: |
| 26 AutoEnrollmentCheckStep(ScreenObserver* screen_observer, | 30 AutoEnrollmentCheckScreen( |
| 27 AutoEnrollmentController* auto_enrollment_controller); | 31 ScreenObserver* observer, |
| 28 virtual ~AutoEnrollmentCheckStep(); | 32 AutoEnrollmentCheckScreenActor* actor, |
| 33 AutoEnrollmentController* auto_enrollment_controller); |
| 34 virtual ~AutoEnrollmentCheckScreen(); |
| 29 | 35 |
| 30 // Hands over OOBE control to this AutoEnrollmentCheckStep. It'll return the | 36 // Hands over OOBE control to this AutoEnrollmentCheckStep. It'll return the |
| 31 // flow back to the caller via the |screen_observer_|'s OnExit function. | 37 // flow back to the caller via the |screen_observer_|'s OnExit function. |
| 32 void Start(); | 38 void Start(); |
| 33 | 39 |
| 40 // WizardScreen implementation: |
| 41 virtual void PrepareToShow() OVERRIDE; |
| 42 virtual void Show() OVERRIDE; |
| 43 virtual void Hide() OVERRIDE; |
| 44 virtual std::string GetName() const OVERRIDE; |
| 45 |
| 46 // AutoEnrollmentCheckScreenActor::Delegate implementation: |
| 47 virtual void OnExit() OVERRIDE; |
| 48 virtual void OnActorDestroyed(AutoEnrollmentCheckScreenActor* actor) OVERRIDE; |
| 49 |
| 34 // NetworkPortalDetector::Observer implementation: | 50 // NetworkPortalDetector::Observer implementation: |
| 35 virtual void OnPortalDetectionCompleted( | 51 virtual void OnPortalDetectionCompleted( |
| 36 const NetworkState* network, | 52 const NetworkState* network, |
| 37 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; | 53 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; |
| 38 | 54 |
| 39 private: | 55 private: |
| 40 // Handles update notifications regarding the auto-enrollment check. | 56 // Handles update notifications regarding the auto-enrollment check. |
| 41 void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state); | 57 void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state); |
| 42 | 58 |
| 43 // Handles a state update, updating the UI and saving the state. | 59 // Handles a state update, updating the UI and saving the state. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 55 bool UpdateAutoEnrollmentState( | 71 bool UpdateAutoEnrollmentState( |
| 56 policy::AutoEnrollmentState auto_enrollment_state); | 72 policy::AutoEnrollmentState auto_enrollment_state); |
| 57 | 73 |
| 58 // Configures the error screen. | 74 // Configures the error screen. |
| 59 void ShowErrorScreen(ErrorScreen::ErrorState error_state); | 75 void ShowErrorScreen(ErrorScreen::ErrorState error_state); |
| 60 | 76 |
| 61 // Signals completion. No further code should run after a call to this | 77 // Signals completion. No further code should run after a call to this |
| 62 // function as the owner might destroy |this| in response. | 78 // function as the owner might destroy |this| in response. |
| 63 void SignalCompletion(); | 79 void SignalCompletion(); |
| 64 | 80 |
| 65 ScreenObserver* screen_observer_; | 81 // Checks if the enrollment status check is needed. It can be disabled either |
| 82 // by command line flags, build configuration or might have finished already. |
| 83 bool IsStartNeeded(); |
| 84 |
| 85 AutoEnrollmentCheckScreenActor* actor_; |
| 66 AutoEnrollmentController* auto_enrollment_controller_; | 86 AutoEnrollmentController* auto_enrollment_controller_; |
| 67 | 87 |
| 68 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> | 88 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> |
| 69 auto_enrollment_progress_subscription_; | 89 auto_enrollment_progress_subscription_; |
| 70 | 90 |
| 71 NetworkPortalDetector::CaptivePortalStatus captive_portal_status_; | 91 NetworkPortalDetector::CaptivePortalStatus captive_portal_status_; |
| 72 policy::AutoEnrollmentState auto_enrollment_state_; | 92 policy::AutoEnrollmentState auto_enrollment_state_; |
| 73 | 93 |
| 74 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckStep); | 94 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckScreen); |
| 75 }; | 95 }; |
| 76 | 96 |
| 77 } // namespace chromeos | 97 } // namespace chromeos |
| 78 | 98 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H
_ | 99 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN
_H_ |
| OLD | NEW |