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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
535 load_time_data.SetString( | 535 load_time_data.SetString( |
536 "primaryParagraph", | 536 "primaryParagraph", |
537 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); | 537 l10n_util::GetStringFUTF16(IDS_SSL_V2_PRIMARY_PARAGRAPH, url)); |
538 } | 538 } |
539 load_time_data.SetString( | 539 load_time_data.SetString( |
540 "openDetails", | 540 "openDetails", |
541 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); | 541 l10n_util::GetStringUTF16(IDS_SSL_V2_OPEN_DETAILS_BUTTON)); |
542 load_time_data.SetString( | 542 load_time_data.SetString( |
543 "closeDetails", | 543 "closeDetails", |
544 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); | 544 l10n_util::GetStringUTF16(IDS_SSL_V2_CLOSE_DETAILS_BUTTON)); |
545 | |
felt
2014/06/30 18:16:07
any particular reason why you're deleting this lin
radhikabhar
2014/07/02 18:51:08
Done.
| |
546 if (overridable_ && !strict_enforcement_) { // Overridable. | 545 if (overridable_ && !strict_enforcement_) { // Overridable. |
547 SSLErrorInfo error_info = | 546 SSLErrorInfo error_info = |
548 SSLErrorInfo::CreateError( | 547 SSLErrorInfo::CreateError( |
549 SSLErrorInfo::NetErrorToErrorType(cert_error_), | 548 SSLErrorInfo::NetErrorToErrorType(cert_error_), |
550 ssl_info_.cert.get(), | 549 ssl_info_.cert.get(), |
551 request_url_); | 550 request_url_); |
552 load_time_data.SetString( | 551 load_time_data.SetString( |
553 "explanationParagraph", error_info.details()); | 552 "explanationParagraph", error_info.details()); |
554 load_time_data.SetString( | 553 load_time_data.SetString( |
555 "primaryButtonText", | 554 "primaryButtonText", |
556 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); | 555 l10n_util::GetStringUTF16(IDS_SSL_OVERRIDABLE_SAFETY_BUTTON)); |
557 load_time_data.SetString( | 556 load_time_data.SetString( |
558 "finalParagraph", | 557 "finalParagraph", |
559 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url)); | 558 l10n_util::GetStringFUTF16(IDS_SSL_OVERRIDABLE_PROCEED_PARAGRAPH, url)); |
560 } else { // Non-overridable. | 559 } else { // Non-overridable. |
561 load_time_data.SetBoolean("overridable", false); | 560 load_time_data.SetBoolean("overridable", false); |
562 load_time_data.SetString( | 561 SSLErrorInfo::ErrorType type = |
563 "explanationParagraph", | 562 SSLErrorInfo::NetErrorToErrorType(cert_error_); |
564 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url)); | 563 if (type == SSLErrorInfo::CERT_INVALID) { |
felt
2014/06/30 18:16:07
it seems like this would be simpler as:
if (type
radhikabhar
2014/07/01 23:56:49
Done.
| |
564 load_time_data.SetString( | |
565 "explanationParagraph", | |
566 WindowsVersionSP3Lower() ? | |
567 l10n_util::GetStringFUTF16( | |
568 IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3,url) : | |
felt
2014/06/30 18:16:07
nit: you need a space here
IDS_SSL_NONOVERRIDABLE
radhikabhar
2014/07/01 23:56:49
Done.
| |
569 l10n_util::GetStringFUTF16( | |
570 IDS_SSL_NONOVERRIDABLE_MORE, url)); | |
571 } else { | |
572 load_time_data.SetString("explanationParagraph", | |
573 l10n_util::GetStringFUTF16( | |
574 IDS_SSL_NONOVERRIDABLE_MORE, url)); | |
575 } | |
565 load_time_data.SetString( | 576 load_time_data.SetString( |
566 "primaryButtonText", | 577 "primaryButtonText", |
567 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); | 578 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); |
568 // Customize the help link depending on the specific error type. | 579 // Customize the help link depending on the specific error type. |
569 // Only mark as HSTS if none of the more specific error types apply, and use | 580 // Only mark as HSTS if none of the more specific error types apply, and use |
570 // INVALID as a fallback if no other string is appropriate. | 581 // INVALID as a fallback if no other string is appropriate. |
571 SSLErrorInfo::ErrorType type = | |
572 SSLErrorInfo::NetErrorToErrorType(cert_error_); | |
573 load_time_data.SetInteger("errorType", type); | 582 load_time_data.SetInteger("errorType", type); |
574 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; | 583 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; |
575 switch (type) { | 584 switch (type) { |
576 case SSLErrorInfo::CERT_REVOKED: | 585 case SSLErrorInfo::CERT_REVOKED: |
577 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; | 586 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; |
578 break; | 587 break; |
579 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: | 588 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: |
580 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; | 589 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; |
581 break; | 590 break; |
582 case SSLErrorInfo::CERT_INVALID: | 591 case SSLErrorInfo::CERT_INVALID: |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
753 // sure we don't clear the captive portal flag, since the interstitial was | 762 // sure we don't clear the captive portal flag, since the interstitial was |
754 // potentially caused by the captive portal. | 763 // potentially caused by the captive portal. |
755 captive_portal_detected_ = captive_portal_detected_ || | 764 captive_portal_detected_ = captive_portal_detected_ || |
756 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 765 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
757 // Also keep track of non-HTTP portals and error cases. | 766 // Also keep track of non-HTTP portals and error cases. |
758 captive_portal_no_response_ = captive_portal_no_response_ || | 767 captive_portal_no_response_ = captive_portal_no_response_ || |
759 (results->result == captive_portal::RESULT_NO_RESPONSE); | 768 (results->result == captive_portal::RESULT_NO_RESPONSE); |
760 } | 769 } |
761 #endif | 770 #endif |
762 } | 771 } |
772 | |
773 bool SSLBlockingPage::WindowsVersionSP3Lower() { | |
774 #if defined(OS_WIN) | |
775 bool on_windows_xp = base::win::GetVersion() < base::win::VERSION_VISTA; | |
felt
2014/06/30 18:16:07
is it correct that this includes VERSION_SERVER_20
radhikabhar
2014/07/01 23:56:49
Changed it so that it directly compares with the v
felt
2014/07/02 18:11:57
I can see it going either way. I don't know anythi
radhikabhar
2014/07/02 18:51:08
Windows Server 2003 does not have support for SHA2
| |
776 if (on_windows_xp) { | |
777 OSVERSIONINFOEX version_info = { sizeof version_info }; | |
778 GetVersionEx(reinterpret_cast<OSVERSIONINFO*>(&version_info)); | |
felt
2014/06/30 18:36:15
I don't think you should be directly invoking ::Ge
radhikabhar
2014/07/01 23:56:49
Done.
| |
779 if (version_info.wServicePackMajor < 3) | |
780 return true; | |
781 } | |
782 return false; | |
felt
2014/06/30 18:16:07
I don't think you need "return false" twice
radhikabhar
2014/07/01 23:56:49
Done.
| |
783 #endif | |
784 return false; | |
785 } | |
OLD | NEW |