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 #ifndef NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ | 5 #ifndef NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ |
6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ | 6 #define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ |
7 | 7 |
8 #include <unordered_map> | 8 #include <unordered_map> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 #include "net/cert/internal/cert_issuer_source.h" | 11 #include "net/cert/internal/cert_issuer_source.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 // Synchronously returns issuers from a pre-supplied set. | 15 // Synchronously returns issuers from a pre-supplied set. |
16 class NET_EXPORT CertIssuerSourceStatic : public CertIssuerSource { | 16 class NET_EXPORT CertIssuerSourceStatic : public CertIssuerSource { |
17 public: | 17 public: |
18 CertIssuerSourceStatic(); | 18 CertIssuerSourceStatic(); |
19 ~CertIssuerSourceStatic() override; | 19 ~CertIssuerSourceStatic() override; |
20 | 20 |
21 // Adds |cert| to the set of certificates that this CertIssuerSource will | 21 // Adds |cert| to the set of certificates that this CertIssuerSource will |
22 // provide. | 22 // provide. |
23 void AddCert(scoped_refptr<ParsedCertificate> cert); | 23 void AddCert(scoped_refptr<ParsedCertificate> cert); |
24 | 24 |
25 // CertIssuerSource implementation: | 25 // CertIssuerSource implementation: |
26 void SyncGetIssuersOf( | 26 void SyncGetIssuersOf(const ParsedCertificate* cert, |
27 const ParsedCertificate* cert, | 27 ParsedCertificateList* issuers) override; |
28 std::vector<scoped_refptr<ParsedCertificate>>* issuers) override; | |
29 void AsyncGetIssuersOf(const ParsedCertificate* cert, | 28 void AsyncGetIssuersOf(const ParsedCertificate* cert, |
30 const IssuerCallback& issuers_callback, | 29 const IssuerCallback& issuers_callback, |
31 std::unique_ptr<Request>* out_req) override; | 30 std::unique_ptr<Request>* out_req) override; |
32 | 31 |
33 private: | 32 private: |
34 // The certificates that the CertIssuerSourceStatic can return, keyed on the | 33 // The certificates that the CertIssuerSourceStatic can return, keyed on the |
35 // normalized subject value. | 34 // normalized subject value. |
36 std::unordered_multimap<base::StringPiece, | 35 std::unordered_multimap<base::StringPiece, |
37 scoped_refptr<ParsedCertificate>, | 36 scoped_refptr<ParsedCertificate>, |
38 base::StringPieceHash> | 37 base::StringPieceHash> |
39 intermediates_; | 38 intermediates_; |
40 | 39 |
41 DISALLOW_COPY_AND_ASSIGN(CertIssuerSourceStatic); | 40 DISALLOW_COPY_AND_ASSIGN(CertIssuerSourceStatic); |
42 }; | 41 }; |
43 | 42 |
44 } // namespace net | 43 } // namespace net |
45 | 44 |
46 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ | 45 #endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_ |
OLD | NEW |