Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: chrome/common/localized_error.cc

Issue 102843002: Move RemoveChars, ReplaceChars, TrimString, and TruncateUTF8ToByteSize to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 if (options.details_resource_id != kErrorPagesNoDetails) { 567 if (options.details_resource_id != kErrorPagesNoDetails) {
568 error_strings->SetString( 568 error_strings->SetString(
569 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); 569 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id));
570 } 570 }
571 571
572 string16 error_string; 572 string16 error_string;
573 if (error_domain == net::kErrorDomain) { 573 if (error_domain == net::kErrorDomain) {
574 // Non-internationalized error string, for debugging Chrome itself. 574 // Non-internationalized error string, for debugging Chrome itself.
575 std::string ascii_error_string = net::ErrorToString(error_code); 575 std::string ascii_error_string = net::ErrorToString(error_code);
576 // Remove the leading "net::" from the returned string. 576 // Remove the leading "net::" from the returned string.
577 RemoveChars(ascii_error_string, "net:", &ascii_error_string); 577 base::RemoveChars(ascii_error_string, "net:", &ascii_error_string);
578 error_string = ASCIIToUTF16(ascii_error_string); 578 error_string = ASCIIToUTF16(ascii_error_string);
579 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { 579 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) {
580 std::string ascii_error_string = 580 std::string ascii_error_string =
581 chrome_common_net::DnsProbeStatusToString(error_code); 581 chrome_common_net::DnsProbeStatusToString(error_code);
582 error_string = ASCIIToUTF16(ascii_error_string); 582 error_string = ASCIIToUTF16(ascii_error_string);
583 } else { 583 } else {
584 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); 584 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain);
585 error_string = base::IntToString16(error_code); 585 error_string = base::IntToString16(error_code);
586 } 586 }
587 error_strings->SetString("errorCode", 587 error_strings->SetString("errorCode",
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 #if defined(OS_CHROMEOS) 819 #if defined(OS_CHROMEOS)
820 GURL learn_more_url(kAppWarningLearnMoreUrl); 820 GURL learn_more_url(kAppWarningLearnMoreUrl);
821 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); 821 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue();
822 suggest_learn_more->SetString("msg", 822 suggest_learn_more->SetString("msg",
823 l10n_util::GetStringUTF16( 823 l10n_util::GetStringUTF16(
824 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); 824 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
825 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 825 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
826 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 826 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
827 #endif // defined(OS_CHROMEOS) 827 #endif // defined(OS_CHROMEOS)
828 } 828 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698