Index: net/cert/internal/cert_source_static.h |
diff --git a/net/cert/internal/cert_source_static.h b/net/cert/internal/cert_source_static.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..9d3fe56cf65abe5bcb7e2ced44d1987e056ec915 |
--- /dev/null |
+++ b/net/cert/internal/cert_source_static.h |
@@ -0,0 +1,45 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_ |
+#define NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_ |
+ |
+#include <unordered_map> |
+ |
+#include "base/strings/string_piece.h" |
+#include "net/cert/internal/cert_source.h" |
+ |
+namespace net { |
+ |
+// Synchronously returns issuers from a pre-supplied set. |
+class NET_EXPORT CertSourceStatic : public CertSource { |
+ public: |
+ CertSourceStatic(); |
+ ~CertSourceStatic() override; |
+ |
+ // Adds |cert| to the set of certificates that this CertSource will provide. |
+ void AddCert(scoped_refptr<ParsedCertificate> cert); |
+ |
+ // CertSource implementation: |
+ void SyncGetIssuersOf( |
+ const ParsedCertificate* cert, |
+ std::vector<scoped_refptr<ParsedCertificate>>* issuers) override; |
+ void AsyncGetIssuersOf(const ParsedCertificate* cert, |
+ const IssuerCallback& issuers_callback, |
+ std::unique_ptr<Request>* out_req) override; |
+ |
+ private: |
+ // The certificates that the CertSourceStatic can return, keyed on the |
+ // normalized subject value. |
+ std::unordered_multimap<base::StringPiece, |
+ scoped_refptr<ParsedCertificate>, |
+ base::StringPieceHash> |
+ intermediates_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(CertSourceStatic); |
+}; |
+ |
+} // namespace net |
+ |
+#endif // NET_CERT_INTERNAL_CERT_SOURCE_STATIC_H_ |