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/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
487 } | 487 } |
488 | 488 |
489 } // namespace | 489 } // namespace |
490 | 490 |
491 const char LocalizedError::kHttpErrorDomain[] = "http"; | 491 const char LocalizedError::kHttpErrorDomain[] = "http"; |
492 | 492 |
493 void LocalizedError::GetStrings(int error_code, | 493 void LocalizedError::GetStrings(int error_code, |
494 const std::string& error_domain, | 494 const std::string& error_domain, |
495 const GURL& failed_url, | 495 const GURL& failed_url, |
496 bool is_post, | 496 bool is_post, |
497 bool stale_copy_in_cache, | |
497 const std::string& locale, | 498 const std::string& locale, |
498 const std::string& accept_languages, | 499 const std::string& accept_languages, |
499 base::DictionaryValue* error_strings) { | 500 base::DictionaryValue* error_strings) { |
500 bool rtl = LocaleIsRTL(); | 501 bool rtl = LocaleIsRTL(); |
501 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); | 502 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); |
502 | 503 |
503 // Grab the strings and settings that depend on the error type. Init | 504 // Grab the strings and settings that depend on the error type. Init |
504 // options with default values. | 505 // options with default values. |
505 LocalizedErrorMap options = { | 506 LocalizedErrorMap options = { |
506 0, | 507 0, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), | 552 summary->SetString("hostName", net::IDNToUnicode(failed_url.host(), |
552 accept_languages)); | 553 accept_languages)); |
553 summary->SetString("productName", | 554 summary->SetString("productName", |
554 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); | 555 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)); |
555 | 556 |
556 error_strings->SetString( | 557 error_strings->SetString( |
557 "more", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_MORE)); | 558 "more", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_MORE)); |
558 error_strings->SetString( | 559 error_strings->SetString( |
559 "less", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_LESS)); | 560 "less", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_LESS)); |
560 error_strings->Set("summary", summary); | 561 error_strings->Set("summary", summary); |
562 error_strings->SetBoolean("staleCopyInCache", stale_copy_in_cache); | |
mmenke
2014/01/28 17:27:23
From a UI consistency standpoint, may want to add
mmenke
2014/01/28 17:27:23
Just a heads up that we may want to, at least temp
Randy Smith (Not in Mondays)
2014/01/28 22:52:59
As discussed offline, ignoring for now.
Randy Smith (Not in Mondays)
2014/01/28 22:52:59
Based on our discussion, I think this is moot.
| |
563 | |
561 #if defined(OS_CHROMEOS) | 564 #if defined(OS_CHROMEOS) |
562 error_strings->SetString( | 565 error_strings->SetString( |
563 "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE)); | 566 "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE)); |
564 #endif // defined(OS_CHROMEOS) | 567 #endif // defined(OS_CHROMEOS) |
565 | 568 |
566 if (options.details_resource_id != kErrorPagesNoDetails) { | 569 if (options.details_resource_id != kErrorPagesNoDetails) { |
567 error_strings->SetString( | 570 error_strings->SetString( |
568 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); | 571 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); |
569 } | 572 } |
570 | 573 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
818 #if defined(OS_CHROMEOS) | 821 #if defined(OS_CHROMEOS) |
819 GURL learn_more_url(kAppWarningLearnMoreUrl); | 822 GURL learn_more_url(kAppWarningLearnMoreUrl); |
820 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 823 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
821 suggest_learn_more->SetString("msg", | 824 suggest_learn_more->SetString("msg", |
822 l10n_util::GetStringUTF16( | 825 l10n_util::GetStringUTF16( |
823 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 826 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
824 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 827 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
825 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 828 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
826 #endif // defined(OS_CHROMEOS) | 829 #endif // defined(OS_CHROMEOS) |
827 } | 830 } |
OLD | NEW |