OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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_PLATFORM_VERIFICATION_FLOW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/timer/timer.h" | 15 #include "base/timer/timer.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 class WebContents; | 19 class WebContents; |
20 } | 20 } |
21 | 21 |
22 namespace cryptohome { | 22 namespace cryptohome { |
23 class AsyncMethodCaller; | 23 class AsyncMethodCaller; |
24 } | 24 } |
25 | 25 |
26 namespace user_manager { | 26 namespace user_manager { |
27 class User; | 27 class User; |
| 28 class UserID; |
28 } | 29 } |
29 | 30 |
30 namespace chromeos { | 31 namespace chromeos { |
31 | 32 |
32 class CryptohomeClient; | 33 class CryptohomeClient; |
33 | 34 |
34 namespace attestation { | 35 namespace attestation { |
35 | 36 |
36 class AttestationFlow; | 37 class AttestationFlow; |
37 class PlatformVerificationFlowTest; | 38 class PlatformVerificationFlowTest; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // has been prepared on this device. | 163 // has been prepared on this device. |
163 void OnAttestationPrepared(const ChallengeContext& context, | 164 void OnAttestationPrepared(const ChallengeContext& context, |
164 bool attestation_prepared); | 165 bool attestation_prepared); |
165 | 166 |
166 // Initiates the flow to get a platform key certificate. The arguments to | 167 // Initiates the flow to get a platform key certificate. The arguments to |
167 // ChallengePlatformKey are in |context|. |user_id| identifies the user for | 168 // ChallengePlatformKey are in |context|. |user_id| identifies the user for |
168 // which to get a certificate. If |force_new_key| is true then any existing | 169 // which to get a certificate. If |force_new_key| is true then any existing |
169 // key for the same user and service will be ignored and a new key will be | 170 // key for the same user and service will be ignored and a new key will be |
170 // generated and certified. | 171 // generated and certified. |
171 void GetCertificate(const ChallengeContext& context, | 172 void GetCertificate(const ChallengeContext& context, |
172 const std::string& user_id, | 173 const user_manager::UserID& user_id, |
173 bool force_new_key); | 174 bool force_new_key); |
174 | 175 |
175 // A callback called when an attestation certificate request operation | 176 // A callback called when an attestation certificate request operation |
176 // completes. The arguments to ChallengePlatformKey are in |context|. | 177 // completes. The arguments to ChallengePlatformKey are in |context|. |
177 // |user_id| identifies the user for which the certificate was requested. | 178 // |user_id| identifies the user for which the certificate was requested. |
178 // |operation_success| is true iff the certificate request operation | 179 // |operation_success| is true iff the certificate request operation |
179 // succeeded. |certificate| holds the certificate for the platform key on | 180 // succeeded. |certificate| holds the certificate for the platform key on |
180 // success. If the certificate request was successful, this method invokes a | 181 // success. If the certificate request was successful, this method invokes a |
181 // request to sign the challenge. If the operation timed out prior to this | 182 // request to sign the challenge. If the operation timed out prior to this |
182 // method being called, this method does nothing - notably, the callback is | 183 // method being called, this method does nothing - notably, the callback is |
183 // not invoked. | 184 // not invoked. |
184 void OnCertificateReady(const ChallengeContext& context, | 185 void OnCertificateReady(const ChallengeContext& context, |
185 const std::string& user_id, | 186 const user_manager::UserID& user_id, |
186 scoped_ptr<base::Timer> timer, | 187 scoped_ptr<base::Timer> timer, |
187 bool operation_success, | 188 bool operation_success, |
188 const std::string& certificate); | 189 const std::string& certificate); |
189 | 190 |
190 // A callback run after a constant delay to handle timeouts for lengthy | 191 // A callback run after a constant delay to handle timeouts for lengthy |
191 // certificate requests. |context.callback| will be invoked with a TIMEOUT | 192 // certificate requests. |context.callback| will be invoked with a TIMEOUT |
192 // result. | 193 // result. |
193 void OnCertificateTimeout(const ChallengeContext& context); | 194 void OnCertificateTimeout(const ChallengeContext& context); |
194 | 195 |
195 // A callback called when a challenge signing request has completed. The | 196 // A callback called when a challenge signing request has completed. The |
(...skipping 21 matching lines...) Expand all Loading... |
217 scoped_ptr<Delegate> default_delegate_; | 218 scoped_ptr<Delegate> default_delegate_; |
218 base::TimeDelta timeout_delay_; | 219 base::TimeDelta timeout_delay_; |
219 | 220 |
220 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); | 221 DISALLOW_COPY_AND_ASSIGN(PlatformVerificationFlow); |
221 }; | 222 }; |
222 | 223 |
223 } // namespace attestation | 224 } // namespace attestation |
224 } // namespace chromeos | 225 } // namespace chromeos |
225 | 226 |
226 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ | 227 #endif // CHROME_BROWSER_CHROMEOS_ATTESTATION_PLATFORM_VERIFICATION_FLOW_H_ |
OLD | NEW |