| 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 virtual ~AutoEnrollmentCheckScreen(); |
| 29 | 34 |
| 30 // Hands over OOBE control to this AutoEnrollmentCheckStep. It'll return the | 35 // Hands over OOBE control to this AutoEnrollmentCheckStep. It'll return the |
| 31 // flow back to the caller via the |screen_observer_|'s OnExit function. | 36 // flow back to the caller via the |screen_observer_|'s OnExit function. |
| 32 void Start(); | 37 void Start(); |
| 33 | 38 |
| 39 void set_auto_enrollment_controller( |
| 40 AutoEnrollmentController* auto_enrollment_controller) { |
| 41 auto_enrollment_controller_ = auto_enrollment_controller; |
| 42 } |
| 43 |
| 44 // WizardScreen implementation: |
| 45 virtual void PrepareToShow() OVERRIDE; |
| 46 virtual void Show() OVERRIDE; |
| 47 virtual void Hide() OVERRIDE; |
| 48 virtual std::string GetName() const OVERRIDE; |
| 49 |
| 50 // AutoEnrollmentCheckScreenActor::Delegate implementation: |
| 51 virtual void OnExit() OVERRIDE; |
| 52 virtual void OnActorDestroyed(AutoEnrollmentCheckScreenActor* actor) OVERRIDE; |
| 53 |
| 34 // NetworkPortalDetector::Observer implementation: | 54 // NetworkPortalDetector::Observer implementation: |
| 35 virtual void OnPortalDetectionCompleted( | 55 virtual void OnPortalDetectionCompleted( |
| 36 const NetworkState* network, | 56 const NetworkState* network, |
| 37 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; | 57 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; |
| 38 | 58 |
| 39 private: | 59 private: |
| 40 // Handles update notifications regarding the auto-enrollment check. | 60 // Handles update notifications regarding the auto-enrollment check. |
| 41 void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state); | 61 void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state); |
| 42 | 62 |
| 43 // Handles a state update, updating the UI and saving the state. | 63 // Handles a state update, updating the UI and saving the state. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 55 bool UpdateAutoEnrollmentState( | 75 bool UpdateAutoEnrollmentState( |
| 56 policy::AutoEnrollmentState auto_enrollment_state); | 76 policy::AutoEnrollmentState auto_enrollment_state); |
| 57 | 77 |
| 58 // Configures the error screen. | 78 // Configures the error screen. |
| 59 void ShowErrorScreen(ErrorScreen::ErrorState error_state); | 79 void ShowErrorScreen(ErrorScreen::ErrorState error_state); |
| 60 | 80 |
| 61 // Signals completion. No further code should run after a call to this | 81 // Signals completion. No further code should run after a call to this |
| 62 // function as the owner might destroy |this| in response. | 82 // function as the owner might destroy |this| in response. |
| 63 void SignalCompletion(); | 83 void SignalCompletion(); |
| 64 | 84 |
| 65 ScreenObserver* screen_observer_; | 85 // Checks if the enrollment status check is needed. It can be disabled either |
| 86 // by command line flags, build configuration or might have finished already. |
| 87 bool IsStartNeeded(); |
| 88 |
| 89 AutoEnrollmentCheckScreenActor* actor_; |
| 66 AutoEnrollmentController* auto_enrollment_controller_; | 90 AutoEnrollmentController* auto_enrollment_controller_; |
| 67 | 91 |
| 68 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> | 92 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> |
| 69 auto_enrollment_progress_subscription_; | 93 auto_enrollment_progress_subscription_; |
| 70 | 94 |
| 71 NetworkPortalDetector::CaptivePortalStatus captive_portal_status_; | 95 NetworkPortalDetector::CaptivePortalStatus captive_portal_status_; |
| 72 policy::AutoEnrollmentState auto_enrollment_state_; | 96 policy::AutoEnrollmentState auto_enrollment_state_; |
| 73 | 97 |
| 74 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckStep); | 98 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckScreen); |
| 75 }; | 99 }; |
| 76 | 100 |
| 77 } // namespace chromeos | 101 } // namespace chromeos |
| 78 | 102 |
| 79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H
_ | 103 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_SCREEN
_H_ |
| OLD | NEW |