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

Unified Diff: chromeos/attestation/attestation_flow.h

Issue 2529743002: Wait for the attestation to be ready (TPM being prepared for attestation) before trying to enroll. (Closed)
Patch Set: Inverted condition for easier reading. Created 4 years 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
« no previous file with comments | « no previous file | chromeos/attestation/attestation_flow.cc » ('j') | chromeos/attestation/attestation_flow.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | chromeos/attestation/attestation_flow.cc » ('j') | chromeos/attestation/attestation_flow.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698