Commit 344ce89e authored by felt@chromium.org's avatar felt@chromium.org

Simplify overridable logic in SSLBlockingPage

Right now, SSLBlockingPage has both overridable_ and strict_enforcement_. 
This CL collapses both into overridable_, so that we only need to check one. 
However, strict_enforcement_ also remains on its own because it is checked 
separately in one place.

BUG=
R=palmer@chromium.org

Review URL: https://codereview.chromium.org/448163002

Cr-Commit-Position: refs/heads/master@{#288456}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288456 0039d316-1c4b-4281-b951-d872f2087c98
parent be9f07bb
...@@ -308,11 +308,12 @@ SSLBlockingPage::SSLBlockingPage( ...@@ -308,11 +308,12 @@ SSLBlockingPage::SSLBlockingPage(
captive_portal_detected_(false) { captive_portal_detected_(false) {
Profile* profile = Profile::FromBrowserContext( Profile* profile = Profile::FromBrowserContext(
web_contents->GetBrowserContext()); web_contents->GetBrowserContext());
if (strict_enforcement_) overridable_ = false;
// For UMA stats. // For UMA stats.
if (net::IsHostnameNonUnique(request_url_.HostNoBrackets())) if (net::IsHostnameNonUnique(request_url_.HostNoBrackets()))
internal_ = true; internal_ = true;
RecordSSLBlockingPageEventStats(SHOW_ALL); RecordSSLBlockingPageEventStats(SHOW_ALL);
if (overridable_ && !strict_enforcement_) { if (overridable_) {
RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE); RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE);
if (internal_) if (internal_)
RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME); RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME);
...@@ -331,8 +332,7 @@ SSLBlockingPage::SSLBlockingPage( ...@@ -331,8 +332,7 @@ SSLBlockingPage::SSLBlockingPage(
base::Time::NowFromSystemTime(), base::Time::NowFromSystemTime(),
request_url_, request_url_,
*ssl_info_.cert.get()); *ssl_info_.cert.get());
ssl_error_classification.RecordUMAStatistics( ssl_error_classification.RecordUMAStatistics(overridable_, cert_error_);
overridable_ && !strict_enforcement_, cert_error_);
#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
CaptivePortalService* captive_portal_service = CaptivePortalService* captive_portal_service =
...@@ -367,7 +367,7 @@ SSLBlockingPage::~SSLBlockingPage() { ...@@ -367,7 +367,7 @@ SSLBlockingPage::~SSLBlockingPage() {
if (!callback_.is_null()) { if (!callback_.is_null()) {
RecordSSLBlockingPageDetailedStats(false, RecordSSLBlockingPageDetailedStats(false,
cert_error_, cert_error_,
overridable_ && !strict_enforcement_, overridable_,
internal_, internal_,
num_visits_, num_visits_,
captive_portal_detection_enabled_, captive_portal_detection_enabled_,
...@@ -396,8 +396,7 @@ std::string SSLBlockingPage::GetHTMLContents() { ...@@ -396,8 +396,7 @@ std::string SSLBlockingPage::GetHTMLContents() {
// Shared values for both the overridable and non-overridable versions. // Shared values for both the overridable and non-overridable versions.
load_time_data.SetBoolean("ssl", true); load_time_data.SetBoolean("ssl", true);
load_time_data.SetBoolean( load_time_data.SetBoolean("overridable", overridable_);
"overridable", overridable_ && !strict_enforcement_);
load_time_data.SetString( load_time_data.SetString(
"tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE));
load_time_data.SetString( load_time_data.SetString(
...@@ -424,7 +423,7 @@ std::string SSLBlockingPage::GetHTMLContents() { ...@@ -424,7 +423,7 @@ std::string SSLBlockingPage::GetHTMLContents() {
l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON));
load_time_data.SetString("errorCode", net::ErrorToString(cert_error_)); load_time_data.SetString("errorCode", net::ErrorToString(cert_error_));
if (overridable_ && !strict_enforcement_) { // Overridable. if (overridable_) { // Overridable.
SSLErrorInfo error_info = SSLErrorInfo error_info =
SSLErrorInfo::CreateError( SSLErrorInfo::CreateError(
SSLErrorInfo::NetErrorToErrorType(cert_error_), SSLErrorInfo::NetErrorToErrorType(cert_error_),
...@@ -557,7 +556,7 @@ void SSLBlockingPage::OverrideRendererPrefs( ...@@ -557,7 +556,7 @@ void SSLBlockingPage::OverrideRendererPrefs(
void SSLBlockingPage::OnProceed() { void SSLBlockingPage::OnProceed() {
RecordSSLBlockingPageDetailedStats(true, RecordSSLBlockingPageDetailedStats(true,
cert_error_, cert_error_,
overridable_ && !strict_enforcement_, overridable_,
internal_, internal_,
num_visits_, num_visits_,
captive_portal_detection_enabled_, captive_portal_detection_enabled_,
...@@ -576,7 +575,7 @@ void SSLBlockingPage::OnProceed() { ...@@ -576,7 +575,7 @@ void SSLBlockingPage::OnProceed() {
void SSLBlockingPage::OnDontProceed() { void SSLBlockingPage::OnDontProceed() {
RecordSSLBlockingPageDetailedStats(false, RecordSSLBlockingPageDetailedStats(false,
cert_error_, cert_error_,
overridable_ && !strict_enforcement_, overridable_,
internal_, internal_,
num_visits_, num_visits_,
captive_portal_detection_enabled_, captive_portal_detection_enabled_,
......
...@@ -108,6 +108,7 @@ class SSLBlockingPage : public content::InterstitialPageDelegate, ...@@ -108,6 +108,7 @@ class SSLBlockingPage : public content::InterstitialPageDelegate,
const net::SSLInfo ssl_info_; const net::SSLInfo ssl_info_;
GURL request_url_; GURL request_url_;
// Could the user successfully override the error? // Could the user successfully override the error?
// overridable_ will be set to false if strict_enforcement_ is true.
bool overridable_; bool overridable_;
// Has the site requested strict enforcement of certificate errors? // Has the site requested strict enforcement of certificate errors?
bool strict_enforcement_; bool strict_enforcement_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment