| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ssl/ssl_blocking_page.h" | 5 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 enum SSLExpirationAndDecision { | 54 enum SSLExpirationAndDecision { |
| 55 EXPIRED_AND_PROCEED, | 55 EXPIRED_AND_PROCEED, |
| 56 EXPIRED_AND_DO_NOT_PROCEED, | 56 EXPIRED_AND_DO_NOT_PROCEED, |
| 57 NOT_EXPIRED_AND_PROCEED, | 57 NOT_EXPIRED_AND_PROCEED, |
| 58 NOT_EXPIRED_AND_DO_NOT_PROCEED, | 58 NOT_EXPIRED_AND_DO_NOT_PROCEED, |
| 59 END_OF_SSL_EXPIRATION_AND_DECISION, | 59 END_OF_SSL_EXPIRATION_AND_DECISION, |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 // Rappor prefix, which is used for both overridable and non-overridable | 62 // Rappor prefix, which is used for both overridable and non-overridable |
| 63 // interstitials so we don't leak the "overridable" bit. | 63 // interstitials so we don't leak the "overridable" bit. |
| 64 const char kSSLRapporPrefix[] = "ssl2"; | 64 const char kDeprecatedSSLRapporPrefix[] = "ssl2"; |
| 65 const char kSSLRapporPrefix[] = "ssl3"; |
| 65 | 66 |
| 66 std::string GetSamplingEventName(const bool overridable, const int cert_error) { | 67 std::string GetSamplingEventName(const bool overridable, const int cert_error) { |
| 67 std::string event_name(kEventNameBase); | 68 std::string event_name(kEventNameBase); |
| 68 if (overridable) | 69 if (overridable) |
| 69 event_name.append(kEventOverridable); | 70 event_name.append(kEventOverridable); |
| 70 else | 71 else |
| 71 event_name.append(kEventNotOverridable); | 72 event_name.append(kEventNotOverridable); |
| 72 event_name.append(net::ErrorToString(cert_error)); | 73 event_name.append(net::ErrorToString(cert_error)); |
| 73 return event_name; | 74 return event_name; |
| 74 } | 75 } |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 if (overridable_) | 136 if (overridable_) |
| 136 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 137 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 137 else | 138 else |
| 138 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 139 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 139 | 140 |
| 140 // Set up the metrics helper for the SSLErrorUI. | 141 // Set up the metrics helper for the SSLErrorUI. |
| 141 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 142 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| 142 reporting_info.metric_prefix = | 143 reporting_info.metric_prefix = |
| 143 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; | 144 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; |
| 144 reporting_info.rappor_prefix = kSSLRapporPrefix; | 145 reporting_info.rappor_prefix = kSSLRapporPrefix; |
| 145 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 146 reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix; |
| 147 reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE; |
| 148 reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
| 146 ChromeMetricsHelper* chrome_metrics_helper = | 149 ChromeMetricsHelper* chrome_metrics_helper = |
| 147 new ChromeMetricsHelper(web_contents, request_url, reporting_info, | 150 new ChromeMetricsHelper(web_contents, request_url, reporting_info, |
| 148 GetSamplingEventName(overridable_, cert_error)); | 151 GetSamplingEventName(overridable_, cert_error)); |
| 149 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); | 152 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); |
| 150 controller_->set_metrics_helper(base::WrapUnique(chrome_metrics_helper)); | 153 controller_->set_metrics_helper(base::WrapUnique(chrome_metrics_helper)); |
| 151 | 154 |
| 152 cert_report_helper_.reset(new CertReportHelper( | 155 cert_report_helper_.reset(new CertReportHelper( |
| 153 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, | 156 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, |
| 154 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, | 157 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, |
| 155 controller_->metrics_helper())); | 158 controller_->metrics_helper())); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 279 |
| 277 // static | 280 // static |
| 278 bool SSLBlockingPage::IsOverridable(int options_mask, | 281 bool SSLBlockingPage::IsOverridable(int options_mask, |
| 279 const Profile* const profile) { | 282 const Profile* const profile) { |
| 280 const bool is_overridable = | 283 const bool is_overridable = |
| 281 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 284 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
| 282 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && | 285 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && |
| 283 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 286 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 284 return is_overridable; | 287 return is_overridable; |
| 285 } | 288 } |
| OLD | NEW |