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 other TrustStores. | |
eroman
2016/08/27 01:53:38
nit: multiple other --> "multiple"
mattm
2016/08/29 20:38:16
Done.
| |
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 async one would be useful for OS integration, while the | |
eroman
2016/08/27 01:53:38
"that async one" --> "that the async one"
mattm
2016/08/29 20:38:16
Done.
| |
28 // sync only stores can be used for supplying additional anchors. If multiple | |
29 // 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 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 |