| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "net/cert/nss_cert_database_chromeos.h" | 5 #include "net/cert/nss_cert_database_chromeos.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <pk11pub.h> | 8 #include <pk11pub.h> |
| 9 | |
| 10 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/task_runner.h" | 15 #include "base/task_runner.h" |
| 16 #include "net/base/crypto_module.h" | 16 #include "net/base/crypto_module.h" |
| 17 #include "net/cert/x509_certificate.h" | 17 #include "net/cert/x509_certificate.h" |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 | 20 |
| 21 NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS( | 21 NSSCertDatabaseChromeOS::NSSCertDatabaseChromeOS( |
| 22 crypto::ScopedPK11Slot public_slot, | 22 crypto::ScopedPK11Slot public_slot, |
| 23 crypto::ScopedPK11Slot private_slot) | 23 crypto::ScopedPK11Slot private_slot) |
| 24 : NSSCertDatabase(public_slot.Pass(), private_slot.Pass()) { | 24 : NSSCertDatabase(std::move(public_slot), std::move(private_slot)) { |
| 25 // By default, don't use a system slot. Only if explicitly set by | 25 // By default, don't use a system slot. Only if explicitly set by |
| 26 // SetSystemSlot, the system slot will be used. | 26 // SetSystemSlot, the system slot will be used. |
| 27 profile_filter_.Init(GetPublicSlot(), | 27 profile_filter_.Init(GetPublicSlot(), |
| 28 GetPrivateSlot(), | 28 GetPrivateSlot(), |
| 29 crypto::ScopedPK11Slot() /* no system slot */); | 29 crypto::ScopedPK11Slot() /* no system slot */); |
| 30 } | 30 } |
| 31 | 31 |
| 32 NSSCertDatabaseChromeOS::~NSSCertDatabaseChromeOS() {} | 32 NSSCertDatabaseChromeOS::~NSSCertDatabaseChromeOS() {} |
| 33 | 33 |
| 34 void NSSCertDatabaseChromeOS::SetSystemSlot( | 34 void NSSCertDatabaseChromeOS::SetSystemSlot( |
| 35 crypto::ScopedPK11Slot system_slot) { | 35 crypto::ScopedPK11Slot system_slot) { |
| 36 system_slot_ = system_slot.Pass(); | 36 system_slot_ = std::move(system_slot); |
| 37 profile_filter_.Init(GetPublicSlot(), GetPrivateSlot(), GetSystemSlot()); | 37 profile_filter_.Init(GetPublicSlot(), GetPrivateSlot(), GetSystemSlot()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 void NSSCertDatabaseChromeOS::ListCertsSync(CertificateList* certs) { | 40 void NSSCertDatabaseChromeOS::ListCertsSync(CertificateList* certs) { |
| 41 ListCertsImpl(profile_filter_, certs); | 41 ListCertsImpl(profile_filter_, certs); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void NSSCertDatabaseChromeOS::ListCerts( | 44 void NSSCertDatabaseChromeOS::ListCerts( |
| 45 const NSSCertDatabase::ListCertsCallback& callback) { | 45 const NSSCertDatabase::ListCertsCallback& callback) { |
| 46 scoped_ptr<CertificateList> certs(new CertificateList()); | 46 scoped_ptr<CertificateList> certs(new CertificateList()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 certs->begin(), | 87 certs->begin(), |
| 88 certs->end(), | 88 certs->end(), |
| 89 NSSProfileFilterChromeOS::CertNotAllowedForProfilePredicate( | 89 NSSProfileFilterChromeOS::CertNotAllowedForProfilePredicate( |
| 90 profile_filter)), | 90 profile_filter)), |
| 91 certs->end()); | 91 certs->end()); |
| 92 DVLOG(1) << "filtered " << pre_size - certs->size() << " of " << pre_size | 92 DVLOG(1) << "filtered " << pre_size - certs->size() << " of " << pre_size |
| 93 << " certs"; | 93 << " certs"; |
| 94 } | 94 } |
| 95 | 95 |
| 96 } // namespace net | 96 } // namespace net |
| OLD | NEW |