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> |
| 8 |
7 #include "base/bind.h" | 9 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
9 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
10 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
11 #include "base/prefs/pref_service.h" | 13 #include "base/prefs/pref_service.h" |
12 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
13 #include "base/time/time.h" | 15 #include "base/time/time.h" |
14 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/interstitials/chrome_controller_client.h" | 17 #include "chrome/browser/interstitials/chrome_controller_client.h" |
16 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 18 #include "chrome/browser/interstitials/chrome_metrics_helper.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; | 145 overridable_ ? "ssl_overridable" : "ssl_nonoverridable"; |
144 reporting_info.rappor_prefix = kSSLRapporPrefix; | 146 reporting_info.rappor_prefix = kSSLRapporPrefix; |
145 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; | 147 reporting_info.rappor_report_type = rappor::UMA_RAPPOR_TYPE; |
146 ChromeMetricsHelper* chrome_metrics_helper = | 148 ChromeMetricsHelper* chrome_metrics_helper = |
147 new ChromeMetricsHelper(web_contents, request_url, reporting_info, | 149 new ChromeMetricsHelper(web_contents, request_url, reporting_info, |
148 GetSamplingEventName(overridable_, cert_error)); | 150 GetSamplingEventName(overridable_, cert_error)); |
149 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); | 151 chrome_metrics_helper->StartRecordingCaptivePortalMetrics(overridable_); |
150 controller_->set_metrics_helper(make_scoped_ptr(chrome_metrics_helper)); | 152 controller_->set_metrics_helper(make_scoped_ptr(chrome_metrics_helper)); |
151 | 153 |
152 cert_report_helper_.reset(new CertReportHelper( | 154 cert_report_helper_.reset(new CertReportHelper( |
153 ssl_cert_reporter.Pass(), web_contents, request_url, ssl_info, | 155 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, |
154 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, | 156 certificate_reporting::ErrorReport::INTERSTITIAL_SSL, overridable_, |
155 controller_->metrics_helper())); | 157 controller_->metrics_helper())); |
156 | 158 |
157 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, | 159 ssl_error_ui_.reset(new SSLErrorUI(request_url, cert_error, ssl_info, |
158 options_mask, time_triggered, languages, | 160 options_mask, time_triggered, languages, |
159 controller_.get())); | 161 controller_.get())); |
160 | 162 |
161 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 163 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
162 // it leaks memory, so don't create it here. | 164 // it leaks memory, so don't create it here. |
163 } | 165 } |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 sct_id, sct_and_status.status)); | 208 sct_id, sct_and_status.status)); |
207 } | 209 } |
208 | 210 |
209 entry->GetSSL() = | 211 entry->GetSSL() = |
210 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id, | 212 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id, |
211 sct_ids, ssl_info_); | 213 sct_ids, ssl_info_); |
212 } | 214 } |
213 | 215 |
214 void SSLBlockingPage::SetSSLCertReporterForTesting( | 216 void SSLBlockingPage::SetSSLCertReporterForTesting( |
215 scoped_ptr<SSLCertReporter> ssl_cert_reporter) { | 217 scoped_ptr<SSLCertReporter> ssl_cert_reporter) { |
216 cert_report_helper_->SetSSLCertReporterForTesting(ssl_cert_reporter.Pass()); | 218 cert_report_helper_->SetSSLCertReporterForTesting( |
| 219 std::move(ssl_cert_reporter)); |
217 } | 220 } |
218 | 221 |
219 // This handles the commands sent from the interstitial JavaScript. | 222 // This handles the commands sent from the interstitial JavaScript. |
220 void SSLBlockingPage::CommandReceived(const std::string& command) { | 223 void SSLBlockingPage::CommandReceived(const std::string& command) { |
221 if (command == "\"pageLoadComplete\"") { | 224 if (command == "\"pageLoadComplete\"") { |
222 // content::WaitForRenderFrameReady sends this message when the page | 225 // content::WaitForRenderFrameReady sends this message when the page |
223 // load completes. Ignore it. | 226 // load completes. Ignore it. |
224 return; | 227 return; |
225 } | 228 } |
226 | 229 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 278 |
276 // static | 279 // static |
277 bool SSLBlockingPage::IsOverridable(int options_mask, | 280 bool SSLBlockingPage::IsOverridable(int options_mask, |
278 const Profile* const profile) { | 281 const Profile* const profile) { |
279 const bool is_overridable = | 282 const bool is_overridable = |
280 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 283 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
281 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && | 284 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && |
282 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 285 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
283 return is_overridable; | 286 return is_overridable; |
284 } | 287 } |
OLD | NEW |