| Index: net/cert/nss_cert_database.cc
|
| diff --git a/net/cert/nss_cert_database.cc b/net/cert/nss_cert_database.cc
|
| index ed861b200bfeb207ee1fa6ff2fe75a9a72bb429c..7502816f6c55f2fbb854737591b185150c36f803 100644
|
| --- a/net/cert/nss_cert_database.cc
|
| +++ b/net/cert/nss_cert_database.cc
|
| @@ -82,7 +82,7 @@ void NSSCertDatabase::ListCerts(
|
| const base::Callback<void(scoped_ptr<CertificateList> certs)>& callback) {
|
| scoped_ptr<CertificateList> certs(new CertificateList());
|
|
|
| - // base::Pased will NULL out |certs|, so cache the underlying pointer here.
|
| + // base::Passed will NULL out |certs|, so cache the underlying pointer here.
|
| CertificateList* raw_certs = certs.get();
|
| GetSlowTaskRunner()->PostTaskAndReply(
|
| FROM_HERE,
|
| @@ -91,6 +91,20 @@ void NSSCertDatabase::ListCerts(
|
| base::Bind(callback, base::Passed(&certs)));
|
| }
|
|
|
| +void NSSCertDatabase::ListCertsInSlot(const ListCertsCallback& callback,
|
| + PK11SlotInfo* slot) {
|
| + scoped_ptr<CertificateList> certs(new CertificateList());
|
| +
|
| + // base::Passed will NULL out |certs|, so cache the underlying pointer here.
|
| + CertificateList* raw_certs = certs.get();
|
| + GetSlowTaskRunner()->PostTaskAndReply(
|
| + FROM_HERE,
|
| + base::Bind(&NSSCertDatabase::ListCertsInSlotImpl,
|
| + base::Passed(crypto::ScopedPK11Slot(PK11_ReferenceSlot(slot))),
|
| + base::Unretained(raw_certs)),
|
| + base::Bind(callback, base::Passed(&certs)));
|
| +}
|
| +
|
| crypto::ScopedPK11Slot NSSCertDatabase::GetPublicSlot() const {
|
| return crypto::ScopedPK11Slot(crypto::GetPublicNSSKeySlot());
|
| }
|
| @@ -362,6 +376,20 @@ void NSSCertDatabase::SetSlowTaskRunnerForTest(
|
| }
|
|
|
| // static
|
| +void NSSCertDatabase::ListCertsInSlotImpl(crypto::ScopedPK11Slot slot,
|
| + CertificateList* certs) {
|
| + CERTCertList* cert_list = PK11_ListCertsInSlot(slot.get());
|
| + CERTCertListNode* node;
|
| + for (node = CERT_LIST_HEAD(cert_list);
|
| + !CERT_LIST_END(node, cert_list);
|
| + node = CERT_LIST_NEXT(node)) {
|
| + certs->push_back(X509Certificate::CreateFromHandle(
|
| + node->cert, X509Certificate::OSCertHandles()));
|
| + }
|
| + CERT_DestroyCertList(cert_list);
|
| +}
|
| +
|
| +// static
|
| void NSSCertDatabase::ListCertsImpl(CertificateList* certs) {
|
| certs->clear();
|
|
|
|
|