Chromium Code Reviews| Index: net/cert/internal/trust_store_static.h |
| diff --git a/net/cert/internal/trust_store_static.h b/net/cert/internal/trust_store_static.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d28479fd5bb854f861e3d2236af1746bb7ccf71c |
| --- /dev/null |
| +++ b/net/cert/internal/trust_store_static.h |
| @@ -0,0 +1,49 @@ |
| +// 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_STATIC_H_ |
| +#define NET_CERT_INTERNAL_TRUST_STORE_STATIC_H_ |
| + |
| +#include <unordered_map> |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "base/strings/string_piece.h" |
| +#include "net/base/net_export.h" |
| +#include "net/cert/internal/trust_store.h" |
| + |
| +namespace net { |
| + |
| +namespace der { |
| +class Input; |
| +} |
| + |
| +// A very simple implementation of a TrustStore, which contains a set of |
| +// trust anchors. |
| +class NET_EXPORT TrustStoreStatic : public TrustStore { |
|
eroman
2016/08/18 21:13:38
I am not sure about the name "Static".
To me that
mattm
2016/08/18 22:18:22
Done.
|
| + public: |
| + TrustStoreStatic(); |
| + ~TrustStoreStatic() override; |
| + |
| + // Empties the trust store, resetting it to original state. |
| + void Clear(); |
| + |
| + void AddTrustAnchor(scoped_refptr<TrustAnchor> anchor); |
| + |
| + // Returns the trust anchors that match |name| in |*matches|, if any. |
| + void FindTrustAnchorsByNormalizedName(const der::Input& normalized_name, |
| + TrustAnchors* matches) const override; |
| + |
| + private: |
| + // Multimap from normalized subject -> TrustAnchor. |
| + std::unordered_multimap<base::StringPiece, |
| + scoped_refptr<TrustAnchor>, |
| + base::StringPieceHash> |
| + anchors_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TrustStoreStatic); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_CERT_INTERNAL_TRUST_STORE_STATIC_H_ |