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> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
25 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
26 #include "components/security_interstitials/core/controller_client.h" | 26 #include "components/security_interstitials/core/controller_client.h" |
27 #include "components/security_interstitials/core/metrics_helper.h" | 27 #include "components/security_interstitials/core/metrics_helper.h" |
28 #include "components/security_interstitials/core/ssl_error_ui.h" | 28 #include "components/security_interstitials/core/ssl_error_ui.h" |
29 #include "content/public/browser/cert_store.h" | 29 #include "content/public/browser/cert_store.h" |
30 #include "content/public/browser/interstitial_page.h" | 30 #include "content/public/browser/interstitial_page.h" |
31 #include "content/public/browser/interstitial_page_delegate.h" | 31 #include "content/public/browser/interstitial_page_delegate.h" |
32 #include "content/public/browser/navigation_entry.h" | 32 #include "content/public/browser/navigation_entry.h" |
33 #include "content/public/browser/render_process_host.h" | 33 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/signed_certificate_timestamp_store.h" | |
35 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
36 #include "content/public/common/renderer_preferences.h" | 35 #include "content/public/common/renderer_preferences.h" |
37 #include "content/public/common/ssl_status.h" | 36 #include "content/public/common/ssl_status.h" |
38 #include "net/base/net_errors.h" | 37 #include "net/base/net_errors.h" |
39 | 38 |
40 using base::TimeTicks; | 39 using base::TimeTicks; |
41 using content::InterstitialPage; | 40 using content::InterstitialPage; |
42 using content::InterstitialPageDelegate; | 41 using content::InterstitialPageDelegate; |
43 using content::NavigationEntry; | 42 using content::NavigationEntry; |
44 using security_interstitials::SSLErrorUI; | 43 using security_interstitials::SSLErrorUI; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 ssl_error_ui_->PopulateStringsForHTML(load_time_data); | 188 ssl_error_ui_->PopulateStringsForHTML(load_time_data); |
190 cert_report_helper_->PopulateExtendedReportingOption(load_time_data); | 189 cert_report_helper_->PopulateExtendedReportingOption(load_time_data); |
191 } | 190 } |
192 | 191 |
193 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 192 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
194 const int process_id = web_contents()->GetRenderProcessHost()->GetID(); | 193 const int process_id = web_contents()->GetRenderProcessHost()->GetID(); |
195 const int cert_id = content::CertStore::GetInstance()->StoreCert( | 194 const int cert_id = content::CertStore::GetInstance()->StoreCert( |
196 ssl_info_.cert.get(), process_id); | 195 ssl_info_.cert.get(), process_id); |
197 DCHECK(cert_id); | 196 DCHECK(cert_id); |
198 | 197 |
199 content::SignedCertificateTimestampStore* sct_store( | |
200 content::SignedCertificateTimestampStore::GetInstance()); | |
201 content::SignedCertificateTimestampIDStatusList sct_ids; | |
202 for (const auto& sct_and_status : ssl_info_.signed_certificate_timestamps) { | |
203 const int sct_id(sct_store->Store(sct_and_status.sct.get(), process_id)); | |
204 DCHECK(sct_id); | |
205 sct_ids.push_back(content::SignedCertificateTimestampIDAndStatus( | |
206 sct_id, sct_and_status.status)); | |
207 } | |
208 | |
209 entry->GetSSL() = | 198 entry->GetSSL() = |
210 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id, | 199 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id, |
211 sct_ids, ssl_info_); | 200 ssl_info_); |
212 } | 201 } |
213 | 202 |
214 void SSLBlockingPage::SetSSLCertReporterForTesting( | 203 void SSLBlockingPage::SetSSLCertReporterForTesting( |
215 std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { | 204 std::unique_ptr<SSLCertReporter> ssl_cert_reporter) { |
216 cert_report_helper_->SetSSLCertReporterForTesting( | 205 cert_report_helper_->SetSSLCertReporterForTesting( |
217 std::move(ssl_cert_reporter)); | 206 std::move(ssl_cert_reporter)); |
218 } | 207 } |
219 | 208 |
220 // This handles the commands sent from the interstitial JavaScript. | 209 // This handles the commands sent from the interstitial JavaScript. |
221 void SSLBlockingPage::CommandReceived(const std::string& command) { | 210 void SSLBlockingPage::CommandReceived(const std::string& command) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 265 |
277 // static | 266 // static |
278 bool SSLBlockingPage::IsOverridable(int options_mask, | 267 bool SSLBlockingPage::IsOverridable(int options_mask, |
279 const Profile* const profile) { | 268 const Profile* const profile) { |
280 const bool is_overridable = | 269 const bool is_overridable = |
281 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 270 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
282 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && | 271 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && |
283 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); | 272 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); |
284 return is_overridable; | 273 return is_overridable; |
285 } | 274 } |
OLD | NEW |