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/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 namespace chromeos { | 57 namespace chromeos { |
58 | 58 |
59 // static | 59 // static |
60 EnrollmentScreen* EnrollmentScreen::Get(ScreenManager* manager) { | 60 EnrollmentScreen* EnrollmentScreen::Get(ScreenManager* manager) { |
61 return static_cast<EnrollmentScreen*>( | 61 return static_cast<EnrollmentScreen*>( |
62 manager->GetScreen(WizardController::kEnrollmentScreenName)); | 62 manager->GetScreen(WizardController::kEnrollmentScreenName)); |
63 } | 63 } |
64 | 64 |
65 EnrollmentScreen::EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, | 65 EnrollmentScreen::EnrollmentScreen(BaseScreenDelegate* base_screen_delegate, |
66 EnrollmentScreenActor* actor) | 66 EnrollmentScreenActor* actor) |
67 : BaseScreen(base_screen_delegate), | 67 : BaseScreen(base_screen_delegate, WizardController::kEnrollmentScreenName), |
68 actor_(actor), | 68 actor_(actor), |
69 weak_ptr_factory_(this) {} | 69 weak_ptr_factory_(this) {} |
70 | 70 |
71 EnrollmentScreen::~EnrollmentScreen() { | 71 EnrollmentScreen::~EnrollmentScreen() { |
72 DCHECK(!enrollment_helper_ || g_browser_process->IsShuttingDown()); | 72 DCHECK(!enrollment_helper_ || g_browser_process->IsShuttingDown()); |
73 } | 73 } |
74 | 74 |
75 void EnrollmentScreen::SetParameters( | 75 void EnrollmentScreen::SetParameters( |
76 const policy::EnrollmentConfig& enrollment_config, | 76 const policy::EnrollmentConfig& enrollment_config, |
77 pairing_chromeos::ControllerPairingController* shark_controller) { | 77 pairing_chromeos::ControllerPairingController* shark_controller) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void EnrollmentScreen::ShowInteractiveScreen() { | 159 void EnrollmentScreen::ShowInteractiveScreen() { |
160 ClearAuth(base::Bind(&EnrollmentScreen::ShowSigninScreen, | 160 ClearAuth(base::Bind(&EnrollmentScreen::ShowSigninScreen, |
161 weak_ptr_factory_.GetWeakPtr())); | 161 weak_ptr_factory_.GetWeakPtr())); |
162 } | 162 } |
163 | 163 |
164 void EnrollmentScreen::Hide() { | 164 void EnrollmentScreen::Hide() { |
165 actor_->Hide(); | 165 actor_->Hide(); |
166 weak_ptr_factory_.InvalidateWeakPtrs(); | 166 weak_ptr_factory_.InvalidateWeakPtrs(); |
167 } | 167 } |
168 | 168 |
169 std::string EnrollmentScreen::GetName() const { | |
170 return WizardController::kEnrollmentScreenName; | |
171 } | |
172 | |
173 void EnrollmentScreen::AuthenticateUsingAttestation() { | 169 void EnrollmentScreen::AuthenticateUsingAttestation() { |
174 VLOG(1) << "Authenticating using attestation."; | 170 VLOG(1) << "Authenticating using attestation."; |
175 elapsed_timer_.reset(new base::ElapsedTimer()); | 171 elapsed_timer_.reset(new base::ElapsedTimer()); |
176 actor_->Show(); | 172 actor_->Show(); |
177 CreateEnrollmentHelper(); | 173 CreateEnrollmentHelper(); |
178 enrollment_helper_->EnrollUsingAttestation(); | 174 enrollment_helper_->EnrollUsingAttestation(); |
179 } | 175 } |
180 | 176 |
181 void EnrollmentScreen::OnLoginDone(const std::string& user, | 177 void EnrollmentScreen::OnLoginDone(const std::string& user, |
182 const std::string& auth_code) { | 178 const std::string& auth_code) { |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 339 } |
344 | 340 |
345 void EnrollmentScreen::RecordEnrollmentErrorMetrics() { | 341 void EnrollmentScreen::RecordEnrollmentErrorMetrics() { |
346 enrollment_failed_once_ = true; | 342 enrollment_failed_once_ = true; |
347 // TODO(drcrash): Maybe create multiple metrics (http://crbug.com/640313)? | 343 // TODO(drcrash): Maybe create multiple metrics (http://crbug.com/640313)? |
348 if (elapsed_timer_) | 344 if (elapsed_timer_) |
349 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); | 345 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); |
350 } | 346 } |
351 | 347 |
352 } // namespace chromeos | 348 } // namespace chromeos |
OLD | NEW |