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

Side by Side Diff: chrome/browser/ssl/bad_clock_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: meacer comment 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
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/build_time.h" 9 #include "base/build_time.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 18 matching lines...) Expand all
29 #include "chrome/grit/generated_resources.h" 29 #include "chrome/grit/generated_resources.h"
30 #include "components/google/core/browser/google_util.h" 30 #include "components/google/core/browser/google_util.h"
31 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
32 #include "content/public/browser/cert_store.h" 32 #include "content/public/browser/cert_store.h"
33 #include "content/public/browser/interstitial_page.h" 33 #include "content/public/browser/interstitial_page.h"
34 #include "content/public/browser/interstitial_page_delegate.h" 34 #include "content/public/browser/interstitial_page_delegate.h"
35 #include "content/public/browser/navigation_controller.h" 35 #include "content/public/browser/navigation_controller.h"
36 #include "content/public/browser/navigation_entry.h" 36 #include "content/public/browser/navigation_entry.h"
37 #include "content/public/browser/render_process_host.h" 37 #include "content/public/browser/render_process_host.h"
38 #include "content/public/browser/render_view_host.h" 38 #include "content/public/browser/render_view_host.h"
39 #include "content/public/browser/signed_certificate_timestamp_store.h"
39 #include "content/public/browser/web_contents.h" 40 #include "content/public/browser/web_contents.h"
40 #include "content/public/common/renderer_preferences.h" 41 #include "content/public/common/renderer_preferences.h"
41 #include "content/public/common/ssl_status.h" 42 #include "content/public/common/ssl_status.h"
42 #include "grit/browser_resources.h" 43 #include "grit/browser_resources.h"
43 #include "grit/components_strings.h" 44 #include "grit/components_strings.h"
44 #include "net/base/net_errors.h" 45 #include "net/base/net_errors.h"
45 #include "net/base/net_util.h" 46 #include "net/base/net_util.h"
46 #include "ui/base/l10n/l10n_util.h" 47 #include "ui/base/l10n/l10n_util.h"
47 48
48 #if defined(OS_ANDROID) 49 #if defined(OS_ANDROID)
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 base::TimeFormatShortDate(ssl_info_.cert->valid_expiry())); 270 base::TimeFormatShortDate(ssl_info_.cert->valid_expiry()));
270 load_time_data->SetString("currentDate", 271 load_time_data->SetString("currentDate",
271 base::TimeFormatShortDate(time_triggered_)); 272 base::TimeFormatShortDate(time_triggered_));
272 std::vector<std::string> encoded_chain; 273 std::vector<std::string> encoded_chain;
273 ssl_info_.cert->GetPEMEncodedChain(&encoded_chain); 274 ssl_info_.cert->GetPEMEncodedChain(&encoded_chain);
274 load_time_data->SetString( 275 load_time_data->SetString(
275 "pem", base::JoinString(encoded_chain, base::StringPiece())); 276 "pem", base::JoinString(encoded_chain, base::StringPiece()));
276 } 277 }
277 278
278 void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) { 279 void BadClockBlockingPage::OverrideEntry(NavigationEntry* entry) {
279 int cert_id = content::CertStore::GetInstance()->StoreCert( 280 const int process_id = web_contents()->GetRenderProcessHost()->GetID();
280 ssl_info_.cert.get(), web_contents()->GetRenderProcessHost()->GetID()); 281 const int cert_id = content::CertStore::GetInstance()->StoreCert(
282 ssl_info_.cert.get(), process_id);
281 DCHECK(cert_id); 283 DCHECK(cert_id);
282 284
283 entry->GetSSL().security_style = 285 content::SignedCertificateTimestampStore* sct_store(
284 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; 286 content::SignedCertificateTimestampStore::GetInstance());
285 entry->GetSSL().cert_id = cert_id; 287 content::SignedCertificateTimestampIDStatusList sct_ids;
286 entry->GetSSL().cert_status = ssl_info_.cert_status; 288 for (const auto& sct_and_status : ssl_info_.signed_certificate_timestamps) {
287 entry->GetSSL().security_bits = ssl_info_.security_bits; 289 const int sct_id(sct_store->Store(sct_and_status.sct.get(), process_id));
290 DCHECK(sct_id);
291 sct_ids.push_back(content::SignedCertificateTimestampIDAndStatus(
292 sct_id, sct_and_status.status));
293 }
294
295 entry->GetSSL() =
296 content::SSLStatus(content::SECURITY_STYLE_AUTHENTICATION_BROKEN, cert_id,
297 sct_ids, ssl_info_);
288 } 298 }
289 299
290 // This handles the commands sent from the interstitial JavaScript. 300 // This handles the commands sent from the interstitial JavaScript.
291 // DO NOT reorder or change this logic without also changing the JavaScript! 301 // DO NOT reorder or change this logic without also changing the JavaScript!
292 void BadClockBlockingPage::CommandReceived(const std::string& command) { 302 void BadClockBlockingPage::CommandReceived(const std::string& command) {
293 if (command == "\"pageLoadComplete\"") { 303 if (command == "\"pageLoadComplete\"") {
294 // content::WaitForRenderFrameReady sends this message when the page 304 // content::WaitForRenderFrameReady sends this message when the page
295 // load completes. Ignore it. 305 // load completes. Ignore it.
296 return; 306 return;
297 } 307 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 355
346 void BadClockBlockingPage::NotifyDenyCertificate() { 356 void BadClockBlockingPage::NotifyDenyCertificate() {
347 // It's possible that callback_ may not exist if the user clicks "Proceed" 357 // It's possible that callback_ may not exist if the user clicks "Proceed"
348 // followed by pressing the back button before the interstitial is hidden. 358 // followed by pressing the back button before the interstitial is hidden.
349 // In that case the certificate will still be treated as allowed. 359 // In that case the certificate will still be treated as allowed.
350 if (callback_.is_null()) 360 if (callback_.is_null())
351 return; 361 return;
352 362
353 base::ResetAndReturn(&callback_).Run(false); 363 base::ResetAndReturn(&callback_).Run(false);
354 } 364 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698