| 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 "chrome/browser/chromeos/net/client_cert_store_chromeos.h" | 5 #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h" |
| 6 | 6 |
| 7 #include <cert.h> | 7 #include <cert.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 net::CertificateList* selected_certs, | 75 net::CertificateList* selected_certs, |
| 76 const base::Closure& callback, | 76 const base::Closure& callback, |
| 77 const net::CertificateList& additional_certs) { | 77 const net::CertificateList& additional_certs) { |
| 78 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 78 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
| 79 password_delegate; | 79 password_delegate; |
| 80 if (!password_delegate_factory_.is_null()) { | 80 if (!password_delegate_factory_.is_null()) { |
| 81 password_delegate.reset( | 81 password_delegate.reset( |
| 82 password_delegate_factory_.Run(request->host_and_port)); | 82 password_delegate_factory_.Run(request->host_and_port)); |
| 83 } | 83 } |
| 84 base::PostTaskWithTraitsAndReply( | 84 base::PostTaskWithTraitsAndReply( |
| 85 FROM_HERE, | 85 FROM_HERE, base::TaskTraits().MayBlock().WithShutdownBehavior( |
| 86 base::TaskTraits().WithWait().WithFileIO().WithShutdownBehavior( | 86 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), |
| 87 base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN), | |
| 88 base::Bind(&ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread, | 87 base::Bind(&ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread, |
| 89 base::Unretained(this), base::Passed(&password_delegate), | 88 base::Unretained(this), base::Passed(&password_delegate), |
| 90 request, additional_certs, selected_certs), | 89 request, additional_certs, selected_certs), |
| 91 callback); | 90 callback); |
| 92 } | 91 } |
| 93 | 92 |
| 94 void ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread( | 93 void ClientCertStoreChromeOS::GetAndFilterCertsOnWorkerThread( |
| 95 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> | 94 std::unique_ptr<crypto::CryptoModuleBlockingPasswordDelegate> |
| 96 password_delegate, | 95 password_delegate, |
| 97 const net::SSLCertRequestInfo* request, | 96 const net::SSLCertRequestInfo* request, |
| 98 const net::CertificateList& additional_certs, | 97 const net::CertificateList& additional_certs, |
| 99 net::CertificateList* selected_certs) { | 98 net::CertificateList* selected_certs) { |
| 100 net::CertificateList unfiltered_certs; | 99 net::CertificateList unfiltered_certs; |
| 101 net::ClientCertStoreNSS::GetPlatformCertsOnWorkerThread( | 100 net::ClientCertStoreNSS::GetPlatformCertsOnWorkerThread( |
| 102 std::move(password_delegate), &unfiltered_certs); | 101 std::move(password_delegate), &unfiltered_certs); |
| 103 | 102 |
| 104 unfiltered_certs.erase( | 103 unfiltered_certs.erase( |
| 105 std::remove_if(unfiltered_certs.begin(), unfiltered_certs.end(), | 104 std::remove_if(unfiltered_certs.begin(), unfiltered_certs.end(), |
| 106 CertNotAllowedPredicate(cert_filter_.get())), | 105 CertNotAllowedPredicate(cert_filter_.get())), |
| 107 unfiltered_certs.end()); | 106 unfiltered_certs.end()); |
| 108 | 107 |
| 109 unfiltered_certs.insert(unfiltered_certs.end(), additional_certs.begin(), | 108 unfiltered_certs.insert(unfiltered_certs.end(), additional_certs.begin(), |
| 110 additional_certs.end()); | 109 additional_certs.end()); |
| 111 | 110 |
| 112 net::ClientCertStoreNSS::FilterCertsOnWorkerThread(unfiltered_certs, *request, | 111 net::ClientCertStoreNSS::FilterCertsOnWorkerThread(unfiltered_certs, *request, |
| 113 selected_certs); | 112 selected_certs); |
| 114 } | 113 } |
| 115 | 114 |
| 116 } // namespace chromeos | 115 } // namespace chromeos |
| OLD | NEW |