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

Unified Diff: chrome/browser/character_encoding.cc

Issue 2578003002: Move |GetCanonicalEncodingNameByAliasName| to base/i18n (Closed)
Patch Set: rebased Created 3 years, 11 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/character_encoding.h ('k') | chrome/browser/character_encoding_unittest.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
deleted file mode 100644
index 2d4b059550a434f4eec2ee958a9d3ec7d9c882c4..0000000000000000000000000000000000000000
--- a/chrome/browser/character_encoding.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/character_encoding.h"
-
-#include "base/macros.h"
-#include "third_party/icu/source/common/unicode/ucnv.h"
-
-namespace {
-
-// An array of all supported canonical encoding names.
-const char* const kCanonicalEncodingNames[] = {
- "Big5",
- "EUC-JP",
- "EUC-KR",
- "gb18030",
- "GBK",
- "IBM866",
- "ISO-2022-JP",
- "ISO-8859-10",
- "ISO-8859-13",
- "ISO-8859-14",
- "ISO-8859-15",
- "ISO-8859-16",
- "ISO-8859-2",
- "ISO-8859-3",
- "ISO-8859-4",
- "ISO-8859-5",
- "ISO-8859-6",
- "ISO-8859-7",
- "ISO-8859-8",
- "ISO-8859-8-I",
- "KOI8-R",
- "KOI8-U",
- "macintosh",
- "Shift_JIS",
- "UTF-16LE",
- "UTF-8",
- "windows-1250",
- "windows-1251",
- "windows-1252",
- "windows-1253",
- "windows-1254",
- "windows-1255",
- "windows-1256",
- "windows-1257",
- "windows-1258",
- "windows-874"
-};
-} // namespace
-
-std::string GetCanonicalEncodingNameByAliasName(const std::string& alias_name) {
- for (size_t i = 0; i < arraysize(kCanonicalEncodingNames); ++i) {
- if (alias_name == kCanonicalEncodingNames[i])
- return alias_name;
- }
- 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();
-}
« no previous file with comments | « chrome/browser/character_encoding.h ('k') | chrome/browser/character_encoding_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698