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 | |
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 = SSLErrorInfo::CERT_INVALID; |
563 "explanationParagraph", | 562 // SSLErrorInfo::NetErrorToErrorType(cert_error_); |
564 l10n_util::GetStringFUTF16(IDS_SSL_NONOVERRIDABLE_MORE, url)); | 563 if (type == SSLErrorInfo::CERT_INVALID && WindowsVersionSP3Lower()) { |
| 564 load_time_data.SetString( |
| 565 "explanationParagraph", |
| 566 l10n_util::GetStringFUTF16( |
| 567 IDS_SSL_NONOVERRIDABLE_MORE_INVALID_SP3, url)); |
| 568 } else { |
| 569 load_time_data.SetString("explanationParagraph", |
| 570 l10n_util::GetStringFUTF16( |
| 571 IDS_SSL_NONOVERRIDABLE_MORE, url)); |
| 572 } |
565 load_time_data.SetString( | 573 load_time_data.SetString( |
566 "primaryButtonText", | 574 "primaryButtonText", |
567 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); | 575 l10n_util::GetStringUTF16(IDS_SSL_NONOVERRIDABLE_RELOAD_BUTTON)); |
568 // Customize the help link depending on the specific error type. | 576 // 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 | 577 // 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. | 578 // 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); | 579 load_time_data.SetInteger("errorType", type); |
574 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; | 580 int help_string = IDS_SSL_NONOVERRIDABLE_INVALID; |
575 switch (type) { | 581 switch (type) { |
576 case SSLErrorInfo::CERT_REVOKED: | 582 case SSLErrorInfo::CERT_REVOKED: |
577 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; | 583 help_string = IDS_SSL_NONOVERRIDABLE_REVOKED; |
578 break; | 584 break; |
579 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: | 585 case SSLErrorInfo::CERT_PINNED_KEY_MISSING: |
580 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; | 586 help_string = IDS_SSL_NONOVERRIDABLE_PINNED; |
581 break; | 587 break; |
582 case SSLErrorInfo::CERT_INVALID: | 588 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 | 759 // sure we don't clear the captive portal flag, since the interstitial was |
754 // potentially caused by the captive portal. | 760 // potentially caused by the captive portal. |
755 captive_portal_detected_ = captive_portal_detected_ || | 761 captive_portal_detected_ = captive_portal_detected_ || |
756 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); | 762 (results->result == captive_portal::RESULT_BEHIND_CAPTIVE_PORTAL); |
757 // Also keep track of non-HTTP portals and error cases. | 763 // Also keep track of non-HTTP portals and error cases. |
758 captive_portal_no_response_ = captive_portal_no_response_ || | 764 captive_portal_no_response_ = captive_portal_no_response_ || |
759 (results->result == captive_portal::RESULT_NO_RESPONSE); | 765 (results->result == captive_portal::RESULT_NO_RESPONSE); |
760 } | 766 } |
761 #endif | 767 #endif |
762 } | 768 } |
| 769 |
| 770 bool SSLBlockingPage::WindowsVersionSP3Lower() { |
| 771 #if defined(OS_WIN) |
| 772 const base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); |
| 773 base::win::OSInfo::ServicePack service_pack = os_info->service_pack(); |
| 774 if (os_info->version() == base::win::VERSION_XP && service_pack.major < 3) { |
| 775 return true; |
| 776 } |
| 777 #endif |
| 778 return false; |
| 779 } |
OLD | NEW |