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 "base/build_time.h" | 7 #include "base/build_time.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/string_piece.h" | 15 #include "base/strings/string_piece.h" |
16 #include "base/strings/string_util.h" | |
16 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
18 #include "base/time/time.h" | 19 #include "base/time/time.h" |
19 #include "base/values.h" | 20 #include "base/values.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
22 #include "chrome/browser/history/history_service_factory.h" | 23 #include "chrome/browser/history/history_service_factory.h" |
23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
24 #include "chrome/browser/renderer_preferences_util.h" | 25 #include "chrome/browser/renderer_preferences_util.h" |
25 #include "chrome/browser/ssl/ssl_error_classification.h" | 26 #include "chrome/browser/ssl/ssl_error_classification.h" |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 help_string = IDS_SSL_NONOVERRIDABLE_INVALID; | 505 help_string = IDS_SSL_NONOVERRIDABLE_INVALID; |
505 break; | 506 break; |
506 default: | 507 default: |
507 if (strict_enforcement_) | 508 if (strict_enforcement_) |
508 help_string = IDS_SSL_NONOVERRIDABLE_HSTS; | 509 help_string = IDS_SSL_NONOVERRIDABLE_HSTS; |
509 } | 510 } |
510 load_time_data.SetString( | 511 load_time_data.SetString( |
511 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); | 512 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); |
512 } | 513 } |
513 | 514 |
515 // Set debugging information at the bottom of the warning. | |
516 load_time_data.SetString( | |
517 "subject", ssl_info_.cert->subject().GetDisplayName()); | |
518 load_time_data.SetString( | |
519 "issuer", ssl_info_.cert->issuer().GetDisplayName()); | |
520 load_time_data.SetString( | |
521 "expirationDate", | |
522 base::TimeFormatShortDate(ssl_info_.cert->valid_expiry())); | |
523 load_time_data.SetString( | |
524 "currentDate", base::TimeFormatShortDate(now)); | |
525 std::vector<std::string> encoded_chain; | |
526 ssl_info_.cert->GetPEMEncodedChain(&encoded_chain); | |
527 load_time_data.SetString("pem", JoinString(encoded_chain, '\0')); | |
Bernhard Bauer
2014/09/22 09:13:27
Urr... does that actually work? JoinString does ha
felt
2014/09/22 16:29:02
Indeed it does work. I can't find the overload any
Bernhard Bauer
2014/09/22 19:19:27
https://code.google.com/p/chromium/codesearch#chro
felt
2014/09/22 20:25:49
Ohh I misunderstood. Fixed.
| |
528 | |
514 base::StringPiece html( | 529 base::StringPiece html( |
515 ResourceBundle::GetSharedInstance().GetRawDataResource( | 530 ResourceBundle::GetSharedInstance().GetRawDataResource( |
516 IRD_SECURITY_INTERSTITIAL_HTML)); | 531 IRD_SECURITY_INTERSTITIAL_HTML)); |
517 webui::UseVersion2 version; | 532 webui::UseVersion2 version; |
518 return webui::GetI18nTemplateHtml(html, &load_time_data); | 533 return webui::GetI18nTemplateHtml(html, &load_time_data); |
519 } | 534 } |
520 | 535 |
521 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 536 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
522 int cert_id = content::CertStore::GetInstance()->StoreCert( | 537 int cert_id = content::CertStore::GetInstance()->StoreCert( |
523 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); | 538 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 for (; i < 5; i++) { | 668 for (; i < 5; i++) { |
654 strings->SetString(keys[i], std::string()); | 669 strings->SetString(keys[i], std::string()); |
655 } | 670 } |
656 } | 671 } |
657 | 672 |
658 void SSLBlockingPage::OnGotHistoryCount(bool success, | 673 void SSLBlockingPage::OnGotHistoryCount(bool success, |
659 int num_visits, | 674 int num_visits, |
660 base::Time first_visit) { | 675 base::Time first_visit) { |
661 num_visits_ = num_visits; | 676 num_visits_ = num_visits; |
662 } | 677 } |
OLD | NEW |