| 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 #include "net/cert/nss_cert_database.h" | 5 #include "net/cert/nss_cert_database.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <certdb.h> | 8 #include <certdb.h> |
| 9 #include <keyhi.h> | 9 #include <keyhi.h> |
| 10 #include <pk11pub.h> | 10 #include <pk11pub.h> |
| 11 #include <secmod.h> | 11 #include <secmod.h> |
| 12 #include <utility> |
| 12 | 13 |
| 13 #include "base/bind.h" | 14 #include "base/bind.h" |
| 14 #include "base/callback.h" | 15 #include "base/callback.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/macros.h" | 17 #include "base/macros.h" |
| 17 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 18 #include "base/observer_list_threadsafe.h" | 19 #include "base/observer_list_threadsafe.h" |
| 19 #include "base/task_runner.h" | 20 #include "base/task_runner.h" |
| 20 #include "base/task_runner_util.h" | 21 #include "base/task_runner_util.h" |
| 21 #include "base/threading/worker_pool.h" | 22 #include "base/threading/worker_pool.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 NSSCertDatabase::ImportCertFailure::ImportCertFailure( | 76 NSSCertDatabase::ImportCertFailure::ImportCertFailure( |
| 76 const scoped_refptr<X509Certificate>& cert, | 77 const scoped_refptr<X509Certificate>& cert, |
| 77 int err) | 78 int err) |
| 78 : certificate(cert), net_error(err) {} | 79 : certificate(cert), net_error(err) {} |
| 79 | 80 |
| 80 NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {} | 81 NSSCertDatabase::ImportCertFailure::~ImportCertFailure() {} |
| 81 | 82 |
| 82 NSSCertDatabase::NSSCertDatabase(crypto::ScopedPK11Slot public_slot, | 83 NSSCertDatabase::NSSCertDatabase(crypto::ScopedPK11Slot public_slot, |
| 83 crypto::ScopedPK11Slot private_slot) | 84 crypto::ScopedPK11Slot private_slot) |
| 84 : public_slot_(public_slot.Pass()), | 85 : public_slot_(std::move(public_slot)), |
| 85 private_slot_(private_slot.Pass()), | 86 private_slot_(std::move(private_slot)), |
| 86 observer_list_(new base::ObserverListThreadSafe<Observer>), | 87 observer_list_(new base::ObserverListThreadSafe<Observer>), |
| 87 weak_factory_(this) { | 88 weak_factory_(this) { |
| 88 CHECK(public_slot_); | 89 CHECK(public_slot_); |
| 89 | 90 |
| 90 // This also makes sure that NSS has been initialized. | 91 // This also makes sure that NSS has been initialized. |
| 91 CertDatabase* cert_db = CertDatabase::GetInstance(); | 92 CertDatabase* cert_db = CertDatabase::GetInstance(); |
| 92 cert_notification_forwarder_.reset(new CertNotificationForwarder(cert_db)); | 93 cert_notification_forwarder_.reset(new CertNotificationForwarder(cert_db)); |
| 93 AddObserver(cert_notification_forwarder_.get()); | 94 AddObserver(cert_notification_forwarder_.get()); |
| 94 | 95 |
| 95 psm::EnsurePKCS12Init(); | 96 psm::EnsurePKCS12Init(); |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 } else { | 485 } else { |
| 485 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { | 486 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { |
| 486 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); | 487 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); |
| 487 return false; | 488 return false; |
| 488 } | 489 } |
| 489 } | 490 } |
| 490 return true; | 491 return true; |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace net | 494 } // namespace net |
| OLD | NEW |