| 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 db70bbbc203fba49a2bd3db981c0f4ee9d46a2d9..72ada1b604ba4da515b77b86aec7f4a92cd9fc31 100644
|
| --- a/chrome/browser/ssl/ssl_blocking_page.cc
|
| +++ b/chrome/browser/ssl/ssl_blocking_page.cc
|
| @@ -98,12 +98,77 @@ 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";
|
| + reporting_info.rappor_prefix = kSSLRapporPrefix;
|
| + reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix;
|
| + reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE;
|
| + reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE;
|
| + return base::MakeUnique<ChromeMetricsHelper>(
|
| + web_contents, request_url, reporting_info,
|
| + GetSamplingEventName(overridable, cert_error));
|
| +}
|
| +
|
| } // namespace
|
|
|
| // static
|
| InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting =
|
| &SSLBlockingPage::kTypeForTesting;
|
|
|
| +// static
|
| +SSLBlockingPage* SSLBlockingPage::Create(
|
| + content::WebContents* web_contents,
|
| + int cert_error,
|
| + const net::SSLInfo& ssl_info,
|
| + const GURL& request_url,
|
| + int options_mask,
|
| + const base::Time& time_triggered,
|
| + std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
|
| + const base::Callback<void(content::CertificateRequestResultType)>&
|
| + callback) {
|
| + bool overridable = IsOverridable(
|
| + options_mask,
|
| + Profile::FromBrowserContext(web_contents->GetBrowserContext()));
|
| + std::unique_ptr<ChromeMetricsHelper> metrics_helper(
|
| + 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);
|
| +}
|
| +
|
| +bool SSLBlockingPage::ShouldCreateNewNavigation() const {
|
| + return true;
|
| +}
|
| +
|
| +InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const {
|
| + return SSLBlockingPage::kTypeForTesting;
|
| +}
|
| +
|
| +SSLBlockingPage::~SSLBlockingPage() {
|
| + if (!callback_.is_null()) {
|
| + // The page is closed without the user having chosen what to do, default to
|
| + // deny.
|
| + RecordSSLExpirationPageEventState(expired_but_previously_allowed_, false,
|
| + overridable_);
|
| + NotifyDenyCertificate();
|
| + }
|
| +}
|
| +
|
| +void SSLBlockingPage::PopulateInterstitialStrings(
|
| + base::DictionaryValue* load_time_data) {
|
| + ssl_error_ui_->PopulateStringsForHTML(load_time_data);
|
| + cert_report_helper_->PopulateExtendedReportingOption(load_time_data);
|
| +}
|
| +
|
| // 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(
|
| @@ -114,13 +179,15 @@ SSLBlockingPage::SSLBlockingPage(
|
| int options_mask,
|
| const base::Time& time_triggered,
|
| std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
|
| + bool overridable,
|
| + std::unique_ptr<ChromeMetricsHelper> metrics_helper,
|
| const base::Callback<void(content::CertificateRequestResultType)>& callback)
|
| - : SecurityInterstitialPage(web_contents, request_url),
|
| + : SecurityInterstitialPage(web_contents,
|
| + request_url,
|
| + std::move(metrics_helper)),
|
| callback_(callback),
|
| ssl_info_(ssl_info),
|
| - overridable_(IsOverridable(
|
| - options_mask,
|
| - Profile::FromBrowserContext(web_contents->GetBrowserContext()))),
|
| + overridable_(overridable),
|
| expired_but_previously_allowed_(
|
| (options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0) {
|
| // Override prefs for the SSLErrorUI.
|
| @@ -135,20 +202,6 @@ SSLBlockingPage::SSLBlockingPage(
|
| else
|
| options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED;
|
|
|
| - // Set up the metrics helper for the SSLErrorUI.
|
| - security_interstitials::MetricsHelper::ReportDetails reporting_info;
|
| - reporting_info.metric_prefix =
|
| - overridable_ ? "ssl_overridable" : "ssl_nonoverridable";
|
| - reporting_info.rappor_prefix = kSSLRapporPrefix;
|
| - reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix;
|
| - reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE;
|
| - reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE;
|
| - ChromeMetricsHelper* chrome_metrics_helper =
|
| - new ChromeMetricsHelper(web_contents, request_url, reporting_info,
|
| - GetSamplingEventName(overridable_, cert_error));
|
| - chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_);
|
| - controller()->set_metrics_helper(base::WrapUnique(chrome_metrics_helper));
|
| -
|
| cert_report_helper_.reset(new CertReportHelper(
|
| std::move(ssl_cert_reporter), web_contents, request_url, ssl_info,
|
| certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_,
|
| @@ -157,35 +210,10 @@ SSLBlockingPage::SSLBlockingPage(
|
| ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info,
|
| options_mask, time_triggered,
|
| controller()));
|
| -
|
| // Creating an interstitial without showing (e.g. from chrome://interstitials)
|
| // it leaks memory, so don't create it here.
|
| }
|
|
|
| -bool SSLBlockingPage::ShouldCreateNewNavigation() const {
|
| - return true;
|
| -}
|
| -
|
| -InterstitialPageDelegate::TypeID SSLBlockingPage::GetTypeForTesting() const {
|
| - return SSLBlockingPage::kTypeForTesting;
|
| -}
|
| -
|
| -SSLBlockingPage::~SSLBlockingPage() {
|
| - if (!callback_.is_null()) {
|
| - // The page is closed without the user having chosen what to do, default to
|
| - // deny.
|
| - RecordSSLExpirationPageEventState(
|
| - expired_but_previously_allowed_, false, overridable_);
|
| - NotifyDenyCertificate();
|
| - }
|
| -}
|
| -
|
| -void SSLBlockingPage::PopulateInterstitialStrings(
|
| - base::DictionaryValue* load_time_data) {
|
| - ssl_error_ui_->PopulateStringsForHTML(load_time_data);
|
| - cert_report_helper_->PopulateExtendedReportingOption(load_time_data);
|
| -}
|
| -
|
| void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) {
|
| entry->GetSSL() = content::SSLStatus(
|
| content::SECURITY_STYLE_AUTHENTICATION_BROKEN, ssl_info_.cert, ssl_info_);
|
|
|