OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_ | |
7 | |
8 #include "base/compiler_specific.h" | |
9 #include "base/macros.h" | |
10 #include "base/memory/scoped_ptr.h" | |
11 #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/net/network_portal_detector.h" | |
14 | |
15 namespace chromeos { | |
16 | |
17 class ScreenObserver; | |
18 | |
19 // 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 // 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 // doesn't actually drive a dedicated screen. | |
24 class AutoEnrollmentCheckStep : NetworkPortalDetector::Observer { | |
25 public: | |
26 AutoEnrollmentCheckStep(ScreenObserver* screen_observer, | |
27 AutoEnrollmentController* auto_enrollment_controller); | |
28 virtual ~AutoEnrollmentCheckStep(); | |
29 | |
30 // Hands over OOBE control to this AutoEnrollmentCheckStep. It'll return the | |
31 // flow back to the caller via the |screen_observer_|'s OnExit function. | |
32 void Start(); | |
33 | |
34 // NetworkPortalDetector::Observer implementation: | |
35 virtual void OnPortalDetectionCompleted( | |
36 const NetworkState* network, | |
37 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; | |
38 | |
39 private: | |
40 // Handles update notifications regarding the auto-enrollment check. | |
41 void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state); | |
42 | |
43 // Handles a state update, updating the UI and saving the state. | |
44 void UpdateState( | |
45 NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status, | |
46 policy::AutoEnrollmentState new_auto_enrollment_state); | |
47 | |
48 // Configures the UI to reflect |new_captive_portal_status|. Returns true if | |
49 // and only if a UI change has been made. | |
50 bool UpdateCaptivePortalStatus( | |
51 NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status); | |
52 | |
53 // Configures the UI to reflect |auto_enrollment_state|. Returns true if and | |
54 // only if a UI change has been made. | |
55 bool UpdateAutoEnrollmentState( | |
56 policy::AutoEnrollmentState auto_enrollment_state); | |
57 | |
58 // Configures the error screen. | |
59 void ShowErrorScreen(ErrorScreen::ErrorState error_state); | |
60 | |
61 // Signals completion. No further code should run after a call to this | |
62 // function as the owner might destroy |this| in response. | |
63 void SignalCompletion(); | |
64 | |
65 ScreenObserver* screen_observer_; | |
66 AutoEnrollmentController* auto_enrollment_controller_; | |
67 | |
68 scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription> | |
69 auto_enrollment_progress_subscription_; | |
70 | |
71 NetworkPortalDetector::CaptivePortalStatus captive_portal_status_; | |
72 policy::AutoEnrollmentState auto_enrollment_state_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckStep); | |
75 }; | |
76 | |
77 } // namespace chromeos | |
78 | |
79 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H
_ | |
OLD | NEW |