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" |
11 #include "chrome/browser/interstitials/chrome_controller_client.h" | 11 #include "chrome/browser/interstitials/chrome_controller_client.h" |
12 #include "chrome/browser/interstitials/chrome_metrics_helper.h" | 12 #include "chrome/browser/interstitials/chrome_metrics_helper.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/renderer_preferences_util.h" | 14 #include "chrome/browser/renderer_preferences_util.h" |
15 #include "chrome/browser/ssl/cert_report_helper.h" | 15 #include "chrome/browser/ssl/cert_report_helper.h" |
16 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 16 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "components/prefs/pref_service.h" | 18 #include "components/prefs/pref_service.h" |
19 #include "components/security_interstitials/core/bad_clock_ui.h" | 19 #include "components/security_interstitials/core/bad_clock_ui.h" |
20 #include "components/security_interstitials/core/controller_client.h" | 20 #include "components/security_interstitials/core/controller_client.h" |
21 #include "components/security_interstitials/core/metrics_helper.h" | 21 #include "components/security_interstitials/core/metrics_helper.h" |
22 #include "components/ssl_errors/error_classification.h" | |
estark
2016/03/16 00:51:36
this #include isn't needed because you have it in
mab
2016/03/17 00:38:09
Done.
| |
22 #include "content/public/browser/cert_store.h" | 23 #include "content/public/browser/cert_store.h" |
23 #include "content/public/browser/interstitial_page.h" | 24 #include "content/public/browser/interstitial_page.h" |
24 #include "content/public/browser/interstitial_page_delegate.h" | 25 #include "content/public/browser/interstitial_page_delegate.h" |
25 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
26 #include "content/public/browser/navigation_entry.h" | 27 #include "content/public/browser/navigation_entry.h" |
27 #include "content/public/browser/render_process_host.h" | 28 #include "content/public/browser/render_process_host.h" |
28 #include "content/public/browser/render_view_host.h" | 29 #include "content/public/browser/render_view_host.h" |
29 #include "content/public/browser/signed_certificate_timestamp_store.h" | 30 #include "content/public/browser/signed_certificate_timestamp_store.h" |
30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
31 #include "content/public/common/renderer_preferences.h" | 32 #include "content/public/common/renderer_preferences.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
49 // Note that we always create a navigation entry with SSL errors. | 50 // Note that we always create a navigation entry with SSL errors. |
50 // No error happening loading a sub-resource triggers an interstitial so far. | 51 // No error happening loading a sub-resource triggers an interstitial so far. |
51 // Creating an interstitial without showing (e.g. from chrome://interstitials) | 52 // Creating an interstitial without showing (e.g. from chrome://interstitials) |
52 // it leaks memory, so don't create it here. | 53 // it leaks memory, so don't create it here. |
53 BadClockBlockingPage::BadClockBlockingPage( | 54 BadClockBlockingPage::BadClockBlockingPage( |
54 content::WebContents* web_contents, | 55 content::WebContents* web_contents, |
55 int cert_error, | 56 int cert_error, |
56 const net::SSLInfo& ssl_info, | 57 const net::SSLInfo& ssl_info, |
57 const GURL& request_url, | 58 const GURL& request_url, |
58 const base::Time& time_triggered, | 59 const base::Time& time_triggered, |
60 ssl_errors::ClockState clock_state, | |
59 scoped_ptr<SSLCertReporter> ssl_cert_reporter, | 61 scoped_ptr<SSLCertReporter> ssl_cert_reporter, |
60 const base::Callback<void(bool)>& callback) | 62 const base::Callback<void(bool)>& callback) |
61 : SecurityInterstitialPage(web_contents, request_url), | 63 : SecurityInterstitialPage(web_contents, request_url), |
62 callback_(callback), | 64 callback_(callback), |
63 ssl_info_(ssl_info), | 65 ssl_info_(ssl_info), |
64 time_triggered_(time_triggered), | 66 time_triggered_(time_triggered), |
65 controller_(new ChromeControllerClient(web_contents)) { | 67 controller_(new ChromeControllerClient(web_contents)) { |
66 // Get the language for the BadClockUI. | 68 // Get the language for the BadClockUI. |
67 std::string languages; | 69 std::string languages; |
68 Profile* profile = | 70 Profile* profile = |
(...skipping 10 matching lines...) Expand all Loading... | |
79 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper( | 81 scoped_ptr<security_interstitials::MetricsHelper> metrics_helper( |
80 chrome_metrics_helper); | 82 chrome_metrics_helper); |
81 controller_->set_metrics_helper(std::move(metrics_helper)); | 83 controller_->set_metrics_helper(std::move(metrics_helper)); |
82 | 84 |
83 cert_report_helper_.reset(new CertReportHelper( | 85 cert_report_helper_.reset(new CertReportHelper( |
84 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, | 86 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, |
85 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, | 87 certificate_reporting::ErrorReport::INTERSTITIAL_CLOCK, |
86 false /* overridable */, controller_->metrics_helper())); | 88 false /* overridable */, controller_->metrics_helper())); |
87 | 89 |
88 bad_clock_ui_.reset(new security_interstitials::BadClockUI( | 90 bad_clock_ui_.reset(new security_interstitials::BadClockUI( |
89 request_url, cert_error, ssl_info, time_triggered, languages, | 91 request_url, cert_error, ssl_info, time_triggered, clock_state, languages, |
90 controller_.get())); | 92 controller_.get())); |
91 } | 93 } |
92 | 94 |
93 BadClockBlockingPage::~BadClockBlockingPage() { | 95 BadClockBlockingPage::~BadClockBlockingPage() { |
94 if (!callback_.is_null()) { | 96 if (!callback_.is_null()) { |
95 // Deny when the page is closed. | 97 // Deny when the page is closed. |
96 NotifyDenyCertificate(); | 98 NotifyDenyCertificate(); |
97 } | 99 } |
98 } | 100 } |
99 | 101 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
175 | 177 |
176 void BadClockBlockingPage::NotifyDenyCertificate() { | 178 void BadClockBlockingPage::NotifyDenyCertificate() { |
177 // It's possible that callback_ may not exist if the user clicks "Proceed" | 179 // 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. | 180 // followed by pressing the back button before the interstitial is hidden. |
179 // In that case the certificate will still be treated as allowed. | 181 // In that case the certificate will still be treated as allowed. |
180 if (callback_.is_null()) | 182 if (callback_.is_null()) |
181 return; | 183 return; |
182 | 184 |
183 base::ResetAndReturn(&callback_).Run(false); | 185 base::ResetAndReturn(&callback_).Run(false); |
184 } | 186 } |
OLD | NEW |