| 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/browser/character_encoding.h" | 5 #include "chrome/browser/character_encoding.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // An array of all supported canonical encoding names. | 35 // An array of all supported canonical encoding names. |
| 36 const CanonicalEncodingData kCanonicalEncodingNames[] = { | 36 const CanonicalEncodingData kCanonicalEncodingNames[] = { |
| 37 { IDC_ENCODING_UTF8, "UTF-8", IDS_ENCODING_UNICODE }, | 37 { IDC_ENCODING_UTF8, "UTF-8", IDS_ENCODING_UNICODE }, |
| 38 { IDC_ENCODING_UTF16LE, "UTF-16LE", IDS_ENCODING_UNICODE }, | 38 { IDC_ENCODING_UTF16LE, "UTF-16LE", IDS_ENCODING_UNICODE }, |
| 39 { IDC_ENCODING_ISO88591, "ISO-8859-1", IDS_ENCODING_WESTERN }, | 39 { IDC_ENCODING_ISO88591, "ISO-8859-1", IDS_ENCODING_WESTERN }, |
| 40 { IDC_ENCODING_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN }, | 40 { IDC_ENCODING_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN }, |
| 41 { IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE }, | 41 { IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE }, |
| 42 { IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE }, | 42 { IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE }, |
| 43 { IDC_ENCODING_BIG5, "Big5", IDS_ENCODING_TRAD_CHINESE }, | 43 { IDC_ENCODING_BIG5, "Big5", IDS_ENCODING_TRAD_CHINESE }, |
| 44 { IDC_ENCODING_BIG5HKSCS, "Big5-HKSCS", IDS_ENCODING_TRAD_CHINESE }, | 44 { IDC_ENCODING_BIG5HKSCS, "Big5-HKSCS", IDS_ENCODING_TRAD_CHINESE }, |
| 45 { IDC_ENCODING_KOREAN, "windows-949", IDS_ENCODING_KOREAN }, | 45 { IDC_ENCODING_KOREAN, "EUC-KR", IDS_ENCODING_KOREAN }, |
| 46 { IDC_ENCODING_SHIFTJIS, "Shift_JIS", IDS_ENCODING_JAPANESE }, | 46 { IDC_ENCODING_SHIFTJIS, "Shift_JIS", IDS_ENCODING_JAPANESE }, |
| 47 { IDC_ENCODING_EUCJP, "EUC-JP", IDS_ENCODING_JAPANESE }, | 47 { IDC_ENCODING_EUCJP, "EUC-JP", IDS_ENCODING_JAPANESE }, |
| 48 { IDC_ENCODING_ISO2022JP, "ISO-2022-JP", IDS_ENCODING_JAPANESE }, | 48 { IDC_ENCODING_ISO2022JP, "ISO-2022-JP", IDS_ENCODING_JAPANESE }, |
| 49 { IDC_ENCODING_THAI, "windows-874", IDS_ENCODING_THAI }, | 49 { IDC_ENCODING_THAI, "windows-874", IDS_ENCODING_THAI }, |
| 50 { IDC_ENCODING_ISO885915, "ISO-8859-15", IDS_ENCODING_WESTERN }, | 50 { IDC_ENCODING_ISO885915, "ISO-8859-15", IDS_ENCODING_WESTERN }, |
| 51 { IDC_ENCODING_MACINTOSH, "macintosh", IDS_ENCODING_WESTERN }, | 51 { IDC_ENCODING_MACINTOSH, "macintosh", IDS_ENCODING_WESTERN }, |
| 52 { IDC_ENCODING_ISO88592, "ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, | 52 { IDC_ENCODING_ISO88592, "ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, |
| 53 { IDC_ENCODING_WINDOWS1250, "windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, | 53 { IDC_ENCODING_WINDOWS1250, "windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, |
| 54 { IDC_ENCODING_ISO88595, "ISO-8859-5", IDS_ENCODING_CYRILLIC }, | 54 { IDC_ENCODING_ISO88595, "ISO-8859-5", IDS_ENCODING_CYRILLIC }, |
| 55 { IDC_ENCODING_WINDOWS1251, "windows-1251", IDS_ENCODING_CYRILLIC }, | 55 { IDC_ENCODING_WINDOWS1251, "windows-1251", IDS_ENCODING_CYRILLIC }, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 81 | 81 |
| 82 typedef struct { | 82 typedef struct { |
| 83 const char* canonical_form; | 83 const char* canonical_form; |
| 84 const char* display_form; | 84 const char* display_form; |
| 85 } CanonicalEncodingDisplayNamePair; | 85 } CanonicalEncodingDisplayNamePair; |
| 86 | 86 |
| 87 const CanonicalEncodingDisplayNamePair kCanonicalDisplayNameOverrides[] = { | 87 const CanonicalEncodingDisplayNamePair kCanonicalDisplayNameOverrides[] = { |
| 88 // Only lists the canonical names where we want a different form for display. | 88 // Only lists the canonical names where we want a different form for display. |
| 89 { "macintosh", "Macintosh" }, | 89 { "macintosh", "Macintosh" }, |
| 90 { "windows-874", "Windows-874" }, | 90 { "windows-874", "Windows-874" }, |
| 91 { "windows-949", "Windows-949" }, | |
| 92 { "windows-1250", "Windows-1250" }, | 91 { "windows-1250", "Windows-1250" }, |
| 93 { "windows-1251", "Windows-1251" }, | 92 { "windows-1251", "Windows-1251" }, |
| 94 { "windows-1252", "Windows-1252" }, | 93 { "windows-1252", "Windows-1252" }, |
| 95 { "windows-1253", "Windows-1253" }, | 94 { "windows-1253", "Windows-1253" }, |
| 96 { "windows-1254", "Windows-1254" }, | 95 { "windows-1254", "Windows-1254" }, |
| 97 { "windows-1255", "Windows-1255" }, | 96 { "windows-1255", "Windows-1255" }, |
| 98 { "windows-1256", "Windows-1256" }, | 97 { "windows-1256", "Windows-1256" }, |
| 99 { "windows-1257", "Windows-1257" }, | 98 { "windows-1257", "Windows-1257" }, |
| 100 { "windows-1258", "Windows-1258" }, | 99 { "windows-1258", "Windows-1258" }, |
| 101 }; | 100 }; |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 // Insert new encoding to head of selected encoding list. | 533 // Insert new encoding to head of selected encoding list. |
| 535 *selected_encodings = encoding_name; | 534 *selected_encodings = encoding_name; |
| 536 // Generate the string for rest selected encoding list. | 535 // Generate the string for rest selected encoding list. |
| 537 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); | 536 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); |
| 538 it != selected_encoding_list.end(); ++it) { | 537 it != selected_encoding_list.end(); ++it) { |
| 539 selected_encodings->append(1, L','); | 538 selected_encodings->append(1, L','); |
| 540 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); | 539 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); |
| 541 } | 540 } |
| 542 return true; | 541 return true; |
| 543 } | 542 } |
| OLD | NEW |