| 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/chromeos/options/language_config_model.h" | 5 #include "chrome/browser/chromeos/options/language_config_model.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 Profile* profile, | 24 Profile* profile, |
| 25 const std::vector<std::string>& locale_codes) | 25 const std::vector<std::string>& locale_codes) |
| 26 : LanguageComboboxModel(profile, locale_codes) { | 26 : LanguageComboboxModel(profile, locale_codes) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 int AddLanguageComboboxModel::GetItemCount() { | 29 int AddLanguageComboboxModel::GetItemCount() { |
| 30 // +1 for "Add language". | 30 // +1 for "Add language". |
| 31 return get_languages_count() + 1 - ignore_set_.size(); | 31 return get_languages_count() + 1 - ignore_set_.size(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 std::wstring AddLanguageComboboxModel::GetItemAt(int index) { | 34 string16 AddLanguageComboboxModel::GetItemAt(int index) { |
| 35 // Show "Add language" as the first item. | 35 // Show "Add language" as the first item. |
| 36 if (index == 0) { | 36 if (index == 0) { |
| 37 return l10n_util::GetString( | 37 return l10n_util::GetStringUTF16( |
| 38 IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX); | 38 IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX); |
| 39 } | 39 } |
| 40 return GetLanguageNameAt(GetLanguageIndex(index)); | 40 return WideToUTF16Hack(GetLanguageNameAt(GetLanguageIndex(index))); |
| 41 } | 41 } |
| 42 | 42 |
| 43 int AddLanguageComboboxModel::GetLanguageIndex(int index) const { | 43 int AddLanguageComboboxModel::GetLanguageIndex(int index) const { |
| 44 // The adjusted_index is counted while ignoring languages in ignore_set_. | 44 // The adjusted_index is counted while ignoring languages in ignore_set_. |
| 45 int adjusted_index = 0; | 45 int adjusted_index = 0; |
| 46 for (int i = 0; i < get_languages_count(); ++i) { | 46 for (int i = 0; i < get_languages_count(); ++i) { |
| 47 if (ignore_set_.count(GetLocaleFromIndex(i)) > 0) { | 47 if (ignore_set_.count(GetLocaleFromIndex(i)) > 0) { |
| 48 continue; | 48 continue; |
| 49 } | 49 } |
| 50 // -1 for "Add language". | 50 // -1 for "Add language". |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 } | 267 } |
| 268 | 268 |
| 269 // Build the vectors from the sets. | 269 // Build the vectors from the sets. |
| 270 supported_language_codes_.assign(supported_language_code_set.begin(), | 270 supported_language_codes_.assign(supported_language_code_set.begin(), |
| 271 supported_language_code_set.end()); | 271 supported_language_code_set.end()); |
| 272 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), | 272 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), |
| 273 supported_input_method_id_set.end()); | 273 supported_input_method_id_set.end()); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace chromeos | 276 } // namespace chromeos |
| OLD | NEW |