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

Side by Side Diff: chrome/browser/chromeos/attestation/attestation_policy_observer.h

Issue 18053006: Added retry support to AttestationPolicyObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 CryptohomeClient* cryptohome_client, 43 CryptohomeClient* cryptohome_client,
44 AttestationFlow* attestation_flow); 44 AttestationFlow* attestation_flow);
45 45
46 virtual ~AttestationPolicyObserver(); 46 virtual ~AttestationPolicyObserver();
47 47
48 // content::NotificationObserver: 48 // content::NotificationObserver:
49 virtual void Observe(int type, 49 virtual void Observe(int type,
50 const content::NotificationSource& source, 50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE; 51 const content::NotificationDetails& details) OVERRIDE;
52 52
53 // Sets the retry delay in seconds; useful in testing.
54 void set_retry_delay(int retry_delay) {
55 retry_delay_ = retry_delay;
56 }
57
53 private: 58 private:
54 // Checks attestation policy and starts any necessary work. 59 // Checks attestation policy and starts any necessary work.
55 void Start(); 60 void Start();
56 61
57 // Gets a new certificate for the Enterprise Machine Key (EMK). 62 // Gets a new certificate for the Enterprise Machine Key (EMK).
58 void GetNewCertificate(); 63 void GetNewCertificate();
59 64
60 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry. 65 // Gets the existing EMK certificate and sends it to CheckCertificateExpiry.
61 void GetExistingCertificate(); 66 void GetExistingCertificate();
62 67
(...skipping 10 matching lines...) Expand all
73 // Gets the payload associated with the EMK and sends it to |callback|. 78 // Gets the payload associated with the EMK and sends it to |callback|.
74 void GetKeyPayload(base::Callback<void(const std::string&)> callback); 79 void GetKeyPayload(base::Callback<void(const std::string&)> callback);
75 80
76 // Called when a certificate upload operation completes. On success, |status| 81 // Called when a certificate upload operation completes. On success, |status|
77 // will be true. 82 // will be true.
78 void OnUploadComplete(bool status); 83 void OnUploadComplete(bool status);
79 84
80 // Marks a key as uploaded in the payload proto. 85 // Marks a key as uploaded in the payload proto.
81 void MarkAsUploaded(const std::string& key_payload); 86 void MarkAsUploaded(const std::string& key_payload);
82 87
88 // Reschedules a policy check (i.e. a call to Start) for a later time.
89 void Reschedule();
90
83 CrosSettings* cros_settings_; 91 CrosSettings* cros_settings_;
84 policy::CloudPolicyClient* policy_client_; 92 policy::CloudPolicyClient* policy_client_;
85 CryptohomeClient* cryptohome_client_; 93 CryptohomeClient* cryptohome_client_;
86 AttestationFlow* attestation_flow_; 94 AttestationFlow* attestation_flow_;
87 scoped_ptr<AttestationFlow> default_attestation_flow_; 95 scoped_ptr<AttestationFlow> default_attestation_flow_;
96 int num_retries_;
97 int retry_delay_;
88 98
89 // Note: This should remain the last member so it'll be destroyed and 99 // Note: This should remain the last member so it'll be destroyed and
90 // invalidate the weak pointers before any other members are destroyed. 100 // invalidate the weak pointers before any other members are destroyed.
91 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_; 101 base::WeakPtrFactory<AttestationPolicyObserver> weak_factory_;
92 102
93 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver); 103 DISALLOW_COPY_AND_ASSIGN(AttestationPolicyObserver);
94 }; 104 };
95 105
96 } // namespace attestation 106 } // namespace attestation
97 } // namespace chromeos 107 } // namespace chromeos
98 108
99 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_ 109 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_ATTESTATION_POLICY_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698