Index: net/cert/internal/trust_store_collection.h |
diff --git a/net/cert/internal/trust_store_collection.h b/net/cert/internal/trust_store_collection.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..c9b4a5075fb39fd2226e41793dddeefe72acb358 |
--- /dev/null |
+++ b/net/cert/internal/trust_store_collection.h |
@@ -0,0 +1,56 @@ |
+// 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_TRUST_STORE_COLLECTION_H_ |
+#define NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_ |
+ |
+#include <vector> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "net/base/net_export.h" |
+#include "net/cert/internal/cert_issuer_source_collection.h" |
+#include "net/cert/internal/trust_store.h" |
+ |
+namespace net { |
+ |
+// Returns results from a collection of other TrustStores. |
+// |
+// If any of the trust stores returns a trusted value for a cert, it will be |
+// passed on to the caller immediately without waiting for the other trust |
+// stores in the collection to return a result. |
+class NET_EXPORT TrustStoreCollection : public TrustStore { |
+ public: |
+ TrustStoreCollection(); |
+ ~TrustStoreCollection() override; |
+ |
+ // Adds |store| to the list of TrustStores. The |store| must be valid for the |
+ // lifetime of the TrustStoreCollection. |
+ void AddStore(TrustStore* store); |
+ |
+ // TrustStore implementation: |
+ void IsTrustedCertificate( |
+ scoped_refptr<ParsedCertificate> cert, |
+ const TrustCallback& callback, |
+ bool* out_trusted, |
+ std::unique_ptr<TrustStore::Request>* out_req) const override; |
+ |
+ // CertIssuerSource implementation: |
+ void SyncGetIssuersOf(const ParsedCertificate* cert, |
+ ParsedCertificateList* issuers) override; |
+ void AsyncGetIssuersOf( |
+ scoped_refptr<ParsedCertificate> cert, |
+ const IssuerCallback& callback, |
+ std::unique_ptr<CertIssuerSource::Request>* out_req) override; |
+ |
+ private: |
+ std::vector<TrustStore*> stores_; |
+ |
+ CertIssuerSourceCollection cert_sources_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(TrustStoreCollection); |
+}; |
+ |
+} // namespace net |
+ |
+#endif // NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_ |