| 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 6652c6b9e495a9454085bcefd59c4ebf3dd0325d..0a06fe28935144a8b28dc857f0ceb5e8dc160671 100644
|
| --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
|
| @@ -66,7 +66,16 @@ EnrollmentScreen::EnrollmentScreen(BaseScreenDelegate* base_screen_delegate,
|
| EnrollmentScreenActor* actor)
|
| : BaseScreen(base_screen_delegate, OobeScreen::SCREEN_OOBE_ENROLLMENT),
|
| actor_(actor),
|
| - weak_ptr_factory_(this) {}
|
| + weak_ptr_factory_(this) {
|
| + retry_policy_.num_errors_to_ignore = 0;
|
| + retry_policy_.initial_delay_ms = 4000;
|
| + retry_policy_.multiply_factor = 1.5;
|
| + retry_policy_.jitter_factor = 0.1;
|
| + retry_policy_.maximum_backoff_ms = 480000;
|
| + retry_policy_.entry_lifetime_ms = -1;
|
| + retry_policy_.always_use_initial_delay = true;
|
| + retry_backoff_.reset(new net::BackoffEntry(&retry_policy_));
|
| +}
|
|
|
| EnrollmentScreen::~EnrollmentScreen() {
|
| DCHECK(!enrollment_helper_ || g_browser_process->IsShuttingDown());
|
| @@ -190,6 +199,24 @@ void EnrollmentScreen::OnLoginDone(const std::string& user,
|
| }
|
|
|
| void EnrollmentScreen::OnRetry() {
|
| + retry_task_.Cancel();
|
| + LOG(WARNING) << "Enrollment retry " << ++num_retries_
|
| + << " initiated by user button press.";
|
| + ProcessRetry();
|
| +}
|
| +
|
| +void EnrollmentScreen::AutomaticRetry() {
|
| + retry_backoff_->InformOfRequest(false);
|
| + retry_task_.Reset(base::Bind(&EnrollmentScreen::ProcessRetry,
|
| + weak_ptr_factory_.GetWeakPtr()));
|
| +
|
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
|
| + FROM_HERE, retry_task_.callback(), retry_backoff_->GetTimeUntilRelease());
|
| + LOG(WARNING) << "Enrollment retry " << ++num_retries_
|
| + << " initiated by timer.";
|
| +}
|
| +
|
| +void EnrollmentScreen::ProcessRetry() {
|
| Show();
|
| }
|
|
|
| @@ -243,16 +270,21 @@ void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
|
| // based enrollment and we have a fallback authentication, show it.
|
| if (status.status() == policy::EnrollmentStatus::REGISTRATION_FAILED &&
|
| status.client_status() == policy::DM_STATUS_SERVICE_DEVICE_NOT_FOUND &&
|
| - current_auth_ == AUTH_ATTESTATION && AdvanceToNextAuth())
|
| + current_auth_ == AUTH_ATTESTATION && AdvanceToNextAuth()) {
|
| Show();
|
| - else
|
| + } else {
|
| actor_->ShowEnrollmentStatus(status);
|
| + if (UsingHandsOffEnrollment())
|
| + AutomaticRetry();
|
| + }
|
| }
|
|
|
| void EnrollmentScreen::OnOtherError(
|
| EnterpriseEnrollmentHelper::OtherError error) {
|
| RecordEnrollmentErrorMetrics();
|
| actor_->ShowOtherError(error);
|
| + if (UsingHandsOffEnrollment())
|
| + AutomaticRetry();
|
| }
|
|
|
| void EnrollmentScreen::OnDeviceEnrolled(const std::string& additional_token) {
|
| @@ -323,6 +355,7 @@ void EnrollmentScreen::SendEnrollmentAuthToken(const std::string& token) {
|
| }
|
|
|
| void EnrollmentScreen::ShowEnrollmentStatusOnSuccess() {
|
| + retry_backoff_->InformOfRequest(true);
|
| if (elapsed_timer_)
|
| UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeSuccess, elapsed_timer_);
|
| actor_->ShowEnrollmentStatus(
|
| @@ -345,4 +378,10 @@ void EnrollmentScreen::RecordEnrollmentErrorMetrics() {
|
| UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_);
|
| }
|
|
|
| +bool EnrollmentScreen::UsingHandsOffEnrollment() {
|
| + return policy::DeviceCloudPolicyManagerChromeOS::
|
| + GetZeroTouchEnrollmentMode() ==
|
| + policy::ZeroTouchEnrollmentMode::HANDS_OFF;
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|