Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1253)

Unified Diff: chrome/browser/chromeos/login/enrollment/enrollment_screen.cc

Issue 2526973002: Added retry policy (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 b752d4e61daf06870246a90520e41c1071b32fdf..b7713e88ad857302dff195a09232e564ffc7fa8d 100644
--- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
+++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.cc
@@ -64,9 +64,16 @@ EnrollmentScreen* EnrollmentScreen::Get(ScreenManager* manager) {
EnrollmentScreen::EnrollmentScreen(BaseScreenDelegate* base_screen_delegate,
EnrollmentScreenActor* actor)
- : BaseScreen(base_screen_delegate),
- actor_(actor),
- weak_ptr_factory_(this) {}
+ : BaseScreen(base_screen_delegate), actor_(actor), weak_ptr_factory_(this) {
joth 2016/11/23 22:24:02 as a general guide use initializer list when you c
kumarniranjan 2016/11/24 18:12:46 Done.
+ policy_ = new net::BackoffEntry::Policy();
+ policy_->num_errors_to_ignore = 0;
+ policy_->initial_delay_ms = 4000;
+ policy_->multiply_factor = 2.0;
joth 2016/11/23 22:24:02 given we're using this to paper over the TPM init,
kumarniranjan 2016/11/24 18:12:46 Done.
+ policy_->jitter_factor = 0.1;
+ policy_->maximum_backoff_ms = -1;
joth 2016/11/23 22:24:03 Lets cap the maximum delay to 8 minutes
kumarniranjan 2016/11/24 18:12:46 Done.
+ policy_->entry_lifetime_ms = -1;
+ backoff_ = new net::BackoffEntry(policy_);
+}
EnrollmentScreen::~EnrollmentScreen() {
DCHECK(!enrollment_helper_ || g_browser_process->IsShuttingDown());
@@ -253,8 +260,17 @@ void EnrollmentScreen::OnEnrollmentError(policy::EnrollmentStatus status) {
status.client_status() == policy::DM_STATUS_SERVICE_DEVICE_NOT_FOUND &&
current_auth_ == AUTH_ATTESTATION && AdvanceToNextAuth())
Show();
- else
+ else {
actor_->ShowEnrollmentStatus(status);
+ if (policy::DeviceCloudPolicyManagerChromeOS::
+ GetZeroTouchEnrollmentMode() ==
+ policy::ZeroTouchEnrollmentMode::HANDS_OFF) {
+ backoff_->InformOfRequest(false);
+ timer_.Start(FROM_HERE, backoff_->GetTimeUntilRelease(),
+ base::Bind(&EnrollmentScreen::OnRetry,
joth 2016/11/23 22:24:02 I don't have a strong preference, but it maybe cle
kumarniranjan 2016/11/24 18:12:46 I agree. I ended up calling the method "ProcessRet
+ weak_ptr_factory_.GetWeakPtr()));
+ }
+ }
}
void EnrollmentScreen::OnOtherError(
@@ -331,6 +347,7 @@ void EnrollmentScreen::SendEnrollmentAuthToken(const std::string& token) {
}
void EnrollmentScreen::ShowEnrollmentStatusOnSuccess() {
+ backoff_->InformOfRequest(true);
if (elapsed_timer_)
UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeSuccess, elapsed_timer_);
actor_->ShowEnrollmentStatus(policy::EnrollmentStatus::ForStatus(

Powered by Google App Engine
This is Rietveld 408576698