Index: chrome/browser/chromeos/login/enrollment/enrollment_screen.cc |
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc |
index 3a97f7af7017d7d7072ea82a05711ea816f19597..7e0278a89439248020eeb8c3e466ca8a69dbc8e6 100644 |
--- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc |
+++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc |
@@ -94,6 +94,9 @@ |
} |
void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) { |
+ enrollment_failed_once_ = true; |
+ actor_->ShowAuthError(error); |
+ |
switch (error.state()) { |
case GoogleServiceAuthError::NONE: |
case GoogleServiceAuthError::CAPTCHA_REQUIRED: |
@@ -105,25 +108,24 @@ |
case GoogleServiceAuthError::SERVICE_ERROR: |
UMAFailure(policy::kMetricEnrollmentLoginFailed); |
LOG(ERROR) << "Auth error " << error.state(); |
- break; |
+ return; |
case GoogleServiceAuthError::USER_NOT_SIGNED_UP: |
case GoogleServiceAuthError::ACCOUNT_DELETED: |
case GoogleServiceAuthError::ACCOUNT_DISABLED: |
UMAFailure(policy::kMetricEnrollmentNotSupported); |
LOG(ERROR) << "Account error " << error.state(); |
- break; |
+ return; |
case GoogleServiceAuthError::CONNECTION_FAILED: |
case GoogleServiceAuthError::SERVICE_UNAVAILABLE: |
UMAFailure(policy::kMetricEnrollmentNetworkFailed); |
LOG(WARNING) << "Network error " << error.state(); |
+ return; |
+ case GoogleServiceAuthError::NUM_STATES: |
break; |
- case GoogleServiceAuthError::NUM_STATES: |
- NOTREACHED(); |
- break; |
- } |
- |
- enrollment_failed_once_ = true; |
- actor_->ShowAuthError(error); |
+ } |
+ |
+ NOTREACHED(); |
+ UMAFailure(policy::kMetricEnrollmentOtherFailed); |
} |
void EnrollmentScreen::OnOAuthTokenAvailable(const std::string& token) { |
@@ -217,15 +219,20 @@ |
} |
void EnrollmentScreen::ReportEnrollmentStatus(policy::EnrollmentStatus status) { |
+ if (status.status() == policy::EnrollmentStatus::STATUS_SUCCESS) { |
+ StartupUtils::MarkDeviceRegistered( |
+ base::Bind(&EnrollmentScreen::ShowEnrollmentStatusOnSuccess, |
+ weak_ptr_factory_.GetWeakPtr(), |
+ status)); |
+ UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoOK |
+ : policy::kMetricEnrollmentOK); |
+ return; |
+ } else { |
+ enrollment_failed_once_ = true; |
+ } |
+ actor_->ShowEnrollmentStatus(status); |
+ |
switch (status.status()) { |
- case policy::EnrollmentStatus::STATUS_SUCCESS: |
- StartupUtils::MarkDeviceRegistered( |
- base::Bind(&EnrollmentScreen::ShowEnrollmentStatusOnSuccess, |
- weak_ptr_factory_.GetWeakPtr(), |
- status)); |
- UMA(is_auto_enrollment() ? policy::kMetricEnrollmentAutoOK |
- : policy::kMetricEnrollmentOK); |
- return; |
case policy::EnrollmentStatus::STATUS_REGISTRATION_FAILED: |
case policy::EnrollmentStatus::STATUS_POLICY_FETCH_FAILED: |
switch (status.client_status()) { |
@@ -237,70 +244,72 @@ |
case policy::DM_STATUS_SERVICE_DEVICE_ID_CONFLICT: |
case policy::DM_STATUS_SERVICE_POLICY_NOT_FOUND: |
UMAFailure(policy::kMetricEnrollmentOtherFailed); |
- break; |
+ return; |
case policy::DM_STATUS_REQUEST_FAILED: |
case policy::DM_STATUS_TEMPORARY_UNAVAILABLE: |
case policy::DM_STATUS_HTTP_STATUS_ERROR: |
case policy::DM_STATUS_RESPONSE_DECODING_ERROR: |
UMAFailure(policy::kMetricEnrollmentNetworkFailed); |
- break; |
+ return; |
case policy::DM_STATUS_SERVICE_MANAGEMENT_NOT_SUPPORTED: |
UMAFailure(policy::kMetricEnrollmentNotSupported); |
- break; |
+ return; |
case policy::DM_STATUS_SERVICE_INVALID_SERIAL_NUMBER: |
UMAFailure(policy::kMetricEnrollmentInvalidSerialNumber); |
- break; |
+ return; |
case policy::DM_STATUS_SERVICE_MISSING_LICENSES: |
UMAFailure(policy::kMetricMissingLicensesError); |
- break; |
+ return; |
case policy::DM_STATUS_SERVICE_DEPROVISIONED: |
UMAFailure(policy::kMetricEnrollmentDeprovisioned); |
- break; |
+ return; |
case policy::DM_STATUS_SERVICE_DOMAIN_MISMATCH: |
UMAFailure(policy::kMetricEnrollmentDomainMismatch); |
- break; |
+ return; |
} |
break; |
case policy::EnrollmentStatus::STATUS_REGISTRATION_BAD_MODE: |
UMAFailure(policy::kMetricEnrollmentInvalidEnrollmentMode); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_LOCK_TIMEOUT: |
UMAFailure(policy::kMetricLockboxTimeoutError); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_LOCK_WRONG_USER: |
UMAFailure(policy::kMetricEnrollmentWrongUserError); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_NO_STATE_KEYS: |
UMAFailure(policy::kMetricEnrollmentNoStateKeys); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_VALIDATION_FAILED: |
UMAFailure(policy::kMetricEnrollmentPolicyValidationFailed); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_STORE_ERROR: |
UMAFailure(policy::kMetricEnrollmentCloudPolicyStoreError); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_LOCK_ERROR: |
UMAFailure(policy::kMetricEnrollmentLockBackendError); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_ROBOT_AUTH_FETCH_FAILED: |
UMAFailure(policy::kMetricEnrollmentRobotAuthCodeFetchFailed); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_FETCH_FAILED: |
UMAFailure(policy::kMetricEnrollmentRobotRefreshTokenFetchFailed); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED: |
UMAFailure(policy::kMetricEnrollmentRobotRefreshTokenStoreFailed); |
- break; |
+ return; |
case policy::EnrollmentStatus::STATUS_STORE_TOKEN_AND_ID_FAILED: |
- // This error should not happen for enterprise enrollment, it only affects |
- // consumer enrollment. |
+ // This error should not happen for enterprise enrollment. |
UMAFailure(policy::kMetricEnrollmentStoreTokenAndIdFailed); |
NOTREACHED(); |
- break; |
- } |
- |
- enrollment_failed_once_ = true; |
- actor_->ShowEnrollmentStatus(status); |
+ return; |
+ case policy::EnrollmentStatus::STATUS_SUCCESS: |
+ NOTREACHED(); |
+ return; |
+ } |
+ |
+ NOTREACHED(); |
+ UMAFailure(policy::kMetricEnrollmentOtherFailed); |
} |
void EnrollmentScreen::UMA(policy::MetricEnrollment sample) { |