| 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/dom_ui/language_pinyin_options_handler.h" | 5 #include "chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chromeos/dom_ui/language_options_util.h" | 9 #include "chrome/browser/chromeos/dom_ui/language_options_util.h" |
| 10 #include "chrome/browser/chromeos/language_preferences.h" | 10 #include "chrome/browser/chromeos/language_preferences.h" |
| 11 #include "grit/generated_resources.h" | 11 #include "grit/generated_resources.h" |
| 12 | 12 |
| 13 // TODO(kochi): Add prefix for each language (e.g. "Pinyin") for each i18n | 13 // TODO(kochi): Add prefix for each language (e.g. "Pinyin") for each i18n |
| 14 // identifier. | 14 // identifier. |
| 15 | 15 |
| 16 namespace chromeos { |
| 17 |
| 16 LanguagePinyinOptionsHandler::LanguagePinyinOptionsHandler() { | 18 LanguagePinyinOptionsHandler::LanguagePinyinOptionsHandler() { |
| 17 } | 19 } |
| 18 | 20 |
| 19 LanguagePinyinOptionsHandler::~LanguagePinyinOptionsHandler() { | 21 LanguagePinyinOptionsHandler::~LanguagePinyinOptionsHandler() { |
| 20 } | 22 } |
| 21 | 23 |
| 22 void LanguagePinyinOptionsHandler::GetLocalizedValues( | 24 void LanguagePinyinOptionsHandler::GetLocalizedValues( |
| 23 DictionaryValue* localized_strings) { | 25 DictionaryValue* localized_strings) { |
| 24 DCHECK(localized_strings); | 26 DCHECK(localized_strings); |
| 25 // Language Pinyin page - ChromeOS | 27 // Language Pinyin page - ChromeOS |
| 26 for (size_t i = 0; i < chromeos::kNumPinyinBooleanPrefs; ++i) { | 28 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { |
| 27 localized_strings->SetString( | 29 localized_strings->SetString( |
| 28 GetI18nContentValue(chromeos::kPinyinBooleanPrefs[i]), | 30 GetI18nContentValue(kPinyinBooleanPrefs[i]), |
| 29 l10n_util::GetString(chromeos::kPinyinBooleanPrefs[i].message_id)); | 31 l10n_util::GetString(kPinyinBooleanPrefs[i].message_id)); |
| 30 } | 32 } |
| 31 | 33 |
| 32 localized_strings->SetString( | 34 localized_strings->SetString( |
| 33 GetI18nContentValue(chromeos::kPinyinDoublePinyinSchema), | 35 GetI18nContentValue(kPinyinDoublePinyinSchema), |
| 34 l10n_util::GetString( | 36 l10n_util::GetString( |
| 35 chromeos::kPinyinDoublePinyinSchema.label_message_id)); | 37 kPinyinDoublePinyinSchema.label_message_id)); |
| 36 ListValue* list_value = new ListValue(); | 38 ListValue* list_value = new ListValue(); |
| 37 for (size_t i = 0; | 39 for (size_t i = 0; |
| 38 i < chromeos::LanguageMultipleChoicePreference<int>::kMaxItems; | 40 i < LanguageMultipleChoicePreference<int>::kMaxItems; |
| 39 ++i) { | 41 ++i) { |
| 40 if (chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. | 42 if (kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 41 item_message_id == 0) | 43 item_message_id == 0) |
| 42 break; | 44 break; |
| 43 ListValue* option = new ListValue(); | 45 ListValue* option = new ListValue(); |
| 44 option->Append(Value::CreateIntegerValue( | 46 option->Append(Value::CreateIntegerValue( |
| 45 chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. | 47 kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 46 ibus_config_value)); | 48 ibus_config_value)); |
| 47 option->Append(Value::CreateStringValue(l10n_util::GetString( | 49 option->Append(Value::CreateStringValue(l10n_util::GetString( |
| 48 chromeos::kPinyinDoublePinyinSchema.values_and_ids[i]. | 50 kPinyinDoublePinyinSchema.values_and_ids[i]. |
| 49 item_message_id))); | 51 item_message_id))); |
| 50 list_value->Append(option); | 52 list_value->Append(option); |
| 51 } | 53 } |
| 52 localized_strings->Set( | 54 localized_strings->Set( |
| 53 GetTemplateDataPropertyName(chromeos::kPinyinDoublePinyinSchema), | 55 GetTemplateDataPropertyName(kPinyinDoublePinyinSchema), |
| 54 list_value); | 56 list_value); |
| 55 } | 57 } |
| 58 |
| 59 } // namespace chromeos |
| OLD | NEW |