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 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" | 5 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_check_screen.
h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 // top. | 91 // top. |
92 actor_->Show(); | 92 actor_->Show(); |
93 histogram_helper_->OnScreenShow(); | 93 histogram_helper_->OnScreenShow(); |
94 | 94 |
95 // Set up state change observers. | 95 // Set up state change observers. |
96 auto_enrollment_progress_subscription_ = | 96 auto_enrollment_progress_subscription_ = |
97 auto_enrollment_controller_->RegisterProgressCallback( | 97 auto_enrollment_controller_->RegisterProgressCallback( |
98 base::Bind( | 98 base::Bind( |
99 &AutoEnrollmentCheckScreen::OnAutoEnrollmentCheckProgressed, | 99 &AutoEnrollmentCheckScreen::OnAutoEnrollmentCheckProgressed, |
100 base::Unretained(this))); | 100 base::Unretained(this))); |
101 NetworkPortalDetector* portal_detector = NetworkPortalDetector::Get(); | 101 NetworkPortalDetector::Get()->AddObserver(this); |
102 portal_detector->AddObserver(this); | |
103 | 102 |
104 // Perform an initial UI update. | 103 // Perform an initial UI update. |
105 NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status = | 104 NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status = |
106 GetCaptivePortalStatus(); | 105 GetCaptivePortalStatus(); |
107 policy::AutoEnrollmentState new_auto_enrollment_state = | 106 policy::AutoEnrollmentState new_auto_enrollment_state = |
108 auto_enrollment_controller_->state(); | 107 auto_enrollment_controller_->state(); |
109 | 108 |
110 if (!UpdateCaptivePortalStatus(new_captive_portal_status)) | 109 if (!UpdateCaptivePortalStatus(new_captive_portal_status)) |
111 UpdateAutoEnrollmentState(new_auto_enrollment_state); | 110 UpdateAutoEnrollmentState(new_auto_enrollment_state); |
112 | 111 |
113 captive_portal_status_ = new_captive_portal_status; | 112 captive_portal_status_ = new_captive_portal_status; |
114 auto_enrollment_state_ = new_auto_enrollment_state; | 113 auto_enrollment_state_ = new_auto_enrollment_state; |
115 | 114 |
116 // Make sure gears are in motion in the background. | 115 // Make sure gears are in motion in the background. |
117 auto_enrollment_controller_->Start(); | 116 auto_enrollment_controller_->Start(); |
118 portal_detector->StartDetectionIfIdle(); | 117 NetworkPortalDetector::Get()->StartDetectionIfIdle(); |
119 } | 118 } |
120 | 119 |
121 void AutoEnrollmentCheckScreen::Hide() { | 120 void AutoEnrollmentCheckScreen::Hide() { |
122 } | 121 } |
123 | 122 |
124 std::string AutoEnrollmentCheckScreen::GetName() const { | 123 std::string AutoEnrollmentCheckScreen::GetName() const { |
125 return WizardController::kAutoEnrollmentCheckScreenName; | 124 return WizardController::kAutoEnrollmentCheckScreenName; |
126 } | 125 } |
127 | 126 |
128 void AutoEnrollmentCheckScreen::OnActorDestroyed( | 127 void AutoEnrollmentCheckScreen::OnActorDestroyed( |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 } | 271 } |
273 NOTREACHED(); | 272 NOTREACHED(); |
274 return false; | 273 return false; |
275 } | 274 } |
276 | 275 |
277 void AutoEnrollmentCheckScreen::OnConnectRequested() { | 276 void AutoEnrollmentCheckScreen::OnConnectRequested() { |
278 auto_enrollment_controller_->Retry(); | 277 auto_enrollment_controller_->Retry(); |
279 } | 278 } |
280 | 279 |
281 } // namespace chromeos | 280 } // namespace chromeos |
OLD | NEW |