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

Unified Diff: chrome/browser/character_encoding.cc

Issue 649413002: Roll src/third_party/icu 8ac906f:d8b2a9d (svn 292317:292476) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: space/indent fix Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_encoding_browsertest.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/character_encoding.cc
diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc
index e01c27d157daef9c0e2bc0f030fe53a94986ac99..e9e2521d0c5275fbf23a230e1d6ddf0d0fbb29a5 100644
--- a/chrome/browser/character_encoding.cc
+++ b/chrome/browser/character_encoding.cc
@@ -36,7 +36,6 @@ typedef struct {
const CanonicalEncodingData kCanonicalEncodingNames[] = {
{ IDC_ENCODING_UTF8, "UTF-8", IDS_ENCODING_UNICODE },
{ IDC_ENCODING_UTF16LE, "UTF-16LE", IDS_ENCODING_UNICODE },
- { IDC_ENCODING_ISO88591, "ISO-8859-1", IDS_ENCODING_WESTERN },
{ IDC_ENCODING_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN },
{ IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE },
{ IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE },
@@ -191,7 +190,6 @@ CanonicalEncodingMap* CanonicalEncodingMapSingleton() {
const int kDefaultEncodingMenus[] = {
IDC_ENCODING_UTF16LE,
- IDC_ENCODING_ISO88591,
IDC_ENCODING_WINDOWS1252,
IDC_ENCODING_GBK,
IDC_ENCODING_GB18030,
@@ -255,7 +253,9 @@ base::string16 GetEncodingDisplayName(const std::string& encoding_name,
base::string16 category_name = l10n_util::GetStringUTF16(category_string_id);
if (category_string_id != IDS_ENCODING_KOREAN &&
category_string_id != IDS_ENCODING_THAI &&
- category_string_id != IDS_ENCODING_TURKISH) {
+ category_string_id != IDS_ENCODING_TURKISH &&
+ category_string_id != IDS_ENCODING_VIETNAMESE &&
+ category_string_id != IDS_ENCODING_ROMANIAN) {
const CanonicalNameDisplayNameMapType* map =
CanonicalEncodingMapSingleton()->GetCanonicalNameDisplayNameMapData();
DCHECK(map);
@@ -379,29 +379,15 @@ std::string CharacterEncoding::GetCanonicalEncodingNameByAliasName(
if (found_id != map->end())
return alias_name;
- UErrorCode error_code = U_ZERO_ERROR;
-
- const char* canonical_name = ucnv_getCanonicalName(
- alias_name.c_str(), "MIME", &error_code);
- // If failed, then try IANA next.
- if (U_FAILURE(error_code) || !canonical_name) {
- error_code = U_ZERO_ERROR;
- canonical_name = ucnv_getCanonicalName(
- alias_name.c_str(), "IANA", &error_code);
- }
-
- if (canonical_name) {
- // TODO(jnd) use a map to handle all customized {alias, canonical}
- // encoding mappings if we have more than one pair.
- // We don't want to add an unnecessary charset to the encoding menu, so we
- // alias 'US-ASCII' to 'ISO-8859-1' in our UI without touching WebKit.
- // http://crbug.com/15801.
- if (alias_name == "US-ASCII")
- return GetCanonicalEncodingNameByCommandId(IDC_ENCODING_ISO88591);
- return canonical_name;
- } else {
- return std::string();
+ const char* standards[3] = { "HTML", "MIME", "IANA" };
+ for (size_t i = 0; i < arraysize(standards); ++i) {
+ UErrorCode error_code = U_ZERO_ERROR;
+ const char* canonical_name = ucnv_getCanonicalName(
+ alias_name.c_str(), standards[i], &error_code);
+ if (U_SUCCESS(error_code) && canonical_name)
+ return canonical_name;
}
+ return std::string();
}
// Static
« no previous file with comments | « chrome/browser/browser_encoding_browsertest.cc ('k') | chrome/browser/download/save_page_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698