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 23 matching lines...) Expand all Loading... | |
45 // DBusThreadManager::Get().GetCryptohomeClient(), | 46 // DBusThreadManager::Get().GetCryptohomeClient(), |
46 // my_server_proxy); | 47 // my_server_proxy); |
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 |
56 // This class takes ownership only of |server_proxy|. | |
Mattias Nissler (ping if slow)
2013/04/02 12:49:39
nit: Comment is redundant given that you declare a
dkrahn
2013/04/04 21:27:27
Done.
| |
55 AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, | 57 AttestationFlow(cryptohome::AsyncMethodCaller* async_caller, |
56 CryptohomeClient* cryptohome_client, | 58 CryptohomeClient* cryptohome_client, |
57 ServerProxy* server_proxy); | 59 scoped_ptr<ServerProxy> server_proxy); |
58 virtual ~AttestationFlow(); | 60 virtual ~AttestationFlow(); |
59 | 61 |
60 // Asynchronously gets an attestation certificate bound to the given name. | 62 // Asynchronously gets an attestation certificate bound to the given name. |
61 // If no certificate has been associated with the name, a new certificate is | 63 // If no certificate has been associated with the name, a new certificate is |
62 // issued. | 64 // issued. |
63 // | 65 // |
64 // Parameters | 66 // Parameters |
65 // name - The name of the key for which to retrieve a certificate. The | 67 // name - The name of the key for which to retrieve a certificate. The |
66 // following key names are available: | 68 // following key names are available: |
67 // "attest-ent-machine" - The enterprise machine key. | 69 // "attest-ent-machine" - The enterprise machine key. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 // callback - Called when the operation completes. | 156 // callback - Called when the operation completes. |
155 // success - The status of the Privacy CA operation. | 157 // success - The status of the Privacy CA operation. |
156 // data - The response data from the Privacy CA. | 158 // data - The response data from the Privacy CA. |
157 void SendCertificateResponseToDaemon(const CertificateCallback& callback, | 159 void SendCertificateResponseToDaemon(const CertificateCallback& callback, |
158 bool success, | 160 bool success, |
159 const std::string& data); | 161 const std::string& data); |
160 | 162 |
161 base::WeakPtrFactory<AttestationFlow> weak_factory_; | 163 base::WeakPtrFactory<AttestationFlow> weak_factory_; |
162 cryptohome::AsyncMethodCaller* async_caller_; | 164 cryptohome::AsyncMethodCaller* async_caller_; |
163 CryptohomeClient* cryptohome_client_; | 165 CryptohomeClient* cryptohome_client_; |
164 ServerProxy* server_proxy_; | 166 scoped_ptr<ServerProxy> server_proxy_; |
165 | 167 |
166 DISALLOW_COPY_AND_ASSIGN(AttestationFlow); | 168 DISALLOW_COPY_AND_ASSIGN(AttestationFlow); |
167 }; | 169 }; |
168 | 170 |
169 } // namespace attestation | 171 } // namespace attestation |
170 } // namespace chromeos | 172 } // namespace chromeos |
171 | 173 |
172 #endif // CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ | 174 #endif // CHROMEOS_ATTESTATION_ATTESTATION_FLOW_H_ |
OLD | NEW |