Chromium Code Reviews| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 std::string ascii_error_string = net::ErrorToString(error_code); |
| 582 // Remove the leading "net::" from the returned string. | 582 // Remove the leading "net::" from the returned string. |
| 583 base::RemoveChars(ascii_error_string, "net:", &ascii_error_string); | 583 DCHECK(StartsWithASCII(ascii_error_string, "net::", true)); |
|
darin (slow to review)
2014/05/22 23:49:46
This case seems fine since the code is calling Err
Peter Kasting
2014/05/22 23:54:50
I'm confused. Both other cases are also calling E
| |
| 584 ascii_error_string.erase(0, 5); | |
| 584 error_string = base::ASCIIToUTF16(ascii_error_string); | 585 error_string = base::ASCIIToUTF16(ascii_error_string); |
| 585 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { | 586 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { |
| 586 std::string ascii_error_string = | 587 std::string ascii_error_string = |
| 587 chrome_common_net::DnsProbeStatusToString(error_code); | 588 chrome_common_net::DnsProbeStatusToString(error_code); |
| 588 error_string = base::ASCIIToUTF16(ascii_error_string); | 589 error_string = base::ASCIIToUTF16(ascii_error_string); |
| 589 } else { | 590 } else { |
| 590 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); | 591 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); |
| 591 error_string = base::IntToString16(error_code); | 592 error_string = base::IntToString16(error_code); |
| 592 } | 593 } |
| 593 error_strings->SetString("errorCode", | 594 error_strings->SetString("errorCode", |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 869 #if defined(OS_CHROMEOS) | 870 #if defined(OS_CHROMEOS) |
| 870 GURL learn_more_url(kAppWarningLearnMoreUrl); | 871 GURL learn_more_url(kAppWarningLearnMoreUrl); |
| 871 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); | 872 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); |
| 872 suggest_learn_more->SetString("msg", | 873 suggest_learn_more->SetString("msg", |
| 873 l10n_util::GetStringUTF16( | 874 l10n_util::GetStringUTF16( |
| 874 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); | 875 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); |
| 875 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 876 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
| 876 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 877 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
| 877 #endif // defined(OS_CHROMEOS) | 878 #endif // defined(OS_CHROMEOS) |
| 878 } | 879 } |
| OLD | NEW |