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

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

Issue 1772603002: Addition of Certificate Transparency details to Security panel of DevTools (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed SignedCertificateTimestampStore and SignedCertificateTimestampIDStatus(List) Created 4 years, 9 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 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 "content/public/browser/cert_store.h" 22 #include "content/public/browser/cert_store.h"
23 #include "content/public/browser/interstitial_page.h" 23 #include "content/public/browser/interstitial_page.h"
24 #include "content/public/browser/interstitial_page_delegate.h" 24 #include "content/public/browser/interstitial_page_delegate.h"
25 #include "content/public/browser/navigation_controller.h" 25 #include "content/public/browser/navigation_controller.h"
26 #include "content/public/browser/navigation_entry.h" 26 #include "content/public/browser/navigation_entry.h"
27 #include "content/public/browser/render_process_host.h" 27 #include "content/public/browser/render_process_host.h"
28 #include "content/public/browser/render_view_host.h" 28 #include "content/public/browser/render_view_host.h"
29 #include "content/public/browser/signed_certificate_timestamp_store.h"
30 #include "content/public/browser/web_contents.h" 29 #include "content/public/browser/web_contents.h"
31 #include "content/public/common/renderer_preferences.h" 30 #include "content/public/common/renderer_preferences.h"
32 #include "content/public/common/ssl_status.h" 31 #include "content/public/common/ssl_status.h"
33 #include "net/base/net_errors.h" 32 #include "net/base/net_errors.h"
34 33
35 using content::InterstitialPageDelegate; 34 using content::InterstitialPageDelegate;
36 using content::NavigationController; 35 using content::NavigationController;
37 using content::NavigationEntry; 36 using content::NavigationEntry;
38 37
39 namespace { 38 namespace {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bad_clock_ui_->PopulateStringsForHTML(load_time_data); 114 bad_clock_ui_->PopulateStringsForHTML(load_time_data);
116 cert_report_helper_->PopulateExtendedReportingOption(load_time_data); 115 cert_report_helper_->PopulateExtendedReportingOption(load_time_data);
117 } 116 }
118 117
119 void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) { 118 void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) {
120 const int process_id = web_contents()->GetRenderProcessHost()->GetID(); 119 const int process_id = web_contents()->GetRenderProcessHost()->GetID();
121 const int cert_id = content::CertStore::GetInstance()->StoreCert( 120 const int cert_id = content::CertStore::GetInstance()->StoreCert(
122 ssl_info_.cert.get(), process_id); 121 ssl_info_.cert.get(), process_id);
123 DCHECK(cert_id); 122 DCHECK(cert_id);
124 123
125 content::SignedCertificateTimestampStore* sct_store(
126 content::SignedCertificateTimestampStore::GetInstance());
127 content::SignedCertificateTimestampIDStatusList sct_ids;
128 for (const auto& sct_and_status : ssl_info_.signed_certificate_timestamps) {
129 const int sct_id(sct_store->Store(sct_and_status.sct.get(), process_id));
130 DCHECK(sct_id);
131 sct_ids.push_back(content::SignedCertificateTimestampIDAndStatus(
132 sct_id, sct_and_status.status));
133 }
134
135 entry->GetSSL() = 124 entry->GetSSL() =
136 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id, 125 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id,
137 sct_ids, ssl_info_); 126 ssl_info_);
138 } 127 }
139 128
140 void BadClockBlockingPage::SetSSLCertReporterForTesting( 129 void BadClockBlockingPage::SetSSLCertReporterForTesting(
141 scoped_ptr<SSLCertReporter> ssl_cert_reporter) { 130 scoped_ptr<SSLCertReporter> ssl_cert_reporter) {
142 cert_report_helper_->SetSSLCertReporterForTesting( 131 cert_report_helper_->SetSSLCertReporterForTesting(
143 std::move(ssl_cert_reporter)); 132 std::move(ssl_cert_reporter));
144 } 133 }
145 134
146 // This handles the commands sent from the interstitial JavaScript. 135 // This handles the commands sent from the interstitial JavaScript.
147 void BadClockBlockingPage::CommandReceived(const std::string& command) { 136 void BadClockBlockingPage::CommandReceived(const std::string& command) {
(...skipping 27 matching lines...) Expand all
175 164
176 void BadClockBlockingPage::NotifyDenyCertificate() { 165 void BadClockBlockingPage::NotifyDenyCertificate() {
177 // It's possible that callback_ may not exist if the user clicks "Proceed" 166 // 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. 167 // followed by pressing the back button before the interstitial is hidden.
179 // In that case the certificate will still be treated as allowed. 168 // In that case the certificate will still be treated as allowed.
180 if (callback_.is_null()) 169 if (callback_.is_null())
181 return; 170 return;
182 171
183 base::ResetAndReturn(&callback_).Run(false); 172 base::ResetAndReturn(&callback_).Run(false);
184 } 173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698