| 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> |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 CERTCertListNode* node; | 415 CERTCertListNode* node; |
| 416 for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list); | 416 for (node = CERT_LIST_HEAD(cert_list); !CERT_LIST_END(node, cert_list); |
| 417 node = CERT_LIST_NEXT(node)) { | 417 node = CERT_LIST_NEXT(node)) { |
| 418 certs->push_back(X509Certificate::CreateFromHandle( | 418 certs->push_back(X509Certificate::CreateFromHandle( |
| 419 node->cert, X509Certificate::OSCertHandles())); | 419 node->cert, X509Certificate::OSCertHandles())); |
| 420 } | 420 } |
| 421 CERT_DestroyCertList(cert_list); | 421 CERT_DestroyCertList(cert_list); |
| 422 } | 422 } |
| 423 | 423 |
| 424 scoped_refptr<base::TaskRunner> NSSCertDatabase::GetSlowTaskRunner() const { | 424 scoped_refptr<base::TaskRunner> NSSCertDatabase::GetSlowTaskRunner() const { |
| 425 if (slow_task_runner_for_test_) | 425 if (slow_task_runner_for_test_.get()) |
| 426 return slow_task_runner_for_test_; | 426 return slow_task_runner_for_test_; |
| 427 return base::WorkerPool::GetTaskRunner(true /*task is slow*/); | 427 return base::WorkerPool::GetTaskRunner(true /*task is slow*/); |
| 428 } | 428 } |
| 429 | 429 |
| 430 void NSSCertDatabase::NotifyCertRemovalAndCallBack( | 430 void NSSCertDatabase::NotifyCertRemovalAndCallBack( |
| 431 scoped_refptr<X509Certificate> cert, | 431 scoped_refptr<X509Certificate> cert, |
| 432 const DeleteCertCallback& callback, | 432 const DeleteCertCallback& callback, |
| 433 bool success) { | 433 bool success) { |
| 434 if (success) | 434 if (success) |
| 435 NotifyObserversOfCertRemoved(cert); | 435 NotifyObserversOfCertRemoved(cert.get()); |
| 436 callback.Run(success); | 436 callback.Run(success); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void NSSCertDatabase::NotifyObserversOfCertAdded(const X509Certificate* cert) { | 439 void NSSCertDatabase::NotifyObserversOfCertAdded(const X509Certificate* cert) { |
| 440 observer_list_->Notify(&Observer::OnCertAdded, make_scoped_refptr(cert)); | 440 observer_list_->Notify(&Observer::OnCertAdded, make_scoped_refptr(cert)); |
| 441 } | 441 } |
| 442 | 442 |
| 443 void NSSCertDatabase::NotifyObserversOfCertRemoved( | 443 void NSSCertDatabase::NotifyObserversOfCertRemoved( |
| 444 const X509Certificate* cert) { | 444 const X509Certificate* cert) { |
| 445 observer_list_->Notify(&Observer::OnCertRemoved, make_scoped_refptr(cert)); | 445 observer_list_->Notify(&Observer::OnCertRemoved, make_scoped_refptr(cert)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 469 } else { | 469 } else { |
| 470 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { | 470 if (SEC_DeletePermCertificate(cert->os_cert_handle())) { |
| 471 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); | 471 LOG(ERROR) << "SEC_DeletePermCertificate failed: " << PORT_GetError(); |
| 472 return false; | 472 return false; |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 return true; | 475 return true; |
| 476 } | 476 } |
| 477 | 477 |
| 478 } // namespace net | 478 } // namespace net |
| OLD | NEW |