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 "components/error_page/common/localized_error.h" | 5 #include "components/error_page/common/localized_error.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 DCHECK(!(suggestions & ~SUGGEST_LEARNMORE_STANDALONE)); | 662 DCHECK(!(suggestions & ~SUGGEST_LEARNMORE_STANDALONE)); |
663 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list); | 663 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list); |
664 return; | 664 return; |
665 } | 665 } |
666 | 666 |
667 if (suggestions & SUGGEST_CHECK_CONNECTION) { | 667 if (suggestions & SUGGEST_CHECK_CONNECTION) { |
668 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 668 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
669 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY, false); | 669 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_SUMMARY, false); |
670 } | 670 } |
671 | 671 |
| 672 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
672 if ((suggestions & SUGGEST_DNS_CONFIG) && | 673 if ((suggestions & SUGGEST_DNS_CONFIG) && |
673 (suggestions & SUGGEST_FIREWALL_CONFIG) && | 674 (suggestions & SUGGEST_FIREWALL_CONFIG) && |
674 (suggestions & SUGGEST_PROXY_CONFIG)) { | 675 (suggestions & SUGGEST_PROXY_CONFIG)) { |
675 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 676 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
676 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_DNS_SUMMARY, false); | 677 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_DNS_SUMMARY, false); |
677 } else if ((suggestions & SUGGEST_FIREWALL_CONFIG) && | 678 } else if ((suggestions & SUGGEST_FIREWALL_CONFIG) && |
678 (suggestions & SUGGEST_ANTIVIRUS_CONFIG)) { | 679 (suggestions & SUGGEST_ANTIVIRUS_CONFIG)) { |
679 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 680 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
680 IDS_ERRORPAGES_SUGGESTION_CHECK_FIREWALL_ANTIVIRUS_SUMMARY, false); | 681 IDS_ERRORPAGES_SUGGESTION_CHECK_FIREWALL_ANTIVIRUS_SUMMARY, false); |
681 } else if ((suggestions & SUGGEST_PROXY_CONFIG) && | 682 } else if ((suggestions & SUGGEST_PROXY_CONFIG) && |
682 (suggestions & SUGGEST_FIREWALL_CONFIG)) { | 683 (suggestions & SUGGEST_FIREWALL_CONFIG)) { |
683 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 684 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
684 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_SUMMARY, false); | 685 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_FIREWALL_SUMMARY, false); |
685 } else if (suggestions & SUGGEST_PROXY_CONFIG) { | 686 } else if (suggestions & SUGGEST_PROXY_CONFIG) { |
686 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 687 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
687 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_ADDRESS_SUMMARY, false); | 688 IDS_ERRORPAGES_SUGGESTION_CHECK_PROXY_ADDRESS_SUMMARY, false); |
688 } else { | 689 } else { |
689 DCHECK(!(suggestions & SUGGEST_PROXY_CONFIG)); | 690 DCHECK(!(suggestions & SUGGEST_PROXY_CONFIG)); |
690 DCHECK(!(suggestions & SUGGEST_FIREWALL_CONFIG)); | 691 DCHECK(!(suggestions & SUGGEST_FIREWALL_CONFIG)); |
691 DCHECK(!(suggestions & SUGGEST_DNS_CONFIG)); | 692 DCHECK(!(suggestions & SUGGEST_DNS_CONFIG)); |
692 } | 693 } |
| 694 #endif |
693 | 695 |
694 if (suggestions & SUGGEST_CONTACT_ADMINISTRATOR) { | 696 if (suggestions & SUGGEST_CONTACT_ADMINISTRATOR) { |
695 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 697 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
696 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMIN_SUMMARY, false); | 698 IDS_ERRORPAGES_SUGGESTION_CONTACT_ADMIN_SUMMARY, false); |
697 } | 699 } |
698 | 700 |
699 if (suggestions & SUGGEST_OFFLINE_CHECKS) { | 701 if (suggestions & SUGGEST_OFFLINE_CHECKS) { |
700 #if defined(OS_ANDROID) || defined(OS_IOS) | 702 #if defined(OS_ANDROID) || defined(OS_IOS) |
701 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 703 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
702 IDS_ERRORPAGES_SUGGESTION_TURN_OFF_AIRPLANE_SUMMARY, false); | 704 IDS_ERRORPAGES_SUGGESTION_TURN_OFF_AIRPLANE_SUMMARY, false); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 void AddSuggestionsDetails(int error_code, | 768 void AddSuggestionsDetails(int error_code, |
767 base::DictionaryValue* error_strings, | 769 base::DictionaryValue* error_strings, |
768 int suggestions, | 770 int suggestions, |
769 base::ListValue* suggestions_details) { | 771 base::ListValue* suggestions_details) { |
770 if (suggestions & SUGGEST_CHECK_CONNECTION) { | 772 if (suggestions & SUGGEST_CHECK_CONNECTION) { |
771 AddSuggestionDetailDictionaryToList(suggestions_details, | 773 AddSuggestionDetailDictionaryToList(suggestions_details, |
772 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_HEADER, | 774 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_HEADER, |
773 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_BODY, false); | 775 IDS_ERRORPAGES_SUGGESTION_CHECK_CONNECTION_BODY, false); |
774 } | 776 } |
775 | 777 |
| 778 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
776 if (suggestions & SUGGEST_DNS_CONFIG) { | 779 if (suggestions & SUGGEST_DNS_CONFIG) { |
777 AddSuggestionDetailDictionaryToList(suggestions_details, | 780 AddSuggestionDetailDictionaryToList(suggestions_details, |
778 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_HEADER, | 781 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_HEADER, |
779 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_BODY, false); | 782 IDS_ERRORPAGES_SUGGESTION_DNS_CONFIG_BODY, false); |
780 | 783 |
781 base::DictionaryValue* suggest_network_prediction = | 784 base::DictionaryValue* suggest_network_prediction = |
782 AddSuggestionDetailDictionaryToList(suggestions_details, | 785 AddSuggestionDetailDictionaryToList(suggestions_details, |
783 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_HEADER, | 786 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_HEADER, |
784 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_BODY, true); | 787 IDS_ERRORPAGES_SUGGESTION_NETWORK_PREDICTION_BODY, true); |
785 | 788 |
(...skipping 17 matching lines...) Expand all Loading... |
803 | 806 |
804 // Custom body string. | 807 // Custom body string. |
805 suggest_proxy_config->SetString("body", | 808 suggest_proxy_config->SetString("body", |
806 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, | 809 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_SUGGESTION_PROXY_CONFIG_BODY, |
807 l10n_util::GetStringUTF16( | 810 l10n_util::GetStringUTF16( |
808 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); | 811 IDS_ERRORPAGES_SUGGESTION_PROXY_DISABLE_PLATFORM))); |
809 | 812 |
810 suggest_proxy_config->SetString("proxyTitle", | 813 suggest_proxy_config->SetString("proxyTitle", |
811 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); | 814 l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)); |
812 } | 815 } |
| 816 #endif |
813 | 817 |
814 if (suggestions & SUGGEST_CONTACT_ADMINISTRATOR_STANDALONE && | 818 if (suggestions & SUGGEST_CONTACT_ADMINISTRATOR_STANDALONE && |
815 error_code == net::ERR_BLOCKED_BY_ADMINISTRATOR) { | 819 error_code == net::ERR_BLOCKED_BY_ADMINISTRATOR) { |
816 AddSuggestionDetailDictionaryToList(suggestions_details, | 820 AddSuggestionDetailDictionaryToList(suggestions_details, |
817 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER, | 821 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_HEADER, |
818 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY, false); | 822 IDS_ERRORPAGES_SUGGESTION_VIEW_POLICIES_BODY, false); |
819 } | 823 } |
820 | 824 |
821 if (suggestions & SUGGEST_UNSUPPORTED_CIPHER) { | 825 if (suggestions & SUGGEST_UNSUPPORTED_CIPHER) { |
822 AddSuggestionDetailDictionaryToList(suggestions_details, | 826 AddSuggestionDetailDictionaryToList(suggestions_details, |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 | 1099 |
1096 bool LocalizedError::HasStrings(const std::string& error_domain, | 1100 bool LocalizedError::HasStrings(const std::string& error_domain, |
1097 int error_code) { | 1101 int error_code) { |
1098 // Whether or not the there are strings for an error does not depend on | 1102 // Whether or not the there are strings for an error does not depend on |
1099 // whether or not the page was be generated by a POST, so just claim it was | 1103 // whether or not the page was be generated by a POST, so just claim it was |
1100 // not. | 1104 // not. |
1101 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1105 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
1102 } | 1106 } |
1103 | 1107 |
1104 } // namespace error_page | 1108 } // namespace error_page |
OLD | NEW |