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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
12 #include "components/security_interstitials/core/metrics_helper.h" | 13 #include "components/security_interstitials/core/metrics_helper.h" |
13 #include "components/security_interstitials/core/ssl_error_ui.h" | 14 #include "components/security_interstitials/core/ssl_error_ui.h" |
14 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
15 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" | 16 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" |
16 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" | 17 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" |
17 #include "ios/chrome/grit/ios_strings.h" | 18 #include "ios/chrome/grit/ios_strings.h" |
18 #include "ios/public/provider/chrome/browser/browser_constants.h" | 19 #include "ios/public/provider/chrome/browser/browser_constants.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; | 87 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; |
87 | 88 |
88 // Set up the metrics helper for the SSLErrorUI. | 89 // Set up the metrics helper for the SSLErrorUI. |
89 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 90 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
90 reporting_info.metric_prefix = | 91 reporting_info.metric_prefix = |
91 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; | 92 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; |
92 reporting_info.rappor_prefix = kSSLRapporPrefix; | 93 reporting_info.rappor_prefix = kSSLRapporPrefix; |
93 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 94 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
94 IOSChromeMetricsHelper* ios_chrome_metrics_helper = | 95 IOSChromeMetricsHelper* ios_chrome_metrics_helper = |
95 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); | 96 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); |
96 controller_->set_metrics_helper(make_scoped_ptr(ios_chrome_metrics_helper)); | 97 controller_->set_metrics_helper(base::WrapUnique(ios_chrome_metrics_helper)); |
97 | 98 |
98 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, | 99 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, |
99 options_mask, time_triggered, | 100 options_mask, time_triggered, |
100 controller_.get())); | 101 controller_.get())); |
101 | 102 |
102 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 103 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
103 // it leaks memory, so don't create it here. | 104 // it leaks memory, so don't create it here. |
104 } | 105 } |
105 | 106 |
106 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const { | 107 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 callback_.Reset(); | 191 callback_.Reset(); |
191 } | 192 } |
192 | 193 |
193 // static | 194 // static |
194 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { | 195 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { |
195 const bool is_overridable = | 196 const bool is_overridable = |
196 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 197 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
197 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); | 198 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); |
198 return is_overridable; | 199 return is_overridable; |
199 } | 200 } |
OLD | NEW |