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