OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "language_options_util.h" |
| 6 |
| 7 #include "app/l10n_util.h" |
| 8 #include "base/values.h" |
| 9 |
| 10 namespace chromeos { |
| 11 |
| 12 ListValue* CreateMultipleChoiceList( |
| 13 const LanguageMultipleChoicePreference<const char*>& preference) { |
| 14 int list_length = 0; |
| 15 for (size_t i = 0; |
| 16 i < LanguageMultipleChoicePreference<const char*>::kMaxItems; |
| 17 ++i) { |
| 18 if (preference.values_and_ids[i].item_message_id == 0) |
| 19 break; |
| 20 ++list_length; |
| 21 } |
| 22 DCHECK_GT(list_length, 0); |
| 23 |
| 24 ListValue* list_value = new ListValue(); |
| 25 for (int i = 0; i < list_length; ++i) { |
| 26 ListValue* option = new ListValue(); |
| 27 option->Append(Value::CreateStringValue( |
| 28 preference.values_and_ids[i].ibus_config_value)); |
| 29 option->Append(Value::CreateStringValue(l10n_util::GetString( |
| 30 preference.values_and_ids[i].item_message_id))); |
| 31 list_value->Append(option); |
| 32 } |
| 33 return list_value; |
| 34 } |
| 35 |
| 36 } // namespace chromeos |
OLD | NEW |