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 21 matching lines...) Expand all Loading... |
32 namespace { | 32 namespace { |
33 // Events for UMA. Do not reorder or change! | 33 // Events for UMA. Do not reorder or change! |
34 enum SSLExpirationAndDecision { | 34 enum SSLExpirationAndDecision { |
35 EXPIRED_AND_PROCEED, | 35 EXPIRED_AND_PROCEED, |
36 EXPIRED_AND_DO_NOT_PROCEED, | 36 EXPIRED_AND_DO_NOT_PROCEED, |
37 NOT_EXPIRED_AND_PROCEED, | 37 NOT_EXPIRED_AND_PROCEED, |
38 NOT_EXPIRED_AND_DO_NOT_PROCEED, | 38 NOT_EXPIRED_AND_DO_NOT_PROCEED, |
39 END_OF_SSL_EXPIRATION_AND_DECISION, | 39 END_OF_SSL_EXPIRATION_AND_DECISION, |
40 }; | 40 }; |
41 | 41 |
42 // Rappor prefix, which is used for both overridable and non-overridable | |
43 // interstitials so we don't leak the "overridable" bit. | |
44 const char kDeprecatedSSLRapporPrefix[] = "ssl2"; | |
45 const char kSSLRapporPrefix[] = "ssl3"; | |
46 | |
47 void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, | 42 void RecordSSLExpirationPageEventState(bool expired_but_previously_allowed, |
48 bool proceed, | 43 bool proceed, |
49 bool overridable) { | 44 bool overridable) { |
50 SSLExpirationAndDecision event; | 45 SSLExpirationAndDecision event; |
51 if (expired_but_previously_allowed && proceed) | 46 if (expired_but_previously_allowed && proceed) |
52 event = EXPIRED_AND_PROCEED; | 47 event = EXPIRED_AND_PROCEED; |
53 else if (expired_but_previously_allowed && !proceed) | 48 else if (expired_but_previously_allowed && !proceed) |
54 event = EXPIRED_AND_DO_NOT_PROCEED; | 49 event = EXPIRED_AND_DO_NOT_PROCEED; |
55 else if (!expired_but_previously_allowed && proceed) | 50 else if (!expired_but_previously_allowed && proceed) |
56 event = NOT_EXPIRED_AND_PROCEED; | 51 event = NOT_EXPIRED_AND_PROCEED; |
(...skipping 11 matching lines...) Expand all Loading... |
68 } | 63 } |
69 } | 64 } |
70 | 65 |
71 IOSChromeMetricsHelper* CreateMetricsHelper(web::WebState* web_state, | 66 IOSChromeMetricsHelper* CreateMetricsHelper(web::WebState* web_state, |
72 const GURL& request_url, | 67 const GURL& request_url, |
73 bool overridable) { | 68 bool overridable) { |
74 // Set up the metrics helper for the SSLErrorUI. | 69 // Set up the metrics helper for the SSLErrorUI. |
75 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 70 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
76 reporting_info.metric_prefix = | 71 reporting_info.metric_prefix = |
77 overridable ? "ssl_overridable" : "ssl_nonoverridable"; | 72 overridable ? "ssl_overridable" : "ssl_nonoverridable"; |
78 reporting_info.rappor_prefix = kSSLRapporPrefix; | |
79 reporting_info.deprecated_rappor_prefix = kDeprecatedSSLRapporPrefix; | |
80 reporting_info.rappor_report_type = rappor::LOW_FREQUENCY_UMA_RAPPOR_TYPE; | |
81 reporting_info.deprecated_rappor_report_type = rappor::UMA_RAPPOR_TYPE; | |
82 return new IOSChromeMetricsHelper(web_state, request_url, reporting_info); | 73 return new IOSChromeMetricsHelper(web_state, request_url, reporting_info); |
83 } | 74 } |
84 | 75 |
85 } // namespace | 76 } // namespace |
86 | 77 |
87 // Note that we always create a navigation entry with SSL errors. | 78 // Note that we always create a navigation entry with SSL errors. |
88 // No error happening loading a sub-resource triggers an interstitial so far. | 79 // No error happening loading a sub-resource triggers an interstitial so far. |
89 IOSSSLBlockingPage::IOSSSLBlockingPage( | 80 IOSSSLBlockingPage::IOSSSLBlockingPage( |
90 web::WebState* web_state, | 81 web::WebState* web_state, |
91 int cert_error, | 82 int cert_error, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 186 |
196 callback_.Run(false); | 187 callback_.Run(false); |
197 callback_.Reset(); | 188 callback_.Reset(); |
198 } | 189 } |
199 | 190 |
200 // static | 191 // static |
201 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { | 192 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { |
202 return (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 193 return (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
203 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); | 194 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); |
204 } | 195 } |
OLD | NEW |