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 22 matching lines...) Expand all Loading... |
33 } CanonicalEncodingData; | 33 } CanonicalEncodingData; |
34 | 34 |
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_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN }, | 39 { IDC_ENCODING_WINDOWS1252, "windows-1252", IDS_ENCODING_WESTERN }, |
40 { IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE }, | 40 { IDC_ENCODING_GBK, "GBK", IDS_ENCODING_SIMP_CHINESE }, |
41 { IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE }, | 41 { IDC_ENCODING_GB18030, "gb18030", IDS_ENCODING_SIMP_CHINESE }, |
42 { IDC_ENCODING_BIG5, "Big5", IDS_ENCODING_TRAD_CHINESE }, | 42 { IDC_ENCODING_BIG5, "Big5", IDS_ENCODING_TRAD_CHINESE }, |
43 { IDC_ENCODING_BIG5HKSCS, "Big5-HKSCS", IDS_ENCODING_TRAD_CHINESE }, | |
44 { IDC_ENCODING_KOREAN, "EUC-KR", IDS_ENCODING_KOREAN }, | 43 { IDC_ENCODING_KOREAN, "EUC-KR", IDS_ENCODING_KOREAN }, |
45 { IDC_ENCODING_SHIFTJIS, "Shift_JIS", IDS_ENCODING_JAPANESE }, | 44 { IDC_ENCODING_SHIFTJIS, "Shift_JIS", IDS_ENCODING_JAPANESE }, |
46 { IDC_ENCODING_EUCJP, "EUC-JP", IDS_ENCODING_JAPANESE }, | 45 { IDC_ENCODING_EUCJP, "EUC-JP", IDS_ENCODING_JAPANESE }, |
47 { IDC_ENCODING_ISO2022JP, "ISO-2022-JP", IDS_ENCODING_JAPANESE }, | 46 { IDC_ENCODING_ISO2022JP, "ISO-2022-JP", IDS_ENCODING_JAPANESE }, |
48 { IDC_ENCODING_THAI, "windows-874", IDS_ENCODING_THAI }, | 47 { IDC_ENCODING_THAI, "windows-874", IDS_ENCODING_THAI }, |
49 { IDC_ENCODING_ISO885915, "ISO-8859-15", IDS_ENCODING_WESTERN }, | 48 { IDC_ENCODING_ISO885915, "ISO-8859-15", IDS_ENCODING_WESTERN }, |
50 { IDC_ENCODING_MACINTOSH, "macintosh", IDS_ENCODING_WESTERN }, | 49 { IDC_ENCODING_MACINTOSH, "macintosh", IDS_ENCODING_WESTERN }, |
51 { IDC_ENCODING_ISO88592, "ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, | 50 { IDC_ENCODING_ISO88592, "ISO-8859-2", IDS_ENCODING_CENTRAL_EUROPEAN }, |
52 { IDC_ENCODING_WINDOWS1250, "windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, | 51 { IDC_ENCODING_WINDOWS1250, "windows-1250", IDS_ENCODING_CENTRAL_EUROPEAN }, |
53 { IDC_ENCODING_ISO88595, "ISO-8859-5", IDS_ENCODING_CYRILLIC }, | 52 { IDC_ENCODING_ISO88595, "ISO-8859-5", IDS_ENCODING_CYRILLIC }, |
54 { IDC_ENCODING_WINDOWS1251, "windows-1251", IDS_ENCODING_CYRILLIC }, | 53 { IDC_ENCODING_WINDOWS1251, "windows-1251", IDS_ENCODING_CYRILLIC }, |
55 { IDC_ENCODING_KOI8R, "KOI8-R", IDS_ENCODING_CYRILLIC }, | 54 { IDC_ENCODING_KOI8R, "KOI8-R", IDS_ENCODING_CYRILLIC }, |
56 { IDC_ENCODING_KOI8U, "KOI8-U", IDS_ENCODING_CYRILLIC }, | 55 { IDC_ENCODING_KOI8U, "KOI8-U", IDS_ENCODING_CYRILLIC }, |
| 56 { IDC_ENCODING_IBM866, "IBM866", IDS_ENCODING_CYRILLIC }, |
57 { IDC_ENCODING_ISO88597, "ISO-8859-7", IDS_ENCODING_GREEK }, | 57 { IDC_ENCODING_ISO88597, "ISO-8859-7", IDS_ENCODING_GREEK }, |
58 { IDC_ENCODING_WINDOWS1253, "windows-1253", IDS_ENCODING_GREEK }, | 58 { IDC_ENCODING_WINDOWS1253, "windows-1253", IDS_ENCODING_GREEK }, |
59 { IDC_ENCODING_WINDOWS1254, "windows-1254", IDS_ENCODING_TURKISH }, | 59 { IDC_ENCODING_WINDOWS1254, "windows-1254", IDS_ENCODING_TURKISH }, |
60 { IDC_ENCODING_WINDOWS1256, "windows-1256", IDS_ENCODING_ARABIC }, | 60 { IDC_ENCODING_WINDOWS1256, "windows-1256", IDS_ENCODING_ARABIC }, |
61 { IDC_ENCODING_ISO88596, "ISO-8859-6", IDS_ENCODING_ARABIC }, | 61 { IDC_ENCODING_ISO88596, "ISO-8859-6", IDS_ENCODING_ARABIC }, |
62 { IDC_ENCODING_WINDOWS1255, "windows-1255", IDS_ENCODING_HEBREW }, | 62 { IDC_ENCODING_WINDOWS1255, "windows-1255", IDS_ENCODING_HEBREW }, |
63 { IDC_ENCODING_ISO88598I, "ISO-8859-8-I", IDS_ENCODING_HEBREW }, | 63 { IDC_ENCODING_ISO88598I, "ISO-8859-8-I", IDS_ENCODING_HEBREW }, |
64 { IDC_ENCODING_ISO88598, "ISO-8859-8", IDS_ENCODING_HEBREW }, | 64 { IDC_ENCODING_ISO88598, "ISO-8859-8", IDS_ENCODING_HEBREW }, |
65 { IDC_ENCODING_WINDOWS1258, "windows-1258", IDS_ENCODING_VIETNAMESE }, | 65 { IDC_ENCODING_WINDOWS1258, "windows-1258", IDS_ENCODING_VIETNAMESE }, |
66 { IDC_ENCODING_ISO88594, "ISO-8859-4", IDS_ENCODING_BALTIC }, | 66 { IDC_ENCODING_ISO88594, "ISO-8859-4", IDS_ENCODING_BALTIC }, |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 static CanonicalEncodingMap* singleton = new CanonicalEncodingMap; | 187 static CanonicalEncodingMap* singleton = new CanonicalEncodingMap; |
188 return singleton; | 188 return singleton; |
189 } | 189 } |
190 | 190 |
191 const int kDefaultEncodingMenus[] = { | 191 const int kDefaultEncodingMenus[] = { |
192 IDC_ENCODING_UTF16LE, | 192 IDC_ENCODING_UTF16LE, |
193 IDC_ENCODING_WINDOWS1252, | 193 IDC_ENCODING_WINDOWS1252, |
194 IDC_ENCODING_GBK, | 194 IDC_ENCODING_GBK, |
195 IDC_ENCODING_GB18030, | 195 IDC_ENCODING_GB18030, |
196 IDC_ENCODING_BIG5, | 196 IDC_ENCODING_BIG5, |
197 IDC_ENCODING_BIG5HKSCS, | |
198 IDC_ENCODING_KOREAN, | 197 IDC_ENCODING_KOREAN, |
199 IDC_ENCODING_SHIFTJIS, | 198 IDC_ENCODING_SHIFTJIS, |
200 IDC_ENCODING_EUCJP, | 199 IDC_ENCODING_EUCJP, |
201 IDC_ENCODING_ISO2022JP, | 200 IDC_ENCODING_ISO2022JP, |
202 IDC_ENCODING_THAI, | 201 IDC_ENCODING_THAI, |
203 IDC_ENCODING_ISO885915, | 202 IDC_ENCODING_ISO885915, |
204 IDC_ENCODING_MACINTOSH, | 203 IDC_ENCODING_MACINTOSH, |
205 IDC_ENCODING_ISO88592, | 204 IDC_ENCODING_ISO88592, |
206 IDC_ENCODING_WINDOWS1250, | 205 IDC_ENCODING_WINDOWS1250, |
207 IDC_ENCODING_ISO88595, | 206 IDC_ENCODING_ISO88595, |
208 IDC_ENCODING_WINDOWS1251, | 207 IDC_ENCODING_WINDOWS1251, |
209 IDC_ENCODING_KOI8R, | 208 IDC_ENCODING_KOI8R, |
210 IDC_ENCODING_KOI8U, | 209 IDC_ENCODING_KOI8U, |
| 210 IDC_ENCODING_IBM866, |
211 IDC_ENCODING_ISO88597, | 211 IDC_ENCODING_ISO88597, |
212 IDC_ENCODING_WINDOWS1253, | 212 IDC_ENCODING_WINDOWS1253, |
213 IDC_ENCODING_WINDOWS1254, | 213 IDC_ENCODING_WINDOWS1254, |
214 IDC_ENCODING_WINDOWS1256, | 214 IDC_ENCODING_WINDOWS1256, |
215 IDC_ENCODING_ISO88596, | 215 IDC_ENCODING_ISO88596, |
216 IDC_ENCODING_WINDOWS1255, | 216 IDC_ENCODING_WINDOWS1255, |
217 IDC_ENCODING_ISO88598I, | 217 IDC_ENCODING_ISO88598I, |
218 IDC_ENCODING_ISO88598, | 218 IDC_ENCODING_ISO88598, |
219 IDC_ENCODING_WINDOWS1258, | 219 IDC_ENCODING_WINDOWS1258, |
220 IDC_ENCODING_ISO88594, | 220 IDC_ENCODING_ISO88594, |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 // Insert new encoding to head of selected encoding list. | 519 // Insert new encoding to head of selected encoding list. |
520 *selected_encodings = encoding_name; | 520 *selected_encodings = encoding_name; |
521 // Generate the string for rest selected encoding list. | 521 // Generate the string for rest selected encoding list. |
522 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); | 522 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); |
523 it != selected_encoding_list.end(); ++it) { | 523 it != selected_encoding_list.end(); ++it) { |
524 selected_encodings->append(1, L','); | 524 selected_encodings->append(1, L','); |
525 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); | 525 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); |
526 } | 526 } |
527 return true; | 527 return true; |
528 } | 528 } |
OLD | NEW |