| 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 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 } | 616 } |
| 617 } | 617 } |
| 618 | 618 |
| 619 // Adds a linked suggestion dictionary entry to the suggestions list. | 619 // Adds a linked suggestion dictionary entry to the suggestions list. |
| 620 void AddLinkedSuggestionToList(const int error_code, | 620 void AddLinkedSuggestionToList(const int error_code, |
| 621 const std::string& locale, | 621 const std::string& locale, |
| 622 base::ListValue* suggestions_summary_list, | 622 base::ListValue* suggestions_summary_list, |
| 623 bool standalone_suggestion) { | 623 bool standalone_suggestion) { |
| 624 GURL learn_more_url; | 624 GURL learn_more_url; |
| 625 base::string16 suggestion_string = standalone_suggestion ? | 625 base::string16 suggestion_string = standalone_suggestion ? |
| 626 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY) : | |
| 627 l10n_util::GetStringUTF16( | 626 l10n_util::GetStringUTF16( |
| 628 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY_STANDALONE); | 627 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY_STANDALONE) : |
| 628 l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); |
| 629 | 629 |
| 630 switch (error_code) { | 630 switch (error_code) { |
| 631 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: | 631 case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: |
| 632 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); | 632 learn_more_url = GURL(kWeakDHKeyLearnMoreUrl); |
| 633 suggestion_string = l10n_util::GetStringUTF16( | |
| 634 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_SUMMARY); | |
| 635 break; | 633 break; |
| 636 case net::ERR_TOO_MANY_REDIRECTS: | 634 case net::ERR_TOO_MANY_REDIRECTS: |
| 637 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); | 635 learn_more_url = GURL(kRedirectLoopLearnMoreUrl); |
| 638 suggestion_string = l10n_util::GetStringUTF16( | 636 suggestion_string = l10n_util::GetStringUTF16( |
| 639 IDS_ERRORPAGES_SUGGESTION_CLEAR_COOKIES_SUMMARY); | 637 IDS_ERRORPAGES_SUGGESTION_CLEAR_COOKIES_SUMMARY); |
| 640 break; | 638 break; |
| 641 default: | 639 default: |
| 642 NOTREACHED(); | 640 NOTREACHED(); |
| 643 break; | 641 break; |
| 644 } | 642 } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 // dialog for pages resulting from posts. | 716 // dialog for pages resulting from posts. |
| 719 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 717 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 720 IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_SUMMARY, false); | 718 IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_SUMMARY, false); |
| 721 return; | 719 return; |
| 722 } | 720 } |
| 723 DCHECK(!IsSuggested(suggestions, SUGGEST_REPOST_RELOAD)); | 721 DCHECK(!IsSuggested(suggestions, SUGGEST_REPOST_RELOAD)); |
| 724 | 722 |
| 725 if (IsOnlySuggestion(suggestions, SUGGEST_LEARNMORE)) { | 723 if (IsOnlySuggestion(suggestions, SUGGEST_LEARNMORE)) { |
| 726 DCHECK(suggestions_summary_list->empty()); | 724 DCHECK(suggestions_summary_list->empty()); |
| 727 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list, | 725 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list, |
| 728 false); | 726 true); |
| 729 return; | 727 return; |
| 730 } | 728 } |
| 731 if (IsSuggested(suggestions, SUGGEST_LEARNMORE)) { | 729 if (IsSuggested(suggestions, SUGGEST_LEARNMORE)) { |
| 732 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list, | 730 AddLinkedSuggestionToList(error_code, locale, suggestions_summary_list, |
| 733 true); | 731 false); |
| 734 } | 732 } |
| 735 | 733 |
| 736 if (suggestions & SUGGEST_DISABLE_EXTENSION) { | 734 if (suggestions & SUGGEST_DISABLE_EXTENSION) { |
| 737 DCHECK(suggestions_summary_list->empty()); | 735 DCHECK(suggestions_summary_list->empty()); |
| 738 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", | 736 AddSingleEntryDictionaryToList(suggestions_summary_list, "summary", |
| 739 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_SUMMARY, false); | 737 IDS_ERRORPAGES_SUGGESTION_DISABLE_EXTENSION_SUMMARY, false); |
| 740 return; | 738 return; |
| 741 } | 739 } |
| 742 DCHECK(!IsSuggested(suggestions, SUGGEST_DISABLE_EXTENSION)); | 740 DCHECK(!IsSuggested(suggestions, SUGGEST_DISABLE_EXTENSION)); |
| 743 | 741 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 | 1126 |
| 1129 bool LocalizedError::HasStrings(const std::string& error_domain, | 1127 bool LocalizedError::HasStrings(const std::string& error_domain, |
| 1130 int error_code) { | 1128 int error_code) { |
| 1131 // Whether or not the there are strings for an error does not depend on | 1129 // Whether or not the there are strings for an error does not depend on |
| 1132 // whether or not the page was be generated by a POST, so just claim it was | 1130 // whether or not the page was be generated by a POST, so just claim it was |
| 1133 // not. | 1131 // not. |
| 1134 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; | 1132 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != nullptr; |
| 1135 } | 1133 } |
| 1136 | 1134 |
| 1137 } // namespace error_page | 1135 } // namespace error_page |
| OLD | NEW |