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

Unified Diff: chrome/browser/ssl/bad_clock_blocking_page.cc

Issue 2303413002: Simplify security_interstitials::ControllerClient and other related classes (Closed)
Patch Set: Jialiu comments Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/bad_clock_blocking_page.cc
diff --git a/chrome/browser/ssl/bad_clock_blocking_page.cc b/chrome/browser/ssl/bad_clock_blocking_page.cc
index 028dc6e7793334044b9cb20a69b19664e7569092..1ee6156f4a3198cbe7f23c47a40154a205fdfb19 100644
--- a/chrome/browser/ssl/bad_clock_blocking_page.cc
+++ b/chrome/browser/ssl/bad_clock_blocking_page.cc
@@ -35,6 +35,19 @@ namespace {
const char kMetricsName[] = "bad_clock";
+std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper(
+ content::WebContents* web_contents,
+ const GURL& request_url) {
+ // Set up the metrics helper for the BadClockUI.
+ security_interstitials::MetricsHelper::ReportDetails reporting_info;
+ reporting_info.metric_prefix = kMetricsName;
+ std::unique_ptr<ChromeMetricsHelper> metrics_helper =
+ base::MakeUnique<ChromeMetricsHelper>(web_contents, request_url,
+ reporting_info, kMetricsName);
+ metrics_helper.get()->StartRecordingCaptivePortalMetrics(false);
+ return metrics_helper;
+}
+
} // namespace
// static
@@ -54,20 +67,12 @@ BadClockBlockingPage::BadClockBlockingPage(
ssl_errors::ClockState clock_state,
std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
const base::Callback<void(content::CertificateRequestResultType)>& callback)
- : SecurityInterstitialPage(web_contents, request_url),
+ : SecurityInterstitialPage(web_contents,
+ request_url,
+ CreateMetricsHelper(web_contents, request_url)),
callback_(callback),
ssl_info_(ssl_info),
time_triggered_(time_triggered) {
- // Set up the metrics helper for the BadClockUI.
- security_interstitials::MetricsHelper::ReportDetails reporting_info;
- reporting_info.metric_prefix = kMetricsName;
- ChromeMetricsHelper* chrome_metrics_helper = new ChromeMetricsHelper(
- web_contents, request_url, reporting_info, kMetricsName);
- chrome_metrics_helper->StartRecordingCaptivePortalMetrics(false);
- std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper(
- chrome_metrics_helper);
- controller()->set_metrics_helper(std::move(metrics_helper));
-
cert_report_helper_.reset(new CertReportHelper(
std::move(ssl_cert_reporter), web_contents, request_url, ssl_info,
certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK,
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page.cc ('k') | chrome/browser/ssl/captive_portal_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698