OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_ |
| 6 #define NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "net/base/net_export.h" |
| 10 #include "net/cert/internal/trust_store.h" |
| 11 |
| 12 namespace base { |
| 13 class TaskRunner; |
| 14 } |
| 15 |
| 16 namespace net { |
| 17 |
| 18 // TrustStoreCollection is an implementation of TrustStore which combines the |
| 19 // results from multiple TrustStores. |
| 20 // |
| 21 // The synchronous matches will be in order from the primary store, and then |
| 22 // from the secondary stores in the order they were added to the |
| 23 // TrustStoreCollection. |
| 24 // |
| 25 // Currently only one "primary" store can be added that supports async queries, |
| 26 // any number of additional, synchronous-only stores can be used. (The |
| 27 // assumption is that the async one would be useful for OS integration, while |
| 28 // the sync only stores can be used for supplying additional anchors. If |
| 29 // multiple async stores are desired, it might be worth changing the |
| 30 // FindTrustAnchorsForCert interface so that it can return async results in |
| 31 // multiple batches.) |
| 32 class NET_EXPORT TrustStoreCollection : public TrustStore { |
| 33 public: |
| 34 TrustStoreCollection(); |
| 35 ~TrustStoreCollection() override; |
| 36 |
| 37 // Includes results from |store| in the combined output. Both sync and async |
| 38 // queries to |store| will be allowed. |store| must outlive the |
| 39 // TrustStoreCollection. |
| 40 void SetPrimaryTrustStore(TrustStore* store); |
| 41 |
| 42 // Includes results from |store| in the combined output. |store| will only be |
| 43 // queried synchronously. |store| must outlive the TrustStoreCollection. |
| 44 void AddTrustStoreSynchronousOnly(TrustStore* store); |
| 45 |
| 46 // TrustStore implementation: |
| 47 void FindTrustAnchorsForCert( |
| 48 const scoped_refptr<ParsedCertificate>& cert, |
| 49 const TrustAnchorsCallback& callback, |
| 50 TrustAnchors* synchronous_matches, |
| 51 std::unique_ptr<Request>* out_req) const override; |
| 52 |
| 53 private: |
| 54 TrustStore* primary_store_ = nullptr; |
| 55 std::vector<TrustStore*> sync_only_stores_; |
| 56 |
| 57 DISALLOW_COPY_AND_ASSIGN(TrustStoreCollection); |
| 58 }; |
| 59 |
| 60 } // namespace net |
| 61 |
| 62 #endif // NET_CERT_INTERNAL_TRUST_STORE_COLLECTION_H_ |
OLD | NEW |