OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ | 5 #ifndef CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ |
6 #define CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ | 6 #define CHROMEOS_ATTESTATION_ATTESTATION_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_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
13 #include "chromeos/chromeos_export.h" | 14 #include "chromeos/chromeos_export.h" |
14 #include "chromeos/dbus/dbus_method_call_status.h" | 15 #include "chromeos/dbus/dbus_method_call_status.h" |
15 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
16 | 17 |
17 namespace cryptohome { | 18 namespace cryptohome { |
18 | 19 |
19 class AsyncMethodCaller; | 20 class AsyncMethodCaller; |
20 | 21 |
21 } // namespace cryptohome | 22 } // namespace cryptohome |
(...skipping 25 matching lines...) Expand all Loading... |
47 // CertificateCallback callback = base::Bind(&MyCallback); | 48 // CertificateCallback callback = base::Bind(&MyCallback); |
48 // flow.GetCertificate("attest-ent-machine", callback); | 49 // flow.GetCertificate("attest-ent-machine", callback); |
49 class CHROMEOS_EXPORT AttestationFlow { | 50 class CHROMEOS_EXPORT AttestationFlow { |
50 public: | 51 public: |
51 typedef base::Callback<void(bool success, | 52 typedef base::Callback<void(bool success, |
52 const std::string& pem_certificate_chain)> | 53 const std::string& pem_certificate_chain)> |
53 CertificateCallback; | 54 CertificateCallback; |
54 | 55 |
55 AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, | 56 AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, |
56 CryptohomeClient* cryptohome_client, | 57 CryptohomeClient* cryptohome_client, |
57 ServerProxy* server_proxy); | 58 scoped_ptr<ServerProxy> server_proxy); |
58 virtual ~AttestationFlow(); | 59 virtual ~AttestationFlow(); |
59 | 60 |
60 // Asynchronously gets an attestation certificate bound to the given name. | 61 // Asynchronously gets an attestation certificate bound to the given name. |
61 // If no certificate has been associated with the name, a new certificate is | 62 // If no certificate has been associated with the name, a new certificate is |
62 // issued. | 63 // issued. |
63 // | 64 // |
64 // Parameters | 65 // Parameters |
65 // name - The name of the key for which to retrieve a certificate. The | 66 // name - The name of the key for which to retrieve a certificate. The |
66 // following key names are available: | 67 // following key names are available: |
67 // "attest-ent-machine" - The enterprise machine key. | 68 // "attest-ent-machine" - The enterprise machine key. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // success - The status of the Privacy CA operation. | 159 // success - The status of the Privacy CA operation. |
159 // data - The response data from the Privacy CA. | 160 // data - The response data from the Privacy CA. |
160 void SendCertificateResponseToDaemon(const std::string& name, | 161 void SendCertificateResponseToDaemon(const std::string& name, |
161 const CertificateCallback& callback, | 162 const CertificateCallback& callback, |
162 bool success, | 163 bool success, |
163 const std::string& data); | 164 const std::string& data); |
164 | 165 |
165 base::WeakPtrFactory<AttestationFlow> weak_factory_; | 166 base::WeakPtrFactory<AttestationFlow> weak_factory_; |
166 cryptohome::AsyncMethodCaller* async_caller_; | 167 cryptohome::AsyncMethodCaller* async_caller_; |
167 CryptohomeClient* cryptohome_client_; | 168 CryptohomeClient* cryptohome_client_; |
168 ServerProxy* server_proxy_; | 169 scoped_ptr<ServerProxy> server_proxy_; |
169 | 170 |
170 DISALLOW_COPY_AND_ASSIGN(AttestationFlow); | 171 DISALLOW_COPY_AND_ASSIGN(AttestationFlow); |
171 }; | 172 }; |
172 | 173 |
173 } // namespace attestation | 174 } // namespace attestation |
174 } // namespace chromeos | 175 } // namespace chromeos |
175 | 176 |
176 #endif // CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ | 177 #endif // CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ |
OLD | NEW |