| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" | 5 #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 enum SSLExpirationAndDecision { | 33 enum SSLExpirationAndDecision { |
| 34 EXPIRED_AND_PROCEED, | 34 EXPIRED_AND_PROCEED, |
| 35 EXPIRED_AND_DO_NOT_PROCEED, | 35 EXPIRED_AND_DO_NOT_PROCEED, |
| 36 NOT_EXPIRED_AND_PROCEED, | 36 NOT_EXPIRED_AND_PROCEED, |
| 37 NOT_EXPIRED_AND_DO_NOT_PROCEED, | 37 NOT_EXPIRED_AND_DO_NOT_PROCEED, |
| 38 END_OF_SSL_EXPIRATION_AND_DECISION, | 38 END_OF_SSL_EXPIRATION_AND_DECISION, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Rappor prefix, which is used for both overridable and non-overridable | 41 // Rappor prefix, which is used for both overridable and non-overridable |
| 42 // interstitials so we don't leak the "overridable" bit. | 42 // interstitials so we don't leak the "overridable" bit. |
| 43 const char kSSLRapporPrefix[] = "ssl2"; | 43 const char kDeprecatedSSLRapporPrefix[] = "ssl2"; |
| 44 const char kSSLRapporPrefix[] = "ssl3"; |
| 44 | 45 |
| 45 void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, | 46 void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, |
| 46 bool proceed, | 47 bool proceed, |
| 47 bool overridable) { | 48 bool overridable) { |
| 48 SSLExpirationAndDecision event; | 49 SSLExpirationAndDecision event; |
| 49 if (expired_but_previously_allowed && proceed) | 50 if (expired_but_previously_allowed && proceed) |
| 50 event = EXPIRED_AND_PROCEED; | 51 event = EXPIRED_AND_PROCEED; |
| 51 else if (expired_but_previously_allowed && !proceed) | 52 else if (expired_but_previously_allowed && !proceed) |
| 52 event = EXPIRED_AND_DO_NOT_PROCEED; | 53 event = EXPIRED_AND_DO_NOT_PROCEED; |
| 53 else if (!expired_but_previously_allowed && proceed) | 54 else if (!expired_but_previously_allowed && proceed) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 if (overridable_) | 89 if (overridable_) |
| 89 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 90 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 90 else | 91 else |
| 91 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 92 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
| 92 | 93 |
| 93 // Set up the metrics helper for the SSLErrorUI. | 94 // Set up the metrics helper for the SSLErrorUI. |
| 94 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 95 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| 95 reporting_info.metric_prefix = | 96 reporting_info.metric_prefix = |
| 96 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; | 97 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; |
| 97 reporting_info.rappor_prefix = kSSLRapporPrefix; | 98 reporting_info.rappor_prefix = kSSLRapporPrefix; |
| 98 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 99 reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix; |
| 100 reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE; |
| 101 reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
| 99 IOSChromeMetricsHelper* ios_chrome_metrics_helper = | 102 IOSChromeMetricsHelper* ios_chrome_metrics_helper = |
| 100 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); | 103 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); |
| 101 controller_->set_metrics_helper(base::WrapUnique(ios_chrome_metrics_helper)); | 104 controller_->set_metrics_helper(base::WrapUnique(ios_chrome_metrics_helper)); |
| 102 | 105 |
| 103 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, | 106 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, |
| 104 options_mask, time_triggered, | 107 options_mask, time_triggered, |
| 105 controller_.get())); | 108 controller_.get())); |
| 106 | 109 |
| 107 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 110 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
| 108 // it leaks memory, so don't create it here. | 111 // it leaks memory, so don't create it here. |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 callback_.Reset(); | 211 callback_.Reset(); |
| 209 } | 212 } |
| 210 | 213 |
| 211 // static | 214 // static |
| 212 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { | 215 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { |
| 213 const bool is_overridable = | 216 const bool is_overridable = |
| 214 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 217 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
| 215 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); | 218 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); |
| 216 return is_overridable; | 219 return is_overridable; |
| 217 } | 220 } |
| OLD | NEW |