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

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

Issue 2964283002: Add chrome channel to cert logger reports (Closed)
Patch Set: Revert unneeded change Created 3 years, 5 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 "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/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ssl/ssl_cert_reporter.h" 18 #include "chrome/browser/ssl/ssl_cert_reporter.h"
19 #include "chrome/common/channel_info.h"
19 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
20 #include "components/prefs/pref_service.h" 21 #include "components/prefs/pref_service.h"
21 #include "components/safe_browsing/common/safe_browsing_prefs.h" 22 #include "components/safe_browsing/common/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/strings/grit/components_strings.h" 25 #include "components/strings/grit/components_strings.h"
25 #include "components/variations/variations_associated_data.h" 26 #include "components/variations/variations_associated_data.h"
26 #include "content/public/browser/browser_context.h" 27 #include "content/public/browser/browser_context.h"
27 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
28 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 120
120 if (!ShouldReportCertificateError()) 121 if (!ShouldReportCertificateError())
121 return; 122 return;
122 123
123 std::string serialized_report; 124 std::string serialized_report;
124 certificate_reporting::ErrorReport report(request_url_.host(), ssl_info_); 125 certificate_reporting::ErrorReport report(request_url_.host(), ssl_info_);
125 126
126 report.AddNetworkTimeInfo(g_browser_process->network_time_tracker()); 127 report.AddNetworkTimeInfo(g_browser_process->network_time_tracker());
127 128
129 report.AddChromeChannel(chrome::GetChannel());
130
estark 2017/07/01 17:19:01 It would be nice to have a test for this line... b
Mustafa Acer 2017/07/01 20:14:03 The obvious way is to write a browser test that: -
estark 2017/07/02 00:09:12 That sounds good! I was thinking that I'm not sure
meacer 2017/07/05 20:13:19 Just chatted with Sasha. It seems easier to just a
128 report.SetInterstitialInfo( 131 report.SetInterstitialInfo(
129 interstitial_reason_, user_proceeded, 132 interstitial_reason_, user_proceeded,
130 overridable_ 133 overridable_
131 ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE 134 ? certificate_reporting::ErrorReport::INTERSTITIAL_OVERRIDABLE
132 : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE, 135 : certificate_reporting::ErrorReport::INTERSTITIAL_NOT_OVERRIDABLE,
133 interstitial_time_); 136 interstitial_time_);
134 137
135 if (!report.Serialize(&serialized_report)) { 138 if (!report.Serialize(&serialized_report)) {
136 LOG(ERROR) << "Failed to serialize certificate report."; 139 LOG(ERROR) << "Failed to serialize certificate report.";
137 return; 140 return;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 if (sendingThreshold >= 0.0 && sendingThreshold <= 1.0) 181 if (sendingThreshold >= 0.0 && sendingThreshold <= 1.0)
179 return base::RandDouble() <= sendingThreshold; 182 return base::RandDouble() <= sendingThreshold;
180 } 183 }
181 } 184 }
182 return false; 185 return false;
183 } 186 }
184 187
185 bool CertReportHelper::IsPrefEnabled(const char* pref) { 188 bool CertReportHelper::IsPrefEnabled(const char* pref) {
186 return GetProfile(web_contents_)->GetPrefs()->GetBoolean(pref); 189 return GetProfile(web_contents_)->GetPrefs()->GetBoolean(pref);
187 } 190 }
OLDNEW
« no previous file with comments | « no previous file | components/certificate_reporting/DEPS » ('j') | components/certificate_reporting/error_report.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698