OLD | NEW |
---|---|
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 CHROMEOS_CERT_LOADER_H_ | 5 #ifndef CHROMEOS_CERT_LOADER_H_ |
6 #define CHROMEOS_CERT_LOADER_H_ | 6 #define CHROMEOS_CERT_LOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 bool CertificatesLoading() const; | 93 bool CertificatesLoading() const; |
94 | 94 |
95 // Returns true if the TPM is available for hardware-backed certificates. | 95 // Returns true if the TPM is available for hardware-backed certificates. |
96 bool IsHardwareBacked() const; | 96 bool IsHardwareBacked() const; |
97 | 97 |
98 bool certificates_loaded() const { return certificates_loaded_; } | 98 bool certificates_loaded() const { return certificates_loaded_; } |
99 | 99 |
100 // TPM info is only valid once the TPM is available (IsHardwareBacked is | 100 // TPM info is only valid once the TPM is available (IsHardwareBacked is |
101 // true). Otherwise empty strings will be returned. | 101 // true). Otherwise empty strings will be returned. |
102 const std::string& tpm_token_name() const { return tpm_token_name_; } | 102 const std::string& tpm_token_name() const { return tpm_token_name_; } |
103 const std::string& tpm_token_slot() const { return tpm_token_slot_; } | 103 int tpm_token_slot() const { return tpm_token_slot_; } |
wtc
2013/10/25 18:06:27
Can we use unsigned long?
I suggest renaming the
mattm
2013/10/25 18:41:37
I just asked Darren about this. I'll file a bug f
| |
104 const std::string& tpm_user_pin() const { return tpm_user_pin_; } | 104 const std::string& tpm_user_pin() const { return tpm_user_pin_; } |
105 | 105 |
106 // This will be empty until certificates_loaded() is true. | 106 // This will be empty until certificates_loaded() is true. |
107 const net::CertificateList& cert_list() const { return cert_list_; } | 107 const net::CertificateList& cert_list() const { return cert_list_; } |
108 | 108 |
109 private: | 109 private: |
110 CertLoader(); | 110 CertLoader(); |
111 virtual ~CertLoader(); | 111 virtual ~CertLoader(); |
112 | 112 |
113 void MaybeRequestCertificates(); | 113 void MaybeRequestCertificates(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 TPM_TOKEN_INITIALIZED, | 171 TPM_TOKEN_INITIALIZED, |
172 }; | 172 }; |
173 TPMTokenState tpm_token_state_; | 173 TPMTokenState tpm_token_state_; |
174 | 174 |
175 // The current request delay before the next attempt to initialize the | 175 // The current request delay before the next attempt to initialize the |
176 // TPM. Will be adapted after each attempt. | 176 // TPM. Will be adapted after each attempt. |
177 base::TimeDelta tpm_request_delay_; | 177 base::TimeDelta tpm_request_delay_; |
178 | 178 |
179 // Cached TPM token info. | 179 // Cached TPM token info. |
180 std::string tpm_token_name_; | 180 std::string tpm_token_name_; |
181 std::string tpm_token_slot_; | 181 int tpm_token_slot_; |
182 std::string tpm_user_pin_; | 182 std::string tpm_user_pin_; |
183 | 183 |
184 // Cached Certificates. | 184 // Cached Certificates. |
185 net::CertificateList cert_list_; | 185 net::CertificateList cert_list_; |
186 | 186 |
187 base::ThreadChecker thread_checker_; | 187 base::ThreadChecker thread_checker_; |
188 | 188 |
189 // TaskRunner for crypto calls. | 189 // TaskRunner for crypto calls. |
190 scoped_refptr<base::SequencedTaskRunner> crypto_task_runner_; | 190 scoped_refptr<base::SequencedTaskRunner> crypto_task_runner_; |
191 | 191 |
192 // TaskRunner for other slow tasks. May be set in tests. | 192 // TaskRunner for other slow tasks. May be set in tests. |
193 scoped_refptr<base::TaskRunner> slow_task_runner_for_test_; | 193 scoped_refptr<base::TaskRunner> slow_task_runner_for_test_; |
194 | 194 |
195 // This factory should be used only for callbacks during TPMToken | 195 // This factory should be used only for callbacks during TPMToken |
196 // initialization. | 196 // initialization. |
197 base::WeakPtrFactory<CertLoader> initialize_token_factory_; | 197 base::WeakPtrFactory<CertLoader> initialize_token_factory_; |
198 | 198 |
199 // This factory should be used only for callbacks during updating the | 199 // This factory should be used only for callbacks during updating the |
200 // certificate list. | 200 // certificate list. |
201 base::WeakPtrFactory<CertLoader> update_certificates_factory_; | 201 base::WeakPtrFactory<CertLoader> update_certificates_factory_; |
202 | 202 |
203 DISALLOW_COPY_AND_ASSIGN(CertLoader); | 203 DISALLOW_COPY_AND_ASSIGN(CertLoader); |
204 }; | 204 }; |
205 | 205 |
206 } // namespace chromeos | 206 } // namespace chromeos |
207 | 207 |
208 #endif // CHROMEOS_CERT_LOADER_H_ | 208 #endif // CHROMEOS_CERT_LOADER_H_ |
OLD | NEW |