| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/internal/cert_issuer_source_static.h" | 5 #include "net/cert/internal/cert_issuer_source_static.h" |
| 6 | 6 |
| 7 #include "net/cert/internal/parsed_certificate.h" | 7 #include "net/cert/internal/parsed_certificate.h" |
| 8 | 8 |
| 9 namespace net { | 9 namespace net { |
| 10 | 10 |
| 11 CertIssuerSourceStatic::CertIssuerSourceStatic() = default; | 11 CertIssuerSourceStatic::CertIssuerSourceStatic() = default; |
| 12 CertIssuerSourceStatic::~CertIssuerSourceStatic() = default; | 12 CertIssuerSourceStatic::~CertIssuerSourceStatic() = default; |
| 13 | 13 |
| 14 void CertIssuerSourceStatic::AddCert(scoped_refptr<ParsedCertificate> cert) { | 14 void CertIssuerSourceStatic::AddCert(scoped_refptr<ParsedCertificate> cert) { |
| 15 intermediates_.insert(std::make_pair( | 15 intermediates_.insert(std::make_pair( |
| 16 cert->normalized_subject().AsStringPiece(), std::move(cert))); | 16 cert->normalized_subject().AsStringPiece(), std::move(cert))); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void CertIssuerSourceStatic::SyncGetIssuersOf( | 19 void CertIssuerSourceStatic::SyncGetIssuersOf(const ParsedCertificate* cert, |
| 20 const ParsedCertificate* cert, | 20 ParsedCertificateList* issuers) { |
| 21 std::vector<scoped_refptr<ParsedCertificate>>* issuers) { | |
| 22 auto range = | 21 auto range = |
| 23 intermediates_.equal_range(cert->normalized_issuer().AsStringPiece()); | 22 intermediates_.equal_range(cert->normalized_issuer().AsStringPiece()); |
| 24 for (auto it = range.first; it != range.second; ++it) | 23 for (auto it = range.first; it != range.second; ++it) |
| 25 issuers->push_back(it->second); | 24 issuers->push_back(it->second); |
| 26 } | 25 } |
| 27 | 26 |
| 28 void CertIssuerSourceStatic::AsyncGetIssuersOf( | 27 void CertIssuerSourceStatic::AsyncGetIssuersOf( |
| 29 const ParsedCertificate* cert, | 28 const ParsedCertificate* cert, |
| 30 const IssuerCallback& issuers_callback, | 29 const IssuerCallback& issuers_callback, |
| 31 std::unique_ptr<Request>* out_req) { | 30 std::unique_ptr<Request>* out_req) { |
| 32 // CertIssuerSourceStatic never returns asynchronous results. | 31 // CertIssuerSourceStatic never returns asynchronous results. |
| 33 out_req->reset(); | 32 out_req->reset(); |
| 34 } | 33 } |
| 35 | 34 |
| 36 } // namespace net | 35 } // namespace net |
| OLD | NEW |