| OLD | NEW |
| 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 // ---------------------------- | 5 // ---------------------------- |
| 6 // Overview of error design | 6 // Overview of error design |
| 7 // ---------------------------- | 7 // ---------------------------- |
| 8 // | 8 // |
| 9 // Certificate path validation/parsing may emit a sequence of | 9 // Certificate path validation/parsing may emit a sequence of |
| 10 // errors/warnings/context. These are represented by a tree of CertErrorNodes. | 10 // errors/warnings/context. These are represented by a tree of CertErrorNodes. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 // Returns true if the tree is empty. Note that emptiness of the error tree | 133 // Returns true if the tree is empty. Note that emptiness of the error tree |
| 134 // is NOT equivalent to success for some call, and vice versa. (For instance | 134 // is NOT equivalent to success for some call, and vice versa. (For instance |
| 135 // consumers may forget to emit errors on failures, or some errors may be | 135 // consumers may forget to emit errors on failures, or some errors may be |
| 136 // non-fatal warnings). | 136 // non-fatal warnings). |
| 137 bool empty() const; | 137 bool empty() const; |
| 138 | 138 |
| 139 // Dumps a textual representation of the errors for debugging purposes. | 139 // Dumps a textual representation of the errors for debugging purposes. |
| 140 std::string ToDebugString() const; | 140 std::string ToDebugString() const; |
| 141 | 141 |
| 142 // Returns true the error |id| was added to this CertErrors (at any depth). |
| 143 bool ContainsError(CertErrorId id) const; |
| 144 |
| 142 private: | 145 private: |
| 143 // CertErrorScoper manipulates the CertErrors object. | 146 // CertErrorScoper manipulates the CertErrors object. |
| 144 friend class CertErrorScoper; | 147 friend class CertErrorScoper; |
| 145 | 148 |
| 146 void AddNode(std::unique_ptr<CertErrorNode> node); | 149 void AddNode(std::unique_ptr<CertErrorNode> node); |
| 147 | 150 |
| 148 // Used by CertErrorScoper to register itself as the top-level scoper. | 151 // Used by CertErrorScoper to register itself as the top-level scoper. |
| 149 // Returns the previously set scoper, or nullptr if there was none. | 152 // Returns the previously set scoper, or nullptr if there was none. |
| 150 CertErrorScoper* SetScoper(CertErrorScoper* scoper); | 153 CertErrorScoper* SetScoper(CertErrorScoper* scoper); |
| 151 | 154 |
| 152 CertErrorNodes nodes_; | 155 CertErrorNodes nodes_; |
| 153 | 156 |
| 154 // The top-most CertErrorScoper that is currently in scope (and which affects | 157 // The top-most CertErrorScoper that is currently in scope (and which affects |
| 155 // the parent node for newly added errors). | 158 // the parent node for newly added errors). |
| 156 CertErrorScoper* current_scoper_ = nullptr; | 159 CertErrorScoper* current_scoper_ = nullptr; |
| 157 | 160 |
| 158 DISALLOW_COPY_AND_ASSIGN(CertErrors); | 161 DISALLOW_COPY_AND_ASSIGN(CertErrors); |
| 159 }; | 162 }; |
| 160 | 163 |
| 161 } // namespace net | 164 } // namespace net |
| 162 | 165 |
| 163 #endif // NET_CERT_INTERNAL_CERT_ERRORS_H_ | 166 #endif // NET_CERT_INTERNAL_CERT_ERRORS_H_ |
| OLD | NEW |