Chromium Code Reviews| Index: chrome/browser/ssl/ssl_blocking_page.cc |
| diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc |
| index 27a004b7416a07f465869340131d698be97bc774..38ebe5d2aa035c490b5443df09ae8eb896ddee7f 100644 |
| --- a/chrome/browser/ssl/ssl_blocking_page.cc |
| +++ b/chrome/browser/ssl/ssl_blocking_page.cc |
| @@ -94,20 +94,6 @@ void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, |
| } |
| } |
| -std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper( |
| - content::WebContents* web_contents, |
| - int cert_error, |
| - const GURL& request_url, |
| - bool overridable) { |
| - // Set up the metrics helper for the SSLErrorUI. |
| - security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| - reporting_info.metric_prefix = |
| - overridable ? "ssl_overridable" : "ssl_nonoverridable"; |
| - return base::MakeUnique<ChromeMetricsHelper>( |
| - web_contents, request_url, reporting_info, |
| - GetSamplingEventName(overridable, cert_error)); |
| -} |
| - |
| } // namespace |
| // static |
| @@ -144,10 +130,14 @@ SSLBlockingPage* SSLBlockingPage::Create( |
| CreateMetricsHelper(web_contents, cert_error, request_url, overridable)); |
| metrics_helper.get()->StartRecordingCaptivePortalMetrics(overridable); |
| - return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, |
| - options_mask, time_triggered, |
| - std::move(ssl_cert_reporter), overridable, |
| - std::move(metrics_helper), callback); |
| + SSLBlockingPage* page = |
| + new SSLBlockingPage(web_contents, ssl_info, request_url, options_mask, |
| + time_triggered, std::move(ssl_cert_reporter), |
| + overridable, std::move(metrics_helper), callback); |
| + page->SetErrorUI(base::MakeUnique<SSLErrorUI>( |
| + request_url, cert_error, ssl_info, options_mask, time_triggered, |
| + page->controller())); |
| + return page; |
| } |
| bool SSLBlockingPage::ShouldCreateNewNavigation() const { |
| @@ -174,11 +164,29 @@ void SSLBlockingPage::PopulateInterstitialStrings( |
| cert_report_helper_->PopulateExtendedReportingOption(load_time_data); |
| } |
| +void SSLBlockingPage::SetErrorUI(std::unique_ptr<SSLErrorUI> error_ui) { |
| + ssl_error_ui_ = std::move(error_ui); |
| +} |
| + |
| +// static |
| +std::unique_ptr<ChromeMetricsHelper> SSLBlockingPage::CreateMetricsHelper( |
| + content::WebContents* web_contents, |
| + int cert_error, |
| + const GURL& request_url, |
| + bool overridable) { |
| + // Set up the metrics helper for the SSLErrorUI. |
|
meacer
2017/06/22 19:06:18
nit: Comment seems a bit redundant.
estark
2017/06/22 22:01:05
Done.
|
| + security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| + reporting_info.metric_prefix = |
| + overridable ? "ssl_overridable" : "ssl_nonoverridable"; |
| + return base::MakeUnique<ChromeMetricsHelper>( |
| + web_contents, request_url, reporting_info, |
| + GetSamplingEventName(overridable, cert_error)); |
| +} |
| + |
| // Note that we always create a navigation entry with SSL errors. |
| // No error happening loading a sub-resource triggers an interstitial so far. |
| SSLBlockingPage::SSLBlockingPage( |
| content::WebContents* web_contents, |
| - int cert_error, |
| const net::SSLInfo& ssl_info, |
| const GURL& request_url, |
| int options_mask, |
| @@ -190,8 +198,8 @@ SSLBlockingPage::SSLBlockingPage( |
| : SecurityInterstitialPage( |
| web_contents, |
| request_url, |
| - base::MakeUnique<ChromeControllerClient>( |
| - web_contents, std::move(metrics_helper))), |
| + base::MakeUnique<ChromeControllerClient>(web_contents, |
| + std::move(metrics_helper))), |
| callback_(callback), |
| ssl_info_(ssl_info), |
| overridable_(overridable), |
| @@ -205,13 +213,7 @@ SSLBlockingPage::SSLBlockingPage( |
| certificate_reporting::ErrorReport::INTERSTITIAL_SSL, |
| overridable_, |
| time_triggered, |
| - controller()->metrics_helper())), |
| - ssl_error_ui_(new SSLErrorUI(request_url, |
| - cert_error, |
| - ssl_info, |
| - options_mask, |
| - time_triggered, |
| - controller())) { |
| + controller()->metrics_helper())) { |
| // Creating an interstitial without showing (e.g. from chrome://interstitials) |
| // it leaks memory, so don't create it here. |
| } |