| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bad_clock_blocking_page.h" | 5 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 48 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
| 49 // it leaks memory, so don't create it here. | 49 // it leaks memory, so don't create it here. |
| 50 BadClockBlockingPage::BadClockBlockingPage( | 50 BadClockBlockingPage::BadClockBlockingPage( |
| 51 content::WebContents* web_contents, | 51 content::WebContents* web_contents, |
| 52 int cert_error, | 52 int cert_error, |
| 53 const net::SSLInfo& ssl_info, | 53 const net::SSLInfo& ssl_info, |
| 54 const GURL& request_url, | 54 const GURL& request_url, |
| 55 const base::Time& time_triggered, | 55 const base::Time& time_triggered, |
| 56 ssl_errors::ClockState clock_state, | 56 ssl_errors::ClockState clock_state, |
| 57 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, | 57 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, |
| 58 const base::Callback<void(bool)>& callback) | 58 const base::Callback<void(content::CertificateRequestResultType)>& callback) |
| 59 : SecurityInterstitialPage(web_contents, request_url), | 59 : SecurityInterstitialPage(web_contents, request_url), |
| 60 callback_(callback), | 60 callback_(callback), |
| 61 ssl_info_(ssl_info), | 61 ssl_info_(ssl_info), |
| 62 time_triggered_(time_triggered), | 62 time_triggered_(time_triggered), |
| 63 controller_(new ChromeControllerClient(web_contents)) { | 63 controller_(new ChromeControllerClient(web_contents)) { |
| 64 // Set up the metrics helper for the BadClockUI. | 64 // Set up the metrics helper for the BadClockUI. |
| 65 security_interstitials::MetricsHelper::ReportDetails reporting_info; | 65 security_interstitials::MetricsHelper::ReportDetails reporting_info; |
| 66 reporting_info.metric_prefix = kMetricsName; | 66 reporting_info.metric_prefix = kMetricsName; |
| 67 ChromeMetricsHelper* chrome_metrics_helper = new ChromeMetricsHelper( | 67 ChromeMetricsHelper* chrome_metrics_helper = new ChromeMetricsHelper( |
| 68 web_contents, request_url, reporting_info, kMetricsName); | 68 web_contents, request_url, reporting_info, kMetricsName); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 NotifyDenyCertificate(); | 153 NotifyDenyCertificate(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void BadClockBlockingPage::NotifyDenyCertificate() { | 156 void BadClockBlockingPage::NotifyDenyCertificate() { |
| 157 // It's possible that callback_ may not exist if the user clicks "Proceed" | 157 // It's possible that callback_ may not exist if the user clicks "Proceed" |
| 158 // followed by pressing the back button before the interstitial is hidden. | 158 // followed by pressing the back button before the interstitial is hidden. |
| 159 // In that case the certificate will still be treated as allowed. | 159 // In that case the certificate will still be treated as allowed. |
| 160 if (callback_.is_null()) | 160 if (callback_.is_null()) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 base::ResetAndReturn(&callback_).Run(false); | 163 base::ResetAndReturn(&callback_) |
| 164 .Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL); |
| 164 } | 165 } |
| OLD | NEW |