| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return std::wstring(); | 337 return std::wstring(); |
| 338 } | 338 } |
| 339 | 339 |
| 340 // Static | 340 // Static |
| 341 // According to the behavior of user recently selected encoding short list in | 341 // According to the behavior of user recently selected encoding short list in |
| 342 // FireFox, we always put UTF-8 as toppest position, after then put user | 342 // FireFox, we always put UTF-8 as toppest position, after then put user |
| 343 // recently selected encodings, then put local dependent encoding items. | 343 // recently selected encodings, then put local dependent encoding items. |
| 344 // At last, we put all rest encoding items. | 344 // At last, we put all rest encoding items. |
| 345 const std::vector<CharacterEncoding::EncodingInfo>* | 345 const std::vector<CharacterEncoding::EncodingInfo>* |
| 346 CharacterEncoding::GetCurrentDisplayEncodings( | 346 CharacterEncoding::GetCurrentDisplayEncodings( |
| 347 const std::wstring& locale, | 347 const std::string& locale, |
| 348 const std::wstring& locale_encodings, | 348 const std::wstring& locale_encodings, |
| 349 const std::wstring& recently_select_encodings) { | 349 const std::wstring& recently_select_encodings) { |
| 350 std::vector<int>* const locale_dependent_encoding_list = | 350 std::vector<int>* const locale_dependent_encoding_list = |
| 351 canonical_encoding_name_map_singleton.locale_dependent_encoding_ids(); | 351 canonical_encoding_name_map_singleton.locale_dependent_encoding_ids(); |
| 352 std::vector<CharacterEncoding::EncodingInfo>* const encoding_list = | 352 std::vector<CharacterEncoding::EncodingInfo>* const encoding_list = |
| 353 canonical_encoding_name_map_singleton.current_display_encodings(); | 353 canonical_encoding_name_map_singleton.current_display_encodings(); |
| 354 | 354 |
| 355 // Initialize locale dependent static encoding list. | 355 // Initialize locale dependent static encoding list. |
| 356 if (locale_dependent_encoding_list->empty() && !locale_encodings.empty()) | 356 if (locale_dependent_encoding_list->empty() && !locale_encodings.empty()) |
| 357 ParseEncodingListSeparatedWithComma(locale_encodings, | 357 ParseEncodingListSeparatedWithComma(locale_encodings, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 // Insert new encoding to head of selected encoding list. | 466 // Insert new encoding to head of selected encoding list. |
| 467 *selected_encodings = encoding_name; | 467 *selected_encodings = encoding_name; |
| 468 // Generate the string for rest selected encoding list. | 468 // Generate the string for rest selected encoding list. |
| 469 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); | 469 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); |
| 470 it != selected_encoding_list.end(); ++it) { | 470 it != selected_encoding_list.end(); ++it) { |
| 471 selected_encodings->append(1, L','); | 471 selected_encodings->append(1, L','); |
| 472 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); | 472 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); |
| 473 } | 473 } |
| 474 return true; | 474 return true; |
| 475 } | 475 } |
| OLD | NEW |