Index: chromeos/attestation/attestation_flow.h |
diff --git a/chromeos/attestation/attestation_flow.h b/chromeos/attestation/attestation_flow.h |
index 26a7292d60a9d4eab6901f21e268e31b6a799846..ef344e802e5cf720412a223b9d8aab0f47c7be73 100644 |
--- a/chromeos/attestation/attestation_flow.h |
+++ b/chromeos/attestation/attestation_flow.h |
@@ -14,10 +14,17 @@ |
#include "chromeos/attestation/attestation_constants.h" |
#include "chromeos/chromeos_export.h" |
#include "chromeos/dbus/dbus_method_call_status.h" |
+#include "net/base/backoff_entry.h" |
#include "third_party/cros_system_api/dbus/service_constants.h" |
class AccountId; |
+namespace base { |
+ |
+class OneShotTimer; |
+ |
+} // namespace base |
+ |
namespace cryptohome { |
class AsyncMethodCaller; |
@@ -108,8 +115,29 @@ class CHROMEOS_EXPORT AttestationFlow { |
bool force_new_key, |
const CertificateCallback& callback); |
+ // Sets the retry timer for tests. |
+ void SetRetryTimerForTest(std::unique_ptr<base::OneShotTimer> retry_timer); |
+ |
private: |
// Asynchronously initiates the attestation enrollment flow. |
+ // If attestation is not ready yet, retry as needed. |
+ // |
+ // Parameters |
+ // on_failure - Called if any failure occurs. |
+ // next_task - Called on successful enrollment. |
+ void InitiateEnroll(const base::Closure& on_failure, |
+ const base::Closure& next_task); |
+ |
+ // Called when atestation is not prepared yet, to re-initiate enrollment |
+ // after a delay. |
+ // |
+ // Parameters |
+ // on_failure - Called if any failure occurs. |
+ // next_task - Called on successful enrollment. |
+ void RetryInitiateEnroll(const base::Closure& on_failure, |
+ const base::Closure& next_task); |
+ |
+ // Called when attestation is prepared, to start the actual enrollment flow. |
// |
// Parameters |
// on_failure - Called if any failure occurs. |
@@ -227,6 +255,10 @@ class CHROMEOS_EXPORT AttestationFlow { |
CryptohomeClient* cryptohome_client_; |
std::unique_ptr<ServerProxy> server_proxy_; |
+ int16_t initiate_enroll_retries_ = 7; // -1 is unlimited retries. |
apronin1
2016/12/02 01:36:24
don't we want unlimited retries by default? why 7
|
+ std::unique_ptr<base::OneShotTimer> retry_timer_; |
+ net::BackoffEntry retry_backoff_; |
+ |
base::WeakPtrFactory<AttestationFlow> weak_factory_; |
DISALLOW_COPY_AND_ASSIGN(AttestationFlow); |