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

Side by Side Diff: chrome/browser/ssl/cert_report_helper.cc

Issue 2448943004: Add experimental feature info to certificate reports (Closed)
Patch Set: undo more unnecessary changes Created 4 years, 1 month 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 "chrome/browser/ssl/cert_report_helper.h" 5 #include "chrome/browser/ssl/cert_report_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "build/build_config.h" 15 #include "build/build_config.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ssl/ssl_cert_reporter.h" 17 #include "chrome/browser/ssl/ssl_cert_reporter.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "chrome/grit/generated_resources.h" 19 #include "chrome/grit/generated_resources.h"
20 #include "components/network_time/network_time_tracker.h"
20 #include "components/prefs/pref_service.h" 21 #include "components/prefs/pref_service.h"
21 #include "components/safe_browsing_db/safe_browsing_prefs.h" 22 #include "components/safe_browsing_db/safe_browsing_prefs.h"
22 #include "components/security_interstitials/core/controller_client.h" 23 #include "components/security_interstitials/core/controller_client.h"
23 #include "components/security_interstitials/core/metrics_helper.h" 24 #include "components/security_interstitials/core/metrics_helper.h"
24 #include "components/variations/variations_associated_data.h" 25 #include "components/variations/variations_associated_data.h"
25 #include "content/public/browser/browser_context.h" 26 #include "content/public/browser/browser_context.h"
26 #include "content/public/browser/web_contents.h" 27 #include "content/public/browser/web_contents.h"
27 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
28 29
29 namespace { 30 namespace {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 108
108 std::string serialized_report; 109 std::string serialized_report;
109 certificate_reporting::ErrorReport report(request_url_.host(), ssl_info_); 110 certificate_reporting::ErrorReport report(request_url_.host(), ssl_info_);
110 111
111 report.SetInterstitialInfo( 112 report.SetInterstitialInfo(
112 interstitial_reason_, user_proceeded, 113 interstitial_reason_, user_proceeded,
113 overridable_ 114 overridable_
114 ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE 115 ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE
115 : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE); 116 : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE);
116 117
118 // Include information about experimental features relevant to
119 // certificate validation. (At present, this is just network time
120 // querying.)
121 std::map<std::string, std::string> params;
122 params[network_time::kVariationsServiceEnableFetchesOnDemand] =
123 variations::GetVariationParamValueByFeature(
124 network_time::kNetworkTimeServiceQuerying,
125 network_time::kVariationsServiceEnableFetchesOnDemand);
126 report.AddFeature(
127 network_time::kNetworkTimeServiceQuerying.name,
128 base::FeatureList::IsEnabled(network_time::kNetworkTimeServiceQuerying),
129 params);
130
117 if (!report.Serialize(&serialized_report)) { 131 if (!report.Serialize(&serialized_report)) {
118 LOG(ERROR) << "Failed to serialize certificate report."; 132 LOG(ERROR) << "Failed to serialize certificate report.";
119 return; 133 return;
120 } 134 }
121 135
122 ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report); 136 ssl_cert_reporter_->ReportInvalidCertificateChain(serialized_report);
123 } 137 }
124 138
125 void CertReportHelper::SetSSLCertReporterForTesting( 139 void CertReportHelper::SetSSLCertReporterForTesting(
126 std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { 140 std::unique_ptr<SSLCertReporter> ssl_cert_reporter) {
(...skipping 24 matching lines...) Expand all
151 if (sendingThreshold >= 0.0 && sendingThreshold <= 1.0) 165 if (sendingThreshold >= 0.0 && sendingThreshold <= 1.0)
152 return base::RandDouble() <= sendingThreshold; 166 return base::RandDouble() <= sendingThreshold;
153 } 167 }
154 } 168 }
155 return false; 169 return false;
156 } 170 }
157 171
158 bool CertReportHelper::IsPrefEnabled(const char* pref) { 172 bool CertReportHelper::IsPrefEnabled(const char* pref) {
159 return GetProfile(web_contents_)->GetPrefs()->GetBoolean(pref); 173 return GetProfile(web_contents_)->GetPrefs()->GetBoolean(pref);
160 } 174 }
OLDNEW
« no previous file with comments | « no previous file | components/certificate_reporting/cert_logger.proto » ('j') | components/certificate_reporting/error_report.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698