Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(809)

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 1332633002: Add constructor to create SSLStatus from SSLInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: temp: debug logging for mac/win test failure Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 25 matching lines...) Expand all
36 #include "content/public/browser/browser_thread.h" 36 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/cert_store.h" 37 #include "content/public/browser/cert_store.h"
38 #include "content/public/browser/interstitial_page.h" 38 #include "content/public/browser/interstitial_page.h"
39 #include "content/public/browser/interstitial_page_delegate.h" 39 #include "content/public/browser/interstitial_page_delegate.h"
40 #include "content/public/browser/navigation_controller.h" 40 #include "content/public/browser/navigation_controller.h"
41 #include "content/public/browser/navigation_entry.h" 41 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/notification_service.h" 42 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/notification_types.h" 43 #include "content/public/browser/notification_types.h"
44 #include "content/public/browser/render_process_host.h" 44 #include "content/public/browser/render_process_host.h"
45 #include "content/public/browser/render_view_host.h" 45 #include "content/public/browser/render_view_host.h"
46 #include "content/public/browser/signed_certificate_timestamp_store.h"
46 #include "content/public/browser/web_contents.h" 47 #include "content/public/browser/web_contents.h"
47 #include "content/public/common/renderer_preferences.h" 48 #include "content/public/common/renderer_preferences.h"
48 #include "content/public/common/ssl_status.h" 49 #include "content/public/common/ssl_status.h"
49 #include "grit/browser_resources.h" 50 #include "grit/browser_resources.h"
50 #include "grit/components_strings.h" 51 #include "grit/components_strings.h"
51 #include "net/base/hash_value.h" 52 #include "net/base/hash_value.h"
52 #include "net/base/net_errors.h" 53 #include "net/base/net_errors.h"
53 #include "net/base/net_util.h" 54 #include "net/base/net_util.h"
54 #include "ui/base/l10n/l10n_util.h" 55 #include "ui/base/l10n/l10n_util.h"
55 56
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 std::vector<std::string> encoded_chain; 284 std::vector<std::string> encoded_chain;
284 ssl_info_.cert->GetPEMEncodedChain( 285 ssl_info_.cert->GetPEMEncodedChain(
285 &encoded_chain); 286 &encoded_chain);
286 load_time_data->SetString( 287 load_time_data->SetString(
287 "pem", base::JoinString(encoded_chain, base::StringPiece())); 288 "pem", base::JoinString(encoded_chain, base::StringPiece()));
288 289
289 cert_report_helper_->PopulateExtendedReportingOption(load_time_data); 290 cert_report_helper_->PopulateExtendedReportingOption(load_time_data);
290 } 291 }
291 292
292 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { 293 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) {
294 int process_id = web_contents()->GetRenderProcessHost()->GetID();
293 int cert_id = content::CertStore::GetInstance()->StoreCert( 295 int cert_id = content::CertStore::GetInstance()->StoreCert(
meacer 2015/09/09 18:26:07 nit: const?
estark 2015/09/10 14:32:05 Done.
294 ssl_info_.cert.get(), web_contents()->GetRenderProcessHost()->GetID()); 296 ssl_info_.cert.get(), process_id);
295 DCHECK(cert_id); 297 DCHECK(cert_id);
296 298
297 entry->GetSSL().security_style = 299 content::SignedCertificateTimestampStore* sct_store(
298 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; 300 content::SignedCertificateTimestampStore::GetInstance());
299 entry->GetSSL().cert_id = cert_id; 301 content::SignedCertificateTimestampIDStatusList sct_ids;
300 entry->GetSSL().cert_status = ssl_info_.cert_status; 302 for (const auto& sct_and_status : ssl_info_.signed_certificate_timestamps) {
301 entry->GetSSL().security_bits = ssl_info_.security_bits; 303 const int sct_id(sct_store->Store(sct_and_status.sct.get(), process_id));
304 DCHECK(sct_id);
305 sct_ids.push_back(content::SignedCertificateTimestampIDAndStatus(
306 sct_id, sct_and_status.status));
307 }
308
309 entry->GetSSL() =
310 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id,
311 sct_ids, ssl_info_);
302 } 312 }
303 313
304 void SSLBlockingPage::SetSSLCertReporterForTesting( 314 void SSLBlockingPage::SetSSLCertReporterForTesting(
305 scoped_ptr<SSLCertReporter> ssl_cert_reporter) { 315 scoped_ptr<SSLCertReporter> ssl_cert_reporter) {
306 cert_report_helper_->SetSSLCertReporterForTesting(ssl_cert_reporter.Pass()); 316 cert_report_helper_->SetSSLCertReporterForTesting(ssl_cert_reporter.Pass());
307 } 317 }
308 318
309 // This handles the commands sent from the interstitial JavaScript. 319 // This handles the commands sent from the interstitial JavaScript.
310 // DO NOT reorder or change this logic without also changing the JavaScript! 320 // DO NOT reorder or change this logic without also changing the JavaScript!
311 void SSLBlockingPage::CommandReceived(const std::string& command) { 321 void SSLBlockingPage::CommandReceived(const std::string& command) {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) && 455 !(options_mask & SSLBlockingPage::STRICT_ENFORCEMENT) &&
446 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 456 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
447 return is_overridable; 457 return is_overridable;
448 } 458 }
449 459
450 // static 460 // static
451 bool SSLBlockingPage::DoesPolicyAllowDangerOverride( 461 bool SSLBlockingPage::DoesPolicyAllowDangerOverride(
452 const Profile* const profile) { 462 const Profile* const profile) {
453 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 463 return profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
454 } 464 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698