| 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/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "components/prefs/pref_service.h" | 12 #include "components/prefs/pref_service.h" |
| 13 #include "components/security_interstitials/core/metrics_helper.h" | 13 #include "components/security_interstitials/core/metrics_helper.h" |
| 14 #include "components/security_interstitials/core/ssl_error_ui.h" | 14 #include "components/security_interstitials/core/ssl_error_ui.h" |
| 15 #include "ios/chrome/browser/application_context.h" |
| 15 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 16 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" | 17 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" |
| 17 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" | 18 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" |
| 18 #include "ios/chrome/browser/pref_names.h" | 19 #include "ios/chrome/browser/pref_names.h" |
| 19 #include "ios/chrome/grit/ios_strings.h" | 20 #include "ios/chrome/grit/ios_strings.h" |
| 20 #include "ios/public/provider/chrome/browser/browser_constants.h" | 21 #include "ios/public/provider/chrome/browser/browser_constants.h" |
| 21 #include "ios/web/public/web_state/web_state.h" | 22 #include "ios/web/public/web_state/web_state.h" |
| 22 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "url/gurl.h" | 25 #include "url/gurl.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // Set up the metrics helper for the SSLErrorUI. | 97 // Set up the metrics helper for the SSLErrorUI. |
| 97 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 98 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| 98 reporting_info.metric_prefix = | 99 reporting_info.metric_prefix = |
| 99 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; | 100 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; |
| 100 reporting_info.rappor_prefix = kSSLRapporPrefix; | 101 reporting_info.rappor_prefix = kSSLRapporPrefix; |
| 101 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 102 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
| 102 IOSChromeMetricsHelper* ios_chrome_metrics_helper = | 103 IOSChromeMetricsHelper* ios_chrome_metrics_helper = |
| 103 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); | 104 new IOSChromeMetricsHelper(web_state, request_url, reporting_info); |
| 104 controller_->set_metrics_helper(make_scoped_ptr(ios_chrome_metrics_helper)); | 105 controller_->set_metrics_helper(make_scoped_ptr(ios_chrome_metrics_helper)); |
| 105 | 106 |
| 106 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, | 107 ssl_error_ui_.reset(new SSLErrorUI( |
| 107 options_mask, time_triggered, languages, | 108 request_url, cert_error, ssl_info, options_mask, time_triggered, |
| 108 controller_.get())); | 109 GetApplicationContext()->GetNetworkTimeTracker(), languages, |
| 110 controller_.get())); |
| 109 | 111 |
| 110 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 112 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
| 111 // it leaks memory, so don't create it here. | 113 // it leaks memory, so don't create it here. |
| 112 } | 114 } |
| 113 | 115 |
| 114 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const { | 116 bool IOSSSLBlockingPage::ShouldCreateNewNavigation() const { |
| 115 return true; | 117 return true; |
| 116 } | 118 } |
| 117 | 119 |
| 118 IOSSSLBlockingPage::~IOSSSLBlockingPage() { | 120 IOSSSLBlockingPage::~IOSSSLBlockingPage() { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 callback_.Reset(); | 200 callback_.Reset(); |
| 199 } | 201 } |
| 200 | 202 |
| 201 // static | 203 // static |
| 202 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { | 204 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { |
| 203 const bool is_overridable = | 205 const bool is_overridable = |
| 204 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 206 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
| 205 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); | 207 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); |
| 206 return is_overridable; | 208 return is_overridable; |
| 207 } | 209 } |
| OLD | NEW |