| 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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 error_strings->Set("summary", summary); | 571 error_strings->Set("summary", summary); |
| 572 | 572 |
| 573 if (options.details_resource_id != kErrorPagesNoDetails) { | 573 if (options.details_resource_id != kErrorPagesNoDetails) { |
| 574 error_strings->SetString( | 574 error_strings->SetString( |
| 575 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); | 575 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); |
| 576 } | 576 } |
| 577 | 577 |
| 578 base::string16 error_string; | 578 base::string16 error_string; |
| 579 if (error_domain == net::kErrorDomain) { | 579 if (error_domain == net::kErrorDomain) { |
| 580 // Non-internationalized error string, for debugging Chrome itself. | 580 // Non-internationalized error string, for debugging Chrome itself. |
| 581 std::string ascii_error_string = net::ErrorToString(error_code); | 581 error_string = base::ASCIIToUTF16(net::ErrorToShortString(error_code)); |
| 582 // Remove the leading "net::" from the returned string. | |
| 583 DCHECK(StartsWithASCII(ascii_error_string, "net::", true)); | |
| 584 ascii_error_string.erase(0, 5); | |
| 585 error_string = base::ASCIIToUTF16(ascii_error_string); | |
| 586 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { | 582 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { |
| 587 std::string ascii_error_string = | 583 std::string ascii_error_string = |
| 588 chrome_common_net::DnsProbeStatusToString(error_code); | 584 chrome_common_net::DnsProbeStatusToString(error_code); |
| 589 error_string = base::ASCIIToUTF16(ascii_error_string); | 585 error_string = base::ASCIIToUTF16(ascii_error_string); |
| 590 } else { | 586 } else { |
| 591 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); | 587 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); |
| 592 error_string = base::IntToString16(error_code); | 588 error_string = base::IntToString16(error_code); |
| 593 } | 589 } |
| 594 error_strings->SetString("errorCode", | 590 error_strings->SetString("errorCode", |
| 595 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string)); | 591 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string)); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 #if defined(OS_CHROMEOS) | 866 #if defined(OS_CHROMEOS) |
| 871 GURL learn_more_url(kAppWarningLearnMoreUrl); | 867 GURL learn_more_url(kAppWarningLearnMoreUrl); |
| 872 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 868 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
| 873 suggest_learn_more->SetString("msg", | 869 suggest_learn_more->SetString("msg", |
| 874 l10n_util::GetStringUTF16( | 870 l10n_util::GetStringUTF16( |
| 875 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 871 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
| 876 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 872 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
| 877 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 873 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
| 878 #endif // defined(OS_CHROMEOS) | 874 #endif // defined(OS_CHROMEOS) |
| 879 } | 875 } |
| OLD | NEW |