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

Unified Diff: ios/chrome/browser/ssl/ios_ssl_blocking_page.mm

Issue 2303413002: Simplify security_interstitials::ControllerClient and other related classes (Closed)
Patch Set: namespaces 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: ios/chrome/browser/ssl/ios_ssl_blocking_page.mm
diff --git a/ios/chrome/browser/ssl/ios_ssl_blocking_page.mm b/ios/chrome/browser/ssl/ios_ssl_blocking_page.mm
index b689c5981214d619321340a39d5d9d1b1cd6d43d..adc645df1190316dcc1efd69e2dede5ef8b327ea 100644
--- a/ios/chrome/browser/ssl/ios_ssl_blocking_page.mm
+++ b/ios/chrome/browser/ssl/ios_ssl_blocking_page.mm
@@ -66,6 +66,21 @@ void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed,
END_OF_SSL_EXPIRATION_AND_DECISION);
}
}
+
+IOSChromeMetricsHelper* CreateMetricsHelper(web::WebState* web_state,
+ 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 new IOSChromeMetricsHelper(web_state, request_url, reporting_info);
+}
+
} // namespace
// Note that we always create a navigation entry with SSL errors.
@@ -84,25 +99,17 @@ IOSSSLBlockingPage::IOSSSLBlockingPage(
overridable_(IsOverridable(options_mask)),
expired_but_previously_allowed_(
(options_mask & SSLErrorUI::EXPIRED_BUT_PREVIOUSLY_ALLOWED) != 0),
- controller_(new IOSChromeControllerClient(web_state)) {
+ controller_(new IOSChromeControllerClient(
+ web_state,
+ base::WrapUnique(CreateMetricsHelper(web_state,
+ request_url,
+ IsOverridable(options_mask))))) {
// Override prefs for the SSLErrorUI.
if (overridable_)
options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED;
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;
- IOSChromeMetricsHelper* ios_chrome_metrics_helper =
- new IOSChromeMetricsHelper(web_state, request_url, reporting_info);
- controller_->set_metrics_helper(base::WrapUnique(ios_chrome_metrics_helper));
-
ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info,
options_mask, time_triggered,
controller_.get()));
@@ -213,8 +220,6 @@ void IOSSSLBlockingPage::NotifyDenyCertificate() {
// static
bool IOSSSLBlockingPage::IsOverridable(int options_mask) {
- const bool is_overridable =
- (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) &&
- !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT);
- return is_overridable;
+ return (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) &&
+ !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT);
}

Powered by Google App Engine
This is Rietveld 408576698