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/common/localized_error.h" | 5 #include "chrome/common/localized_error.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/i18n/rtl.h" | 8 #include "base/i18n/rtl.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
547 } // namespace | 547 } // namespace |
548 | 548 |
549 const char LocalizedError::kHttpErrorDomain[] = "http"; | 549 const char LocalizedError::kHttpErrorDomain[] = "http"; |
550 | 550 |
551 void LocalizedError::GetStrings(int error_code, | 551 void LocalizedError::GetStrings(int error_code, |
552 const std::string& error_domain, | 552 const std::string& error_domain, |
553 const GURL& failed_url, | 553 const GURL& failed_url, |
554 bool is_post, | 554 bool is_post, |
555 bool stale_copy_in_cache, | 555 bool stale_copy_in_cache, |
556 bool can_show_network_diagnostics_dialog, | 556 bool can_show_network_diagnostics_dialog, |
557 bool has_offline_pages, | |
557 const std::string& locale, | 558 const std::string& locale, |
558 const std::string& accept_languages, | 559 const std::string& accept_languages, |
559 scoped_ptr<error_page::ErrorPageParams> params, | 560 scoped_ptr<error_page::ErrorPageParams> params, |
560 base::DictionaryValue* error_strings) { | 561 base::DictionaryValue* error_strings) { |
561 webui::SetLoadTimeDataDefaults(locale, error_strings); | 562 webui::SetLoadTimeDataDefaults(locale, error_strings); |
562 | 563 |
563 // Grab the strings and settings that depend on the error type. Init | 564 // Grab the strings and settings that depend on the error type. Init |
564 // options with default values. | 565 // options with default values. |
565 LocalizedErrorMap options = { | 566 LocalizedErrorMap options = { |
566 0, | 567 0, |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 "msg", l10n_util::GetStringUTF16( | 760 "msg", l10n_util::GetStringUTF16( |
760 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY)); | 761 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY)); |
761 show_saved_copy_button->SetString( | 762 show_saved_copy_button->SetString( |
762 "title", | 763 "title", |
763 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP)); | 764 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_COPY_HELP)); |
764 if (show_saved_copy_primary) | 765 if (show_saved_copy_primary) |
765 show_saved_copy_button->SetString("primary", "true"); | 766 show_saved_copy_button->SetString("primary", "true"); |
766 error_strings->Set("showSavedCopyButton", show_saved_copy_button); | 767 error_strings->Set("showSavedCopyButton", show_saved_copy_button); |
767 } | 768 } |
768 | 769 |
770 #if defined(OS_ANDROID) | |
771 if (has_offline_pages) { | |
mmenke
2015/11/05 16:18:12
One other question: Should we do this for all err
edwardjung
2015/11/05 17:08:01
My feeling is that this should be restricted to th
jianli
2015/11/06 00:04:40
Yes, we only want to offer "Show all saved pages"
| |
772 base::DictionaryValue* show_saved_pages_button = new base::DictionaryValue; | |
773 show_saved_pages_button->SetString( | |
774 "msg", l10n_util::GetStringUTF16( | |
775 IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES)); | |
776 show_saved_pages_button->SetString( | |
777 "title", | |
778 l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_SHOW_SAVED_PAGES_HELP)); | |
779 error_strings->Set("showSavedPagesButton", show_saved_pages_button); | |
780 } | |
781 #endif | |
782 | |
769 #if defined(OS_CHROMEOS) | 783 #if defined(OS_CHROMEOS) |
770 // ChromeOS has its own diagnostics extension, which doesn't rely on a | 784 // ChromeOS has its own diagnostics extension, which doesn't rely on a |
771 // browser-initiated dialog. | 785 // browser-initiated dialog. |
772 can_show_network_diagnostics_dialog = true; | 786 can_show_network_diagnostics_dialog = true; |
773 #endif | 787 #endif |
774 if (can_show_network_diagnostics_dialog && failed_url.is_valid() && | 788 if (can_show_network_diagnostics_dialog && failed_url.is_valid() && |
775 failed_url.SchemeIsHTTPOrHTTPS()) { | 789 failed_url.SchemeIsHTTPOrHTTPS()) { |
776 error_strings->SetString( | 790 error_strings->SetString( |
777 "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE)); | 791 "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE)); |
778 } | 792 } |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); | 926 return l10n_util::GetStringUTF16(IDS_ERRORPAGES_DETAILS_UNKNOWN); |
913 } | 927 } |
914 | 928 |
915 bool LocalizedError::HasStrings(const std::string& error_domain, | 929 bool LocalizedError::HasStrings(const std::string& error_domain, |
916 int error_code) { | 930 int error_code) { |
917 // Whether or not the there are strings for an error does not depend on | 931 // Whether or not the there are strings for an error does not depend on |
918 // whether or not the page was be generated by a POST, so just claim it was | 932 // whether or not the page was be generated by a POST, so just claim it was |
919 // not. | 933 // not. |
920 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL; | 934 return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL; |
921 } | 935 } |
OLD | NEW |