Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(907)

Unified Diff: net/cert/internal/cert_issuer_source_static.h

Issue 2030693002: Add CertIssuerSource interface and CertIssuerSourceStatic implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cert-parsing-base
Patch Set: renamed Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/cert/internal/cert_issuer_source_static.h
diff --git a/net/cert/internal/cert_issuer_source_static.h b/net/cert/internal/cert_issuer_source_static.h
new file mode 100644
index 0000000000000000000000000000000000000000..af67268c2aa1624e7b63ca85ee11f5fa1cab0cc0
--- /dev/null
+++ b/net/cert/internal/cert_issuer_source_static.h
@@ -0,0 +1,46 @@
+// 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_ISSUER_SOURCE_STATIC_H_
+#define NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_
+
+#include <unordered_map>
+
+#include "base/strings/string_piece.h"
+#include "net/cert/internal/cert_issuer_source.h"
+
+namespace net {
+
+// Synchronously returns issuers from a pre-supplied set.
+class NET_EXPORT CertIssuerSourceStatic : public CertIssuerSource {
+ public:
+ CertIssuerSourceStatic();
+ ~CertIssuerSourceStatic() override;
+
+ // Adds |cert| to the set of certificates that this CertIssuerSource will
+ // provide.
+ void AddCert(scoped_refptr<ParsedCertificate> cert);
+
+ // CertIssuerSource 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 CertIssuerSourceStatic can return, keyed on the
+ // normalized subject value.
+ std::unordered_multimap<base::StringPiece,
+ scoped_refptr<ParsedCertificate>,
+ base::StringPieceHash>
+ intermediates_;
+
+ DISALLOW_COPY_AND_ASSIGN(CertIssuerSourceStatic);
+};
+
+} // namespace net
+
+#endif // NET_CERT_INTERNAL_CERT_ISSUER_SOURCE_STATIC_H_

Powered by Google App Engine
This is Rietveld 408576698