Chromium Code Reviews| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 case GoogleServiceAuthError::ACCOUNT_DISABLED: | 114 case GoogleServiceAuthError::ACCOUNT_DISABLED: |
| 115 UMAFailure(policy::kMetricEnrollmentNotSupported); | 115 UMAFailure(policy::kMetricEnrollmentNotSupported); |
| 116 LOG(ERROR) << "Account error " << error.state(); | 116 LOG(ERROR) << "Account error " << error.state(); |
| 117 return; | 117 return; |
| 118 case GoogleServiceAuthError::CONNECTION_FAILED: | 118 case GoogleServiceAuthError::CONNECTION_FAILED: |
| 119 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: | 119 case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
| 120 UMAFailure(policy::kMetricEnrollmentNetworkFailed); | 120 UMAFailure(policy::kMetricEnrollmentNetworkFailed); |
| 121 LOG(WARNING) << "Network error " << error.state(); | 121 LOG(WARNING) << "Network error " << error.state(); |
| 122 return; | 122 return; |
| 123 case GoogleServiceAuthError::NUM_STATES: | 123 case GoogleServiceAuthError::NUM_STATES: |
| 124 break; | 124 NOTREACHED(); |
| 125 return; | |
| 125 } | 126 } |
| 126 | |
| 127 NOTREACHED(); | 127 NOTREACHED(); |
| 128 UMAFailure(policy::kMetricEnrollmentOtherFailed); | |
|
Joao da Silva
2014/08/14 12:11:10
Why was this sample removed? Even though it's not
Thiemo Nagel
2014/08/14 14:52:37
It's after a switch on an enum. The compiler will
| |
| 129 } | 128 } |
| 130 | 129 |
| 131 void EnrollmentScreen::OnOAuthTokenAvailable(const std::string& token) { | 130 void EnrollmentScreen::OnOAuthTokenAvailable(const std::string& token) { |
| 132 RegisterForDevicePolicy(token); | 131 RegisterForDevicePolicy(token); |
| 133 } | 132 } |
| 134 | 133 |
| 135 void EnrollmentScreen::OnRetry() { | 134 void EnrollmentScreen::OnRetry() { |
| 136 actor_->ResetAuth(base::Bind(&EnrollmentScreen::ShowSigninScreen, | 135 actor_->ResetAuth(base::Bind(&EnrollmentScreen::ShowSigninScreen, |
| 137 weak_ptr_factory_.GetWeakPtr())); | 136 weak_ptr_factory_.GetWeakPtr())); |
| 138 } | 137 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 291 return; | 290 return; |
| 292 case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED: | 291 case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED: |
| 293 UMAFailure(policy::kMetricEnrollmentRobotRefreshTokenStoreFailed); | 292 UMAFailure(policy::kMetricEnrollmentRobotRefreshTokenStoreFailed); |
| 294 return; | 293 return; |
| 295 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: | 294 case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: |
| 296 // This error should not happen for enterprise enrollment. | 295 // This error should not happen for enterprise enrollment. |
| 297 UMAFailure(policy::kMetricEnrollmentStoreTokenAndIdFailed); | 296 UMAFailure(policy::kMetricEnrollmentStoreTokenAndIdFailed); |
| 298 NOTREACHED(); | 297 NOTREACHED(); |
| 299 return; | 298 return; |
| 300 case policy::EnrollmentStatus::STATUS_SUCCESS: | 299 case policy::EnrollmentStatus::STATUS_SUCCESS: |
| 301 NOTREACHED(); | 300 NOTREACHED(); |
|
Joao da Silva
2014/08/14 12:11:10
Would be nice to have a sample here too, as this i
Thiemo Nagel
2014/08/14 14:52:37
This case is treated in line 221. I've refactored
| |
| 302 return; | 301 return; |
| 303 } | 302 } |
| 304 | |
| 305 NOTREACHED(); | 303 NOTREACHED(); |
| 306 UMAFailure(policy::kMetricEnrollmentOtherFailed); | |
|
Joao da Silva
2014/08/14 12:11:10
Same here
Thiemo Nagel
2014/08/14 14:52:37
Same as above.
| |
| 307 } | 304 } |
| 308 | 305 |
| 309 void EnrollmentScreen::UMA(policy::MetricEnrollment sample) { | 306 void EnrollmentScreen::UMA(policy::MetricEnrollment sample) { |
| 310 if (enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_RECOVERY) { | 307 if (enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_RECOVERY) { |
| 311 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollmentRecovery, sample, | 308 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollmentRecovery, sample, |
| 312 policy::kMetricEnrollmentSize); | 309 policy::kMetricEnrollmentSize); |
| 313 } else { | 310 } else { |
| 314 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, sample, | 311 UMA_HISTOGRAM_ENUMERATION(policy::kMetricEnrollment, sample, |
| 315 policy::kMetricEnrollmentSize); | 312 policy::kMetricEnrollmentSize); |
| 316 } | 313 } |
| 317 } | 314 } |
| 318 | 315 |
| 319 void EnrollmentScreen::UMAFailure(policy::MetricEnrollment sample) { | 316 void EnrollmentScreen::UMAFailure(policy::MetricEnrollment sample) { |
| 320 if (is_auto_enrollment()) | 317 if (is_auto_enrollment()) |
| 321 sample = policy::kMetricEnrollmentAutoFailed; | 318 sample = policy::kMetricEnrollmentAutoFailed; |
| 322 UMA(sample); | 319 UMA(sample); |
| 323 } | 320 } |
| 324 | 321 |
| 325 void EnrollmentScreen::ShowSigninScreen() { | 322 void EnrollmentScreen::ShowSigninScreen() { |
| 326 actor_->Show(); | 323 actor_->Show(); |
| 327 actor_->ShowSigninScreen(); | 324 actor_->ShowSigninScreen(); |
| 328 } | 325 } |
| 329 | 326 |
| 330 } // namespace chromeos | 327 } // namespace chromeos |
| OLD | NEW |