OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/enrollment_screen.h" | 5 #include "chrome/browser/chromeos/login/enrollment/enrollment_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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 void EnrollmentScreen::OnOtherError( | 210 void EnrollmentScreen::OnOtherError( |
211 EnterpriseEnrollmentHelper::OtherError error) { | 211 EnterpriseEnrollmentHelper::OtherError error) { |
212 OnAnyEnrollmentError(); | 212 OnAnyEnrollmentError(); |
213 actor_->ShowOtherError(error); | 213 actor_->ShowOtherError(error); |
214 } | 214 } |
215 | 215 |
216 void EnrollmentScreen::OnDeviceEnrolled(const std::string& additional_token) { | 216 void EnrollmentScreen::OnDeviceEnrolled(const std::string& additional_token) { |
217 if (!additional_token.empty()) | 217 if (!additional_token.empty()) |
218 SendEnrollmentAuthToken(additional_token); | 218 SendEnrollmentAuthToken(additional_token); |
219 StartupUtils::MarkDeviceRegistered( | 219 |
220 base::Bind(&EnrollmentScreen::ShowEnrollmentStatusOnSuccess, | 220 int status = 0; |
221 weak_ptr_factory_.GetWeakPtr())); | 221 // TODO: add the device attribute update permission request |
| 222 // If user is permitted to name a device |
| 223 // Show device naming screen |
| 224 if (status == 0) { |
| 225 StartupUtils::MarkDeviceRegistered( |
| 226 base::Bind(&EnrollmentScreen::ShowDeviceNamingScreen, |
| 227 weak_ptr_factory_.GetWeakPtr())); |
| 228 } else { |
| 229 StartupUtils::MarkDeviceRegistered( |
| 230 base::Bind(&EnrollmentScreen::ShowEnrollmentStatusOnSuccess, |
| 231 weak_ptr_factory_.GetWeakPtr())); |
| 232 } |
222 if (remora_controller_) { | 233 if (remora_controller_) { |
223 remora_controller_->OnEnrollmentStatusChanged( | 234 remora_controller_->OnEnrollmentStatusChanged( |
224 HostPairingController::ENROLLMENT_STATUS_SUCCESS); | 235 HostPairingController::ENROLLMENT_STATUS_SUCCESS); |
225 } | 236 } |
226 } | 237 } |
227 | 238 |
| 239 void EnrollmentScreen::ShowDeviceNamingScreen() { |
| 240 actor_->ShowDeviceNamingScreen(); |
| 241 } |
| 242 |
228 void EnrollmentScreen::SendEnrollmentAuthToken(const std::string& token) { | 243 void EnrollmentScreen::SendEnrollmentAuthToken(const std::string& token) { |
229 // TODO(achuith, zork): Extract and send domain. | 244 // TODO(achuith, zork): Extract and send domain. |
230 DCHECK(shark_controller_); | 245 DCHECK(shark_controller_); |
231 shark_controller_->OnAuthenticationDone("", token); | 246 shark_controller_->OnAuthenticationDone("", token); |
232 } | 247 } |
233 | 248 |
234 void EnrollmentScreen::ShowEnrollmentStatusOnSuccess() { | 249 void EnrollmentScreen::ShowEnrollmentStatusOnSuccess() { |
235 StartupUtils::MarkOobeCompleted(); | 250 StartupUtils::MarkOobeCompleted(); |
236 if (elapsed_timer_) | 251 if (elapsed_timer_) |
237 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeSuccess, elapsed_timer_); | 252 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeSuccess, elapsed_timer_); |
(...skipping 14 matching lines...) Expand all Loading... |
252 enrollment_failed_once_ = true; | 267 enrollment_failed_once_ = true; |
253 if (elapsed_timer_) | 268 if (elapsed_timer_) |
254 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); | 269 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); |
255 if (remora_controller_) { | 270 if (remora_controller_) { |
256 remora_controller_->OnEnrollmentStatusChanged( | 271 remora_controller_->OnEnrollmentStatusChanged( |
257 HostPairingController::ENROLLMENT_STATUS_FAILURE); | 272 HostPairingController::ENROLLMENT_STATUS_FAILURE); |
258 } | 273 } |
259 } | 274 } |
260 | 275 |
261 } // namespace chromeos | 276 } // namespace chromeos |
OLD | NEW |