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" |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
568 load_time_data.SetString("trialCondition", trial_condition_); | 568 load_time_data.SetString("trialCondition", trial_condition_); |
569 | 569 |
570 // Shared values for both the overridable and non-overridable versions. | 570 // Shared values for both the overridable and non-overridable versions. |
571 load_time_data.SetBoolean("ssl", true); | 571 load_time_data.SetBoolean("ssl", true); |
572 load_time_data.SetBoolean( | 572 load_time_data.SetBoolean( |
573 "overridable", overridable_ && !strict_enforcement_); | 573 "overridable", overridable_ && !strict_enforcement_); |
574 load_time_data.SetString( | 574 load_time_data.SetString( |
575 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); | 575 "tabTitle", l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); |
576 load_time_data.SetString( | 576 load_time_data.SetString( |
577 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); | 577 "heading", l10n_util::GetStringUTF16(IDS_SSL_V2_HEADING)); |
578 if ((SSLErrorClassification::IsUserClockInThePast( | 578 |
579 base::Time::NowFromSystemTime())) | 579 base::Time now = base::Time::NowFromSystemTime(); |
580 if ((SSLErrorClassification::IsUserClockInThePast(now) || | |
581 SSLErrorClassification::IsUserClockInTheFuture(now)) | |
580 && (SSLErrorInfo::NetErrorToErrorType(cert_error_) == | 582 && (SSLErrorInfo::NetErrorToErrorType(cert_error_) == |
581 SSLErrorInfo::CERT_DATE_INVALID)) { | 583 SSLErrorInfo::CERT_DATE_INVALID)) { |
582 load_time_data.SetString("primaryParagraph", | 584 load_time_data.SetString("primaryParagraph", |
583 l10n_util::GetStringFUTF16( | 585 l10n_util::GetStringFUTF16( |
584 IDS_SSL_CLOCK_ERROR, | 586 IDS_SSL_CLOCK_ERROR, |
585 url, | 587 url, |
586 base::TimeFormatShortDate(base::Time::Now()))); | 588 base::TimeFormatShortDate(now))); |
589 if (overridable_ && !strict_enforcement_) { | |
590 load_time_data.SetString( | |
591 "finalParagraph", | |
592 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, | |
593 url)); | |
594 load_time_data.SetString( | |
595 "primaryButtonText", | |
596 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); | |
597 } else { | |
598 load_time_data.SetString( | |
599 "primaryButtonText", | |
600 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); | |
601 } | |
602 | |
603 base::StringPiece html( | |
604 ResourceBundle::GetSharedInstance().GetRawDataResource( | |
605 IRD_SSL_INTERSTITIAL_V2_HTML)); | |
606 return webui::GetI18nTemplateHtml(html, &load_time_data); | |
587 } else { | 607 } else { |
588 load_time_data.SetString( | 608 load_time_data.SetString( |
589 "primaryParagraph", | 609 "primaryParagraph", |
590 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); | 610 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); |
591 } | 611 } |
592 load_time_data.SetString( | 612 load_time_data.SetString( |
593 "openDetails", | 613 "openDetails", |
594 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); | 614 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); |
595 load_time_data.SetString( | 615 load_time_data.SetString( |
596 "closeDetails", | 616 "closeDetails", |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 if (strict_enforcement_) | 668 if (strict_enforcement_) |
649 help_string = IDS_SSL_NONOVERRIDABLE_HSTS; | 669 help_string = IDS_SSL_NONOVERRIDABLE_HSTS; |
650 } | 670 } |
651 load_time_data.SetString( | 671 load_time_data.SetString( |
652 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); | 672 "finalParagraph", l10n_util::GetStringFUTF16(help_string, url)); |
653 } | 673 } |
654 | 674 |
655 base::StringPiece html( | 675 base::StringPiece html( |
656 ResourceBundle::GetSharedInstance().GetRawDataResource( | 676 ResourceBundle::GetSharedInstance().GetRawDataResource( |
657 IRD_SSL_INTERSTITIAL_V2_HTML)); | 677 IRD_SSL_INTERSTITIAL_V2_HTML)); |
678 // TODO(palmer): Is this line dead code? | |
felt
2014/08/07 18:09:09
No. For some bizarre reason webui depends on this.
| |
658 webui::UseVersion2 version; | 679 webui::UseVersion2 version; |
659 return webui::GetI18nTemplateHtml(html, &load_time_data); | 680 return webui::GetI18nTemplateHtml(html, &load_time_data); |
660 } | 681 } |
661 | 682 |
662 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 683 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
663 int cert_id = content::CertStore::GetInstance()->StoreCert( | 684 int cert_id = content::CertStore::GetInstance()->StoreCert( |
664 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); | 685 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
665 DCHECK(cert_id); | 686 DCHECK(cert_id); |
666 | 687 |
667 entry->GetSSL().security_style = | 688 entry->GetSSL().security_style = |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
811 // sure we don't clear the captive portal flag, since the interstitial was | 832 // sure we don't clear the captive portal flag, since the interstitial was |
812 // potentially caused by the captive portal. | 833 // potentially caused by the captive portal. |
813 captive_portal_detected_ = captive_portal_detected_ || | 834 captive_portal_detected_ = captive_portal_detected_ || |
814 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 835 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
815 // Also keep track of non-HTTP portals and error cases. | 836 // Also keep track of non-HTTP portals and error cases. |
816 captive_portal_no_response_ = captive_portal_no_response_ || | 837 captive_portal_no_response_ = captive_portal_no_response_ || |
817 (results->result == captive_portal::RESULT_NO_RESPONSE); | 838 (results->result == captive_portal::RESULT_NO_RESPONSE); |
818 } | 839 } |
819 #endif | 840 #endif |
820 } | 841 } |
OLD | NEW |