OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/x509_certificate_net_log_param.h" | 5 #include "net/cert/x509_certificate_net_log_param.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "net/cert/x509_certificate.h" | 11 #include "net/cert/x509_certificate.h" |
12 | 12 |
13 namespace net { | 13 namespace net { |
14 | 14 |
15 base::Value* NetLogX509CertificateCallback(const X509Certificate* certificate, | 15 base::Value* NetLogX509CertificateCallback(const X509Certificate* certificate, |
16 NetLog::LogLevel log_level) { | 16 NetLogCaptureMode capture_mode) { |
17 base::DictionaryValue* dict = new base::DictionaryValue(); | 17 base::DictionaryValue* dict = new base::DictionaryValue(); |
18 base::ListValue* certs = new base::ListValue(); | 18 base::ListValue* certs = new base::ListValue(); |
19 std::vector<std::string> encoded_chain; | 19 std::vector<std::string> encoded_chain; |
20 certificate->GetPEMEncodedChain(&encoded_chain); | 20 certificate->GetPEMEncodedChain(&encoded_chain); |
21 for (size_t i = 0; i < encoded_chain.size(); ++i) | 21 for (size_t i = 0; i < encoded_chain.size(); ++i) |
22 certs->Append(new base::StringValue(encoded_chain[i])); | 22 certs->Append(new base::StringValue(encoded_chain[i])); |
23 dict->Set("certificates", certs); | 23 dict->Set("certificates", certs); |
24 return dict; | 24 return dict; |
25 } | 25 } |
26 | 26 |
27 } // namespace net | 27 } // namespace net |
OLD | NEW |