Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 int category_id = GetEncodingCategoryStringIdByCommandId(id); | 286 int category_id = GetEncodingCategoryStringIdByCommandId(id); |
| 287 if (category_id) | 287 if (category_id) |
| 288 return l10n_util::GetStringUTF8(category_id); | 288 return l10n_util::GetStringUTF8(category_id); |
| 289 return std::string(); | 289 return std::string(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 } // namespace | 292 } // namespace |
| 293 | 293 |
| 294 CharacterEncoding::EncodingInfo::EncodingInfo(int id) | 294 CharacterEncoding::EncodingInfo::EncodingInfo(int id) |
| 295 : encoding_id(id) { | 295 : encoding_id(id) { |
| 296 encoding_category_name = UTF8ToWide(GetEncodingCategoryStringByCommandId(id)); | 296 encoding_category_name = |
| 297 encoding_display_name = UTF16ToWideHack( | 297 UTF8ToUTF16(GetEncodingCategoryStringByCommandId(id)); |
|
Evan Martin
2010/12/24 01:00:42
one line?
| |
| 298 GetCanonicalEncodingDisplayNameByCommandId(id)); | 298 encoding_display_name = GetCanonicalEncodingDisplayNameByCommandId(id); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // Static. | 301 // Static. |
| 302 int CharacterEncoding::GetCommandIdByCanonicalEncodingName( | 302 int CharacterEncoding::GetCommandIdByCanonicalEncodingName( |
| 303 const std::string& encoding_name) { | 303 const std::string& encoding_name) { |
| 304 const CanonicalEncodingNameToIdMapType* map = | 304 const CanonicalEncodingNameToIdMapType* map = |
| 305 canonical_encoding_name_map_singleton. | 305 canonical_encoding_name_map_singleton. |
| 306 GetCanonicalEncodingNameToIdMapData(); | 306 GetCanonicalEncodingNameToIdMapData(); |
| 307 DCHECK(map); | 307 DCHECK(map); |
| 308 | 308 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 538 // Insert new encoding to head of selected encoding list. | 538 // Insert new encoding to head of selected encoding list. |
| 539 *selected_encodings = encoding_name; | 539 *selected_encodings = encoding_name; |
| 540 // Generate the string for rest selected encoding list. | 540 // Generate the string for rest selected encoding list. |
| 541 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); | 541 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); |
| 542 it != selected_encoding_list.end(); ++it) { | 542 it != selected_encoding_list.end(); ++it) { |
| 543 selected_encodings->append(1, L','); | 543 selected_encodings->append(1, L','); |
| 544 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); | 544 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); |
| 545 } | 545 } |
| 546 return true; | 546 return true; |
| 547 } | 547 } |
| OLD | NEW |