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 #include "net/cert/internal/cert_errors.h" | 5 #include "net/cert/internal/cert_errors.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 void CertErrors::AddWith1DerParam(CertErrorType type, const der::Input& der1) { | 47 void CertErrors::AddWith1DerParam(CertErrorType type, const der::Input& der1) { |
48 AddWithParam(type, base::MakeUnique<CertErrorParamsDer1>(der1)); | 48 AddWithParam(type, base::MakeUnique<CertErrorParamsDer1>(der1)); |
49 } | 49 } |
50 | 50 |
51 void CertErrors::AddWith2DerParams(CertErrorType type, | 51 void CertErrors::AddWith2DerParams(CertErrorType type, |
52 const der::Input& der1, | 52 const der::Input& der1, |
53 const der::Input& der2) { | 53 const der::Input& der2) { |
54 AddWithParam(type, base::MakeUnique<CertErrorParamsDer2>(der1, der2)); | 54 AddWithParam(type, base::MakeUnique<CertErrorParamsDer2>(der1, der2)); |
55 } | 55 } |
56 | 56 |
| 57 std::string CertErrors::ToDebugString() const { |
| 58 std::string str; |
| 59 for (const auto& error : errors_) { |
| 60 if (!str.empty()) |
| 61 str += "\n"; |
| 62 str += error.type; |
| 63 } |
| 64 return str; |
| 65 } |
| 66 |
57 ScopedCertErrorsCertContext::ScopedCertErrorsCertContext( | 67 ScopedCertErrorsCertContext::ScopedCertErrorsCertContext( |
58 CertErrors* parent, | 68 CertErrors* parent, |
59 const ParsedCertificate* cert, | 69 const ParsedCertificate* cert, |
60 size_t i) { | 70 size_t i) { |
61 // TODO(crbug.com/634443): Implement. | 71 // TODO(crbug.com/634443): Implement. |
62 } | 72 } |
63 | 73 |
64 ScopedCertErrorsCertContext::~ScopedCertErrorsCertContext() { | 74 ScopedCertErrorsCertContext::~ScopedCertErrorsCertContext() { |
65 // TODO(crbug.com/634443): Implement. | 75 // TODO(crbug.com/634443): Implement. |
66 } | 76 } |
(...skipping 22 matching lines...) Expand all Loading... |
89 : der1_(der1.AsString()), der2_(der2.AsString()) {} | 99 : der1_(der1.AsString()), der2_(der2.AsString()) {} |
90 | 100 |
91 std::unique_ptr<base::Value> CertErrorParamsDer2::ToValue() const { | 101 std::unique_ptr<base::Value> CertErrorParamsDer2::ToValue() const { |
92 auto dict = base::MakeUnique<base::DictionaryValue>(); | 102 auto dict = base::MakeUnique<base::DictionaryValue>(); |
93 dict->SetString("der1", HexEncodeString(der1_)); | 103 dict->SetString("der1", HexEncodeString(der1_)); |
94 dict->SetString("der2", HexEncodeString(der2_)); | 104 dict->SetString("der2", HexEncodeString(der2_)); |
95 return std::move(dict); | 105 return std::move(dict); |
96 } | 106 } |
97 | 107 |
98 } // namespace net | 108 } // namespace net |
OLD | NEW |