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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 // Note that we always create a navigation entry with SSL errors. | 49 // Note that we always create a navigation entry with SSL errors. |
50 // No error happening loading a sub-resource triggers an interstitial so far. | 50 // No error happening loading a sub-resource triggers an interstitial so far. |
51 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 51 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
52 // it leaks memory, so don't create it here. | 52 // it leaks memory, so don't create it here. |
53 BadClockBlockingPage::BadClockBlockingPage( | 53 BadClockBlockingPage::BadClockBlockingPage( |
54 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
55 int cert_error, | 55 int cert_error, |
56 const net::SSLInfo& ssl_info, | 56 const net::SSLInfo& ssl_info, |
57 const GURL& request_url, | 57 const GURL& request_url, |
58 const base::Time& time_triggered, | 58 const base::Time& time_triggered, |
| 59 ssl_errors::ClockState clock_state, |
59 scoped_ptr<SSLCertReporter> ssl_cert_reporter, | 60 scoped_ptr<SSLCertReporter> ssl_cert_reporter, |
60 const base::Callback<void(bool)>& callback) | 61 const base::Callback<void(bool)>& callback) |
61 : SecurityInterstitialPage(web_contents, request_url), | 62 : SecurityInterstitialPage(web_contents, request_url), |
62 callback_(callback), | 63 callback_(callback), |
63 ssl_info_(ssl_info), | 64 ssl_info_(ssl_info), |
64 time_triggered_(time_triggered), | 65 time_triggered_(time_triggered), |
65 controller_(new ChromeControllerClient(web_contents)) { | 66 controller_(new ChromeControllerClient(web_contents)) { |
66 // Get the language for the BadClockUI. | 67 // Get the language for the BadClockUI. |
67 std::string languages; | 68 std::string languages; |
68 Profile* profile = | 69 Profile* profile = |
(...skipping 10 matching lines...) Expand all Loading... |
79 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper( | 80 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper( |
80 chrome_metrics_helper); | 81 chrome_metrics_helper); |
81 controller_->set_metrics_helper(std::move(metrics_helper)); | 82 controller_->set_metrics_helper(std::move(metrics_helper)); |
82 | 83 |
83 cert_report_helper_.reset(new CertReportHelper( | 84 cert_report_helper_.reset(new CertReportHelper( |
84 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, | 85 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, |
85 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, | 86 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, |
86 false /* overridable */, controller_->metrics_helper())); | 87 false /* overridable */, controller_->metrics_helper())); |
87 | 88 |
88 bad_clock_ui_.reset(new security_interstitials::BadClockUI( | 89 bad_clock_ui_.reset(new security_interstitials::BadClockUI( |
89 request_url, cert_error, ssl_info, time_triggered, languages, | 90 request_url, cert_error, ssl_info, time_triggered, clock_state, languages, |
90 controller_.get())); | 91 controller_.get())); |
91 } | 92 } |
92 | 93 |
93 BadClockBlockingPage::~BadClockBlockingPage() { | 94 BadClockBlockingPage::~BadClockBlockingPage() { |
94 if (!callback_.is_null()) { | 95 if (!callback_.is_null()) { |
95 // Deny when the page is closed. | 96 // Deny when the page is closed. |
96 NotifyDenyCertificate(); | 97 NotifyDenyCertificate(); |
97 } | 98 } |
98 } | 99 } |
99 | 100 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 | 176 |
176 void BadClockBlockingPage::NotifyDenyCertificate() { | 177 void BadClockBlockingPage::NotifyDenyCertificate() { |
177 // It's possible that callback_ may not exist if the user clicks "Proceed" | 178 // It's possible that callback_ may not exist if the user clicks "Proceed" |
178 // followed by pressing the back button before the interstitial is hidden. | 179 // followed by pressing the back button before the interstitial is hidden. |
179 // In that case the certificate will still be treated as allowed. | 180 // In that case the certificate will still be treated as allowed. |
180 if (callback_.is_null()) | 181 if (callback_.is_null()) |
181 return; | 182 return; |
182 | 183 |
183 base::ResetAndReturn(&callback_).Run(false); | 184 base::ResetAndReturn(&callback_).Run(false); |
184 } | 185 } |
OLD | NEW |