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

Side by Side Diff: net/cert/internal/cert_error_scoper.h

Issue 2759023002: Improvements to the net/cert/internal error handling. (Closed)
Patch Set: fix comment 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/cert_verify_proc_builtin.cc ('k') | net/cert/internal/cert_error_scoper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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_CERT_ERROR_SCOPER_H_
6 #define NET_CERT_INTERNAL_CERT_ERROR_SCOPER_H_
7
8 #include <memory>
9
10 #include "base/compiler_specific.h"
11 #include "base/macros.h"
12 #include "net/base/net_export.h"
13 #include "net/cert/internal/cert_error_id.h"
14
15 namespace net {
16
17 class CertErrors;
18 struct CertErrorNode;
19
20 // CertErrorScoper is a base class for adding parent nodes into a CertErrors
21 // object.
22 class NET_EXPORT CertErrorScoper {
23 public:
24 explicit CertErrorScoper(CertErrors* parent_errors);
25 virtual ~CertErrorScoper();
26
27 // BuildRootNode() will be called at most once, to create the desired parent
28 // node. It may never be called if no errors are added to the CertErrors
29 // parent.
30 virtual std::unique_ptr<CertErrorNode> BuildRootNode() = 0;
31
32 // Returns the parent node for this scoper (the one created by
33 // BuildRootNode()).
34 CertErrorNode* LazyGetRootNode();
35
36 private:
37 CertErrorScoper* parent_scoper_ = nullptr;
38 CertErrors* parent_errors_ = nullptr;
39 CertErrorNode* root_node_ = nullptr;
40
41 DISALLOW_COPY_AND_ASSIGN(CertErrorScoper);
42 };
43
44 // Implementation of CertErrorScoper that creates a simple parent node with no
45 // parameters (just an ID).
46 class NET_EXPORT CertErrorScoperNoParams : public CertErrorScoper {
47 public:
48 CertErrorScoperNoParams(CertErrors* parent_errors, CertErrorId id);
49 std::unique_ptr<CertErrorNode> BuildRootNode() override;
50
51 private:
52 CertErrorId id_;
53
54 DISALLOW_COPY_AND_ASSIGN(CertErrorScoperNoParams);
55 };
56
57 } // namespace net
58
59 #endif // NET_CERT_INTERNAL_CERT_ERROR_SCOPER_H_
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_builtin.cc ('k') | net/cert/internal/cert_error_scoper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698