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

Side by Side Diff: net/cert/internal/cert_errors.cc

Issue 2755483008: Add initial CertVerifyProcBuiltin. (Closed)
Patch Set: type notimplemented properly Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « net/cert/internal/cert_errors.h ('k') | net/cert/internal/path_builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cert/internal/cert_errors.h" 5 #include "net/cert/internal/cert_errors.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "net/cert/internal/cert_error_params.h" 10 #include "net/cert/internal/cert_error_params.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 cur_indentation += " "; 65 cur_indentation += " ";
66 AppendLinesWithIndentation(node->params->ToDebugString(), cur_indentation, 66 AppendLinesWithIndentation(node->params->ToDebugString(), cur_indentation,
67 out); 67 out);
68 } 68 }
69 69
70 cur_indentation += " "; 70 cur_indentation += " ";
71 71
72 AppendChildrenToDebugString(node->children, cur_indentation, out); 72 AppendChildrenToDebugString(node->children, cur_indentation, out);
73 } 73 }
74 74
75 // Returns true if |children| contains the error |id| anywhere within it or its
76 // children recursively.
77 bool NodesContainError(const CertErrorNodes& children, CertErrorId id) {
78 for (const auto& child : children) {
79 if (child->node_type == CertErrorNodeType::TYPE_ERROR && child->id == id)
80 return true;
81 if (NodesContainError(child->children, id))
82 return true;
83 }
84 return false;
85 }
86
75 } // namespace 87 } // namespace
76 88
77 CertErrorNode::CertErrorNode(CertErrorNodeType node_type, 89 CertErrorNode::CertErrorNode(CertErrorNodeType node_type,
78 CertErrorId id, 90 CertErrorId id,
79 std::unique_ptr<CertErrorParams> params) 91 std::unique_ptr<CertErrorParams> params)
80 : node_type(node_type), id(id), params(std::move(params)) {} 92 : node_type(node_type), id(id), params(std::move(params)) {}
81 93
82 CertErrorNode::~CertErrorNode() = default; 94 CertErrorNode::~CertErrorNode() = default;
83 95
84 void CertErrorNode::AddChild(std::unique_ptr<CertErrorNode> child) { 96 void CertErrorNode::AddChild(std::unique_ptr<CertErrorNode> child) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 bool CertErrors::empty() const { 129 bool CertErrors::empty() const {
118 return nodes_.empty(); 130 return nodes_.empty();
119 } 131 }
120 132
121 std::string CertErrors::ToDebugString() const { 133 std::string CertErrors::ToDebugString() const {
122 std::string result; 134 std::string result;
123 AppendChildrenToDebugString(nodes_, std::string(), &result); 135 AppendChildrenToDebugString(nodes_, std::string(), &result);
124 return result; 136 return result;
125 } 137 }
126 138
139 bool CertErrors::ContainsError(CertErrorId id) const {
140 return NodesContainError(nodes_, id);
141 }
142
127 void CertErrors::AddNode(std::unique_ptr<CertErrorNode> node) { 143 void CertErrors::AddNode(std::unique_ptr<CertErrorNode> node) {
128 if (current_scoper_) 144 if (current_scoper_)
129 current_scoper_->LazyGetRootNode()->AddChild(std::move(node)); 145 current_scoper_->LazyGetRootNode()->AddChild(std::move(node));
130 else 146 else
131 nodes_.push_back(std::move(node)); 147 nodes_.push_back(std::move(node));
132 } 148 }
133 149
134 CertErrorScoper* CertErrors::SetScoper(CertErrorScoper* scoper) { 150 CertErrorScoper* CertErrors::SetScoper(CertErrorScoper* scoper) {
135 CertErrorScoper* prev = current_scoper_; 151 CertErrorScoper* prev = current_scoper_;
136 current_scoper_ = scoper; 152 current_scoper_ = scoper;
137 return prev; 153 return prev;
138 } 154 }
139 155
140 } // namespace net 156 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/internal/cert_errors.h ('k') | net/cert/internal/path_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698