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

Side by Side Diff: components/certificate_reporting/error_report.cc

Issue 2682733003: Add AIA fetching feature info to certificate reports (Closed)
Patch Set: Add UMA statistic for AIA fetches Created 3 years, 10 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/certificate_reporting/error_report.h" 5 #include "components/certificate_reporting/error_report.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "components/certificate_reporting/cert_logger.pb.h" 12 #include "components/certificate_reporting/cert_logger.pb.h"
13 #include "components/network_time/network_time_tracker.h" 13 #include "components/network_time/network_time_tracker.h"
14 #include "net/cert/cert_status_flags.h" 14 #include "net/cert/cert_status_flags.h"
15 #include "net/cert/x509_certificate.h" 15 #include "net/cert/x509_certificate.h"
16 #include "net/ssl/ssl_info.h" 16 #include "net/ssl/ssl_info.h"
17 17
18 #if defined(OS_ANDROID)
19 #include "net/cert/cert_verify_proc_android.h"
20 #endif
21
18 using network_time::NetworkTimeTracker; 22 using network_time::NetworkTimeTracker;
19 23
20 namespace certificate_reporting { 24 namespace certificate_reporting {
21 25
22 namespace { 26 namespace {
23 27
24 void AddCertStatusToReportErrors(net::CertStatus cert_status, 28 void AddCertStatusToReportErrors(net::CertStatus cert_status,
25 CertLoggerRequest* report) { 29 CertLoggerRequest* report) {
26 #define COPY_CERT_STATUS(error) RENAME_CERT_STATUS(error, CERT_##error) 30 #define COPY_CERT_STATUS(error) RENAME_CERT_STATUS(error, CERT_##error)
27 #define RENAME_CERT_STATUS(status_error, logger_error) \ 31 #define RENAME_CERT_STATUS(status_error, logger_error) \
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 !CertificateChainToString( 82 !CertificateChainToString(
79 ssl_info.unverified_cert, 83 ssl_info.unverified_cert,
80 cert_report_->mutable_unverified_cert_chain())) { 84 cert_report_->mutable_unverified_cert_chain())) {
81 LOG(ERROR) << "Could not get PEM encoded unverified certificate chain."; 85 LOG(ERROR) << "Could not get PEM encoded unverified certificate chain.";
82 } 86 }
83 87
84 cert_report_->add_pin(ssl_info.pinning_failure_log); 88 cert_report_->add_pin(ssl_info.pinning_failure_log);
85 cert_report_->set_is_issued_by_known_root(ssl_info.is_issued_by_known_root); 89 cert_report_->set_is_issued_by_known_root(ssl_info.is_issued_by_known_root);
86 90
87 AddCertStatusToReportErrors(ssl_info.cert_status, cert_report_.get()); 91 AddCertStatusToReportErrors(ssl_info.cert_status, cert_report_.get());
92
93 #if defined(OS_ANDROID)
94 CertLoggerFeaturesInfo* features_info = cert_report_->mutable_features_info();
95 features_info->set_android_aia_fetching_status(
96 base::FeatureList::IsEnabled(
97 net::CertVerifyProcAndroid::kAIAFetchingFeature)
98 ? CertLoggerFeaturesInfo::ANDROID_AIA_FETCHING_ENABLED
99 : CertLoggerFeaturesInfo::ANDROID_AIA_FETCHING_DISABLED);
100 #endif
88 } 101 }
89 102
90 ErrorReport::~ErrorReport() {} 103 ErrorReport::~ErrorReport() {}
91 104
92 bool ErrorReport::InitializeFromString(const std::string& serialized_report) { 105 bool ErrorReport::InitializeFromString(const std::string& serialized_report) {
93 return cert_report_->ParseFromString(serialized_report); 106 return cert_report_->ParseFromString(serialized_report);
94 } 107 }
95 108
96 bool ErrorReport::Serialize(std::string* output) const { 109 bool ErrorReport::Serialize(std::string* output) const {
97 return cert_report_->SerializeToString(output); 110 return cert_report_->SerializeToString(output);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 179
167 const std::string& ErrorReport::hostname() const { 180 const std::string& ErrorReport::hostname() const {
168 return cert_report_->hostname(); 181 return cert_report_->hostname();
169 } 182 }
170 183
171 bool ErrorReport::is_retry_upload() const { 184 bool ErrorReport::is_retry_upload() const {
172 return cert_report_->is_retry_upload(); 185 return cert_report_->is_retry_upload();
173 } 186 }
174 187
175 } // namespace certificate_reporting 188 } // namespace certificate_reporting
OLDNEW
« no previous file with comments | « components/certificate_reporting/cert_logger.proto ('k') | components/certificate_reporting/error_report_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698