| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 // Events for UMA. Do not reorder or change! | 52 // Events for UMA. Do not reorder or change! |
| 53 enum SSLExpirationAndDecision { | 53 enum SSLExpirationAndDecision { |
| 54 EXPIRED_AND_PROCEED, | 54 EXPIRED_AND_PROCEED, |
| 55 EXPIRED_AND_DO_NOT_PROCEED, | 55 EXPIRED_AND_DO_NOT_PROCEED, |
| 56 NOT_EXPIRED_AND_PROCEED, | 56 NOT_EXPIRED_AND_PROCEED, |
| 57 NOT_EXPIRED_AND_DO_NOT_PROCEED, | 57 NOT_EXPIRED_AND_DO_NOT_PROCEED, |
| 58 END_OF_SSL_EXPIRATION_AND_DECISION, | 58 END_OF_SSL_EXPIRATION_AND_DECISION, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Rappor prefix, which is used for both overridable and non-overridable | |
| 62 // interstitials so we don't leak the "overridable" bit. | |
| 63 const char kDeprecatedSSLRapporPrefix[] = "ssl2"; | |
| 64 const char kSSLRapporPrefix[] = "ssl3"; | |
| 65 | |
| 66 std::string GetSamplingEventName(const bool overridable, const int cert_error) { | 61 std::string GetSamplingEventName(const bool overridable, const int cert_error) { |
| 67 std::string event_name(kEventNameBase); | 62 std::string event_name(kEventNameBase); |
| 68 if (overridable) | 63 if (overridable) |
| 69 event_name.append(kEventOverridable); | 64 event_name.append(kEventOverridable); |
| 70 else | 65 else |
| 71 event_name.append(kEventNotOverridable); | 66 event_name.append(kEventNotOverridable); |
| 72 event_name.append(net::ErrorToString(cert_error)); | 67 event_name.append(net::ErrorToString(cert_error)); |
| 73 return event_name; | 68 return event_name; |
| 74 } | 69 } |
| 75 | 70 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 101 | 96 |
| 102 std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper( | 97 std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper( |
| 103 content::WebContents* web_contents, | 98 content::WebContents* web_contents, |
| 104 int cert_error, | 99 int cert_error, |
| 105 const GURL& request_url, | 100 const GURL& request_url, |
| 106 bool overridable) { | 101 bool overridable) { |
| 107 // Set up the metrics helper for the SSLErrorUI. | 102 // Set up the metrics helper for the SSLErrorUI. |
| 108 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 103 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| 109 reporting_info.metric_prefix = | 104 reporting_info.metric_prefix = |
| 110 overridable ? "ssl_overridable" : "ssl_nonoverridable"; | 105 overridable ? "ssl_overridable" : "ssl_nonoverridable"; |
| 111 reporting_info.rappor_prefix = kSSLRapporPrefix; | |
| 112 reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix; | |
| 113 reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE; | |
| 114 reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE; | |
| 115 return base::MakeUnique<ChromeMetricsHelper>( | 106 return base::MakeUnique<ChromeMetricsHelper>( |
| 116 web_contents, request_url, reporting_info, | 107 web_contents, request_url, reporting_info, |
| 117 GetSamplingEventName(overridable, cert_error)); | 108 GetSamplingEventName(overridable, cert_error)); |
| 118 } | 109 } |
| 119 | 110 |
| 120 } // namespace | 111 } // namespace |
| 121 | 112 |
| 122 // static | 113 // static |
| 123 InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting = | 114 InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting = |
| 124 &SSLBlockingPage::kTypeForTesting; | 115 &SSLBlockingPage::kTypeForTesting; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 300 |
| 310 // static | 301 // static |
| 311 bool SSLBlockingPage::IsOverridable(int options_mask, | 302 bool SSLBlockingPage::IsOverridable(int options_mask, |
| 312 const Profile* const profile) { | 303 const Profile* const profile) { |
| 313 const bool is_overridable = | 304 const bool is_overridable = |
| 314 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 305 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
| 315 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && | 306 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && |
| 316 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 307 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
| 317 return is_overridable; | 308 return is_overridable; |
| 318 } | 309 } |
| OLD | NEW |