Chromium Code Reviews| Index: chrome/browser/chromeos/login/enrollment/enrollment_screen.h |
| diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h |
| index 6ccefec99d23346a24fbbc348a6d843afc5ca77c..04c08e09c2dee5f012e541334fa85278c1887027 100644 |
| --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen.h |
| +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen.h |
| @@ -9,6 +9,7 @@ |
| #include <string> |
| #include "base/callback_forward.h" |
| +#include "base/cancelable_callback.h" |
| #include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| @@ -19,6 +20,7 @@ |
| #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
| #include "components/policy/core/common/cloud/enterprise_metrics.h" |
| +#include "net/base/backoff_entry.h" |
| namespace base { |
| class ElapsedTimer; |
| @@ -81,6 +83,7 @@ class EnrollmentScreen |
| } |
| private: |
| + friend class EnterpriseEnrollmentHelperMock; |
| FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestSuccess); |
| FRIEND_TEST_ALL_PREFIXES(AttestationAuthEnrollmentScreenTest, TestCancel); |
| FRIEND_TEST_ALL_PREFIXES(ForcedAttestationAuthEnrollmentScreenTest, |
| @@ -93,6 +96,9 @@ class EnrollmentScreen |
| FRIEND_TEST_ALL_PREFIXES(EnterpriseEnrollmentTest, |
| TestAuthCodeGetsProperlyReceivedFromGaia); |
| FRIEND_TEST_ALL_PREFIXES(HandsOffNetworkScreenTest, RequiresNoInput); |
| + FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, Retries); |
| + FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryOnTopOfUser); |
| + FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenUnitTest, DoesNotRetryAfterSuccess); |
| // The authentication mechanisms that this class can use. |
| enum Auth { |
| @@ -144,6 +150,18 @@ class EnrollmentScreen |
| // Advance to the next authentication mechanism if possible. |
| bool AdvanceToNextAuth(); |
| + // Similar to OnRetry(), but responds to a timer instead of the user |
| + // pressing the Retry button. |
| + void AutomaticRetry(); |
| + |
| + // Processes a request to retry enrollment. |
| + // Called by OnRetry() and AutomaticRetry(). |
| + void ProcessRetry(); |
| + |
| + // True if we are using Hands-Off Zero-Touch Attestation-Based Enterprise |
| + // Enrollment. |
| + bool UsingHandsOffEnrollment(); |
| + |
| pairing_chromeos::ControllerPairingController* shark_controller_ = nullptr; |
| EnrollmentScreenActor* actor_; |
| @@ -155,9 +173,19 @@ class EnrollmentScreen |
| std::string enrolling_user_domain_; |
| std::string auth_code_; |
| std::unique_ptr<base::ElapsedTimer> elapsed_timer_; |
| + net::BackoffEntry::Policy retry_policy_; |
| + std::unique_ptr<net::BackoffEntry> retry_backoff_; |
| + base::CancelableClosure retry_task_; |
| + int num_retries_ = 0; |
| std::unique_ptr<EnterpriseEnrollmentHelper> enrollment_helper_; |
| base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_; |
| + // Retry policy constants. |
| + static const int INITIAL_DELAY = 4000; // 4 seconds |
| + static constexpr double MULTIPLY_FACTOR = 1.5; |
| + static constexpr double JITTER_FACTOR = 0.1; // +/- 10% jitter |
| + static const int64_t MAX_DELAY = 480000; // 8 minutes |
|
joth
2017/02/01 21:51:33
nit: (unless others suggested otherwise) I like th
kumarniranjan
2017/02/01 22:01:37
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen); |
| }; |