Chromium Code Reviews| Index: content/browser/cert_store_impl.cc |
| diff --git a/content/browser/cert_store_impl.cc b/content/browser/cert_store_impl.cc |
| index cc0d880ecfcb4014b174b66b92e028f708cc257d..f33275d39e2bc71f4f5eb0c2eead0bfac0b4b0e8 100644 |
| --- a/content/browser/cert_store_impl.cc |
| +++ b/content/browser/cert_store_impl.cc |
| @@ -20,13 +20,33 @@ CertStoreImpl::CertStoreImpl() {} |
| CertStoreImpl::~CertStoreImpl() {} |
| +CertStoreImpl::HashAndCert::HashAndCert() = default; |
| + |
| +bool CertStoreImpl::HashAndCert::LessThan::operator()( |
| + const scoped_refptr<HashAndCert>& lhs, |
| + const scoped_refptr<HashAndCert>& rhs) const { |
| + return net::SHA256HashValueLessThan()(lhs->chain_hash, rhs->chain_hash); |
| +} |
| + |
| +CertStoreImpl::HashAndCert::~HashAndCert() = default; |
| + |
| int CertStoreImpl::StoreCert(net::X509Certificate* cert, int process_id) { |
| - return store_.Store(cert, process_id); |
| + scoped_refptr<HashAndCert> hash_and_cert(new HashAndCert); |
| + hash_and_cert->chain_hash = |
|
eroman
2016/06/09 22:18:25
I would say make HashAndCert's ctor take |cert| an
Ryan Sleevi
2016/06/09 22:59:36
That doesn't meaningfully work, because std::map r
|
| + net::X509Certificate::CalculateChainFingerprint256( |
| + cert->os_cert_handle(), cert->GetIntermediateCertificates()); |
| + hash_and_cert->cert = cert; |
| + return store_.Store(hash_and_cert.get(), process_id); |
| } |
| bool CertStoreImpl::RetrieveCert(int cert_id, |
| scoped_refptr<net::X509Certificate>* cert) { |
| - return store_.Retrieve(cert_id, cert); |
| + scoped_refptr<HashAndCert> hash_and_cert; |
| + if (store_.Retrieve(cert_id, &hash_and_cert)) { |
| + *cert = hash_and_cert->cert; |
| + return true; |
| + } |
| + return false; |
| } |
| } // namespace content |