| 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 20 matching lines...) Expand all Loading... |
| 31 // +1 for "Add language". | 31 // +1 for "Add language". |
| 32 return get_languages_count() + 1 - ignore_set_.size(); | 32 return get_languages_count() + 1 - ignore_set_.size(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 string16 AddLanguageComboboxModel::GetItemAt(int index) { | 35 string16 AddLanguageComboboxModel::GetItemAt(int index) { |
| 36 // Show "Add language" as the first item. | 36 // Show "Add language" as the first item. |
| 37 if (index == 0) { | 37 if (index == 0) { |
| 38 return l10n_util::GetStringUTF16( | 38 return l10n_util::GetStringUTF16( |
| 39 IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX); | 39 IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX); |
| 40 } | 40 } |
| 41 return WideToUTF16Hack(GetLanguageNameAt(GetLanguageIndex(index))); | 41 return GetLanguageNameAt(GetLanguageIndex(index)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 int AddLanguageComboboxModel::GetLanguageIndex(int index) const { | 44 int AddLanguageComboboxModel::GetLanguageIndex(int index) const { |
| 45 // The adjusted_index is counted while ignoring languages in ignore_set_. | 45 // The adjusted_index is counted while ignoring languages in ignore_set_. |
| 46 int adjusted_index = 0; | 46 int adjusted_index = 0; |
| 47 for (int i = 0; i < get_languages_count(); ++i) { | 47 for (int i = 0; i < get_languages_count(); ++i) { |
| 48 if (ignore_set_.count(GetLocaleFromIndex(i)) > 0) { | 48 if (ignore_set_.count(GetLocaleFromIndex(i)) > 0) { |
| 49 continue; | 49 continue; |
| 50 } | 50 } |
| 51 // -1 for "Add language". | 51 // -1 for "Add language". |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 // Build the vectors from the sets. | 270 // Build the vectors from the sets. |
| 271 supported_language_codes_.assign(supported_language_code_set.begin(), | 271 supported_language_codes_.assign(supported_language_code_set.begin(), |
| 272 supported_language_code_set.end()); | 272 supported_language_code_set.end()); |
| 273 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), | 273 supported_input_method_ids_.assign(supported_input_method_id_set.begin(), |
| 274 supported_input_method_id_set.end()); | 274 supported_input_method_id_set.end()); |
| 275 } | 275 } |
| 276 | 276 |
| 277 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |