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

Unified Diff: net/cert/internal/trust_store_static.cc

Issue 2252933002: Make TrustStore into an interface, move impl to TrustStoreInMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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/trust_store_static.cc
diff --git a/net/cert/internal/trust_store_static.cc b/net/cert/internal/trust_store_static.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8e6c5c43c607fd427b90104efe28ceff27ca6daf
--- /dev/null
+++ b/net/cert/internal/trust_store_static.cc
@@ -0,0 +1,30 @@
+// 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.
+
+#include "net/cert/internal/trust_store_static.h"
+
+namespace net {
+
+TrustStoreStatic::TrustStoreStatic() = default;
+TrustStoreStatic::~TrustStoreStatic() = default;
+
+void TrustStoreStatic::Clear() {
+ anchors_.clear();
+}
+
+void TrustStoreStatic::AddTrustAnchor(scoped_refptr<TrustAnchor> anchor) {
+ // TODO(mattm): should this check for duplicate anchors?
+ anchors_.insert(std::make_pair(anchor->normalized_subject().AsStringPiece(),
+ std::move(anchor)));
+}
+
+void TrustStoreStatic::FindTrustAnchorsByNormalizedName(
+ const der::Input& normalized_name,
+ TrustAnchors* matches) const {
+ auto range = anchors_.equal_range(normalized_name.AsStringPiece());
+ for (auto it = range.first; it != range.second; ++it)
+ matches->push_back(it->second);
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698