| 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" |
| 11 #include "app/l10n_util_collator.h" | 11 #include "app/l10n_util_collator.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/string_tokenizer.h" | 14 #include "base/string_tokenizer.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/app/chrome_dll_resource.h" | 17 #include "chrome/app/chrome_dll_resource.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "unicode/ucnv.h" | 19 #include "unicode/ucnv.h" |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 | 22 |
| 22 // The maximum length of short list of recently user selected encodings is 3. | 23 // The maximum length of short list of recently user selected encodings is 3. |
| 23 const size_t kUserSelectedEncodingsMaxLength = 3; | 24 const size_t kUserSelectedEncodingsMaxLength = 3; |
| 24 | 25 |
| 25 typedef struct { | 26 typedef struct { |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 // Insert new encoding to head of selected encoding list. | 538 // Insert new encoding to head of selected encoding list. |
| 538 *selected_encodings = encoding_name; | 539 *selected_encodings = encoding_name; |
| 539 // Generate the string for rest selected encoding list. | 540 // Generate the string for rest selected encoding list. |
| 540 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); | 541 for (std::vector<int>::const_iterator it = selected_encoding_list.begin(); |
| 541 it != selected_encoding_list.end(); ++it) { | 542 it != selected_encoding_list.end(); ++it) { |
| 542 selected_encodings->append(1, L','); | 543 selected_encodings->append(1, L','); |
| 543 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); | 544 selected_encodings->append(GetCanonicalEncodingNameByCommandId(*it)); |
| 544 } | 545 } |
| 545 return true; | 546 return true; |
| 546 } | 547 } |
| OLD | NEW |