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

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

Issue 93793010: Update uses of UTF conversions in chrome/common to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 months 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 error_strings->SetString( 567 error_strings->SetString(
568 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id)); 568 "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id));
569 } 569 }
570 570
571 base::string16 error_string; 571 base::string16 error_string;
572 if (error_domain == net::kErrorDomain) { 572 if (error_domain == net::kErrorDomain) {
573 // Non-internationalized error string, for debugging Chrome itself. 573 // Non-internationalized error string, for debugging Chrome itself.
574 std::string ascii_error_string = net::ErrorToString(error_code); 574 std::string ascii_error_string = net::ErrorToString(error_code);
575 // Remove the leading "net::" from the returned string. 575 // Remove the leading "net::" from the returned string.
576 base::RemoveChars(ascii_error_string, "net:", &ascii_error_string); 576 base::RemoveChars(ascii_error_string, "net:", &ascii_error_string);
577 error_string = ASCIIToUTF16(ascii_error_string); 577 error_string = base::ASCIIToUTF16(ascii_error_string);
578 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) { 578 } else if (error_domain == chrome_common_net::kDnsProbeErrorDomain) {
579 std::string ascii_error_string = 579 std::string ascii_error_string =
580 chrome_common_net::DnsProbeStatusToString(error_code); 580 chrome_common_net::DnsProbeStatusToString(error_code);
581 error_string = ASCIIToUTF16(ascii_error_string); 581 error_string = base::ASCIIToUTF16(ascii_error_string);
582 } else { 582 } else {
583 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain); 583 DCHECK_EQ(LocalizedError::kHttpErrorDomain, error_domain);
584 error_string = base::IntToString16(error_code); 584 error_string = base::IntToString16(error_code);
585 } 585 }
586 error_strings->SetString("errorCode", 586 error_strings->SetString("errorCode",
587 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string)); 587 l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string));
588 588
589 base::ListValue* suggestions = new base::ListValue(); 589 base::ListValue* suggestions = new base::ListValue();
590 590
591 // Platform specific instructions for diagnosing network issues on OSX and 591 // Platform specific instructions for diagnosing network issues on OSX and
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 788
789 void LocalizedError::GetAppErrorStrings( 789 void LocalizedError::GetAppErrorStrings(
790 const GURL& display_url, 790 const GURL& display_url,
791 const extensions::Extension* app, 791 const extensions::Extension* app,
792 base::DictionaryValue* error_strings) { 792 base::DictionaryValue* error_strings) {
793 DCHECK(app); 793 DCHECK(app);
794 794
795 bool rtl = LocaleIsRTL(); 795 bool rtl = LocaleIsRTL();
796 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); 796 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr");
797 797
798 base::string16 failed_url(ASCIIToUTF16(display_url.spec())); 798 base::string16 failed_url(base::ASCIIToUTF16(display_url.spec()));
799 // URLs are always LTR. 799 // URLs are always LTR.
800 if (rtl) 800 if (rtl)
801 base::i18n::WrapStringWithLTRFormatting(&failed_url); 801 base::i18n::WrapStringWithLTRFormatting(&failed_url);
802 error_strings->SetString( 802 error_strings->SetString(
803 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, 803 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
804 failed_url.c_str())); 804 failed_url.c_str()));
805 805
806 error_strings->SetString("title", app->name()); 806 error_strings->SetString("title", app->name());
807 error_strings->SetString( 807 error_strings->SetString(
808 "icon", 808 "icon",
809 extensions::IconsInfo::GetIconURL( 809 extensions::IconsInfo::GetIconURL(
810 app, 810 app,
811 extension_misc::EXTENSION_ICON_GIGANTOR, 811 extension_misc::EXTENSION_ICON_GIGANTOR,
812 ExtensionIconSet::MATCH_SMALLER).spec()); 812 ExtensionIconSet::MATCH_SMALLER).spec());
813 error_strings->SetString("name", app->name()); 813 error_strings->SetString("name", app->name());
814 error_strings->SetString( 814 error_strings->SetString(
815 "msg", 815 "msg",
816 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); 816 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING));
817 817
818 #if defined(OS_CHROMEOS) 818 #if defined(OS_CHROMEOS)
819 GURL learn_more_url(kAppWarningLearnMoreUrl); 819 GURL learn_more_url(kAppWarningLearnMoreUrl);
820 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue(); 820 base::DictionaryValue* suggest_learn_more = new base::DictionaryValue();
821 suggest_learn_more->SetString("msg", 821 suggest_learn_more->SetString("msg",
822 l10n_util::GetStringUTF16( 822 l10n_util::GetStringUTF16(
823 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY)); 823 IDS_ERRORPAGES_SUGGESTION_LEARNMORE_BODY));
824 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); 824 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec());
825 error_strings->Set("suggestionsLearnMore", suggest_learn_more); 825 error_strings->Set("suggestionsLearnMore", suggest_learn_more);
826 #endif // defined(OS_CHROMEOS) 826 #endif // defined(OS_CHROMEOS)
827 } 827 }
OLDNEW
« no previous file with comments | « chrome/common/importer/ie_importer_test_registry_overrider_win.cc ('k') | chrome/common/logging_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698