diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 07:02:49 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-28 07:02:49 +0000 |
commit | 871c71501430e4cf4d083cf44999891c34b77038 (patch) | |
tree | 35ed9c641bbca8e5dbc2a1dbc5d893fb34e6f312 | |
parent | 115f5540fcfb3e33e74e5ad7c4793aebd5513a9e (diff) | |
download | chromium_src-871c71501430e4cf4d083cf44999891c34b77038.zip chromium_src-871c71501430e4cf4d083cf44999891c34b77038.tar.gz chromium_src-871c71501430e4cf4d083cf44999891c34b77038.tar.bz2 |
Add remaining stuff for Mozc configuration DOMUI.
This still lacks "Reset to default" button which original
configuration dialog has, but all configuration items
are implemented.
Review URL: http://codereview.chromium.org/3043023
Patch from Takayoshi Kochi <kochi@chromium.org>.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@53918 0039d316-1c4b-4281-b951-d872f2087c98
7 files changed, 131 insertions, 31 deletions
diff --git a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc index 34cd5be..ba71eb2 100644 --- a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc @@ -14,34 +14,6 @@ #include "chrome/browser/chromeos/language_preferences.h" #include "grit/generated_resources.h" -namespace { - -ListValue* CreateMultipleChoiceList( - const chromeos::LanguageMultipleChoicePreference<const char*>& preference) { - int list_length = 0; - for (size_t i = 0; - i < chromeos::LanguageMultipleChoicePreference<const char*>::kMaxItems; - ++i) { - if (preference.values_and_ids[i].item_message_id == 0) - break; - ++list_length; - } - DCHECK_GT(list_length, 0); - - ListValue* list_value = new ListValue(); - for (int i = 0; i < list_length; ++i) { - ListValue* option = new ListValue(); - option->Append(Value::CreateStringValue( - preference.values_and_ids[i].ibus_config_value)); - option->Append(Value::CreateStringValue(l10n_util::GetString( - preference.values_and_ids[i].item_message_id))); - list_value->Append(option); - } - return list_value; -} - -} // namespace - LanguageChewingOptionsHandler::LanguageChewingOptionsHandler() { } @@ -81,7 +53,7 @@ void LanguageChewingOptionsHandler::GetLocalizedValues( l10n_util::GetString(preference.label_message_id)); localized_strings->Set( GetTemplateDataPropertyName(preference), - CreateMultipleChoiceList(preference)); + chromeos::CreateMultipleChoiceList(preference)); } localized_strings->SetString( diff --git a/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc index 456006b..0bfe96f2c 100644 --- a/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc +++ b/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc @@ -25,4 +25,14 @@ void LanguageMozcOptionsHandler::GetLocalizedValues( GetI18nContentValue(chromeos::kMozcBooleanPrefs[i]), l10n_util::GetString(chromeos::kMozcBooleanPrefs[i].message_id)); } + + for (size_t i = 0; i < arraysize(chromeos::kMozcMultipleChoicePrefs); ++i) { + const chromeos::LanguageMultipleChoicePreference<const char*>& preference = + chromeos::kMozcMultipleChoicePrefs[i]; + localized_strings->SetString( + GetI18nContentValue(preference), + l10n_util::GetString(preference.label_message_id)); + localized_strings->Set(GetTemplateDataPropertyName(preference), + chromeos::CreateMultipleChoiceList(preference)); + } } diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.cc b/chrome/browser/chromeos/dom_ui/language_options_util.cc new file mode 100644 index 0000000..6c62f68 --- /dev/null +++ b/chrome/browser/chromeos/dom_ui/language_options_util.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "language_options_util.h" + +#include "app/l10n_util.h" +#include "base/values.h" + +namespace chromeos { + +ListValue* CreateMultipleChoiceList( + const LanguageMultipleChoicePreference<const char*>& preference) { + int list_length = 0; + for (size_t i = 0; + i < LanguageMultipleChoicePreference<const char*>::kMaxItems; + ++i) { + if (preference.values_and_ids[i].item_message_id == 0) + break; + ++list_length; + } + DCHECK_GT(list_length, 0); + + ListValue* list_value = new ListValue(); + for (int i = 0; i < list_length; ++i) { + ListValue* option = new ListValue(); + option->Append(Value::CreateStringValue( + preference.values_and_ids[i].ibus_config_value)); + option->Append(Value::CreateStringValue(l10n_util::GetString( + preference.values_and_ids[i].item_message_id))); + list_value->Append(option); + } + return list_value; +} + +} // namespace chromeos diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.h b/chrome/browser/chromeos/dom_ui/language_options_util.h index 94b924e..6918e88 100644 --- a/chrome/browser/chromeos/dom_ui/language_options_util.h +++ b/chrome/browser/chromeos/dom_ui/language_options_util.h @@ -4,9 +4,13 @@ #ifndef CHROME_BROWSER_CHROMEOS_DOM_UI_LANGUAGE_OPTIONS_UTIL_H_ #define CHROME_BROWSER_CHROMEOS_DOM_UI_LANGUAGE_OPTIONS_UTIL_H_ +#pragma once +#include "base/string_util.h" #include "chrome/browser/chromeos/language_preferences.h" +class ListValue; + namespace { // Returns an i18n-content value corresponding to |preference|. @@ -37,4 +41,11 @@ std::wstring GetTemplateDataMaxName(const T& preference) { } // namespace +namespace chromeos { + +ListValue* CreateMultipleChoiceList( + const LanguageMultipleChoicePreference<const char*>& preference); + +} // namespace chromeos + #endif // CHROME_BROWSER_CHROMEOS_DOM_UI_LANGUAGE_OPTIONS_UTIL_H_ diff --git a/chrome/browser/resources/options/chromeos_language_mozc_options.html b/chrome/browser/resources/options/chromeos_language_mozc_options.html index c2ff8fc..b99a7fa 100644 --- a/chrome/browser/resources/options/chromeos_language_mozc_options.html +++ b/chrome/browser/resources/options/chromeos_language_mozc_options.html @@ -31,7 +31,8 @@ id="mozc-use-single-kanji-conversion" pref="settings.language.mozc_use_single_kanji_conversion" type="checkbox"> - <span i18n-content="use_single_kanji_conversionContent"></span></label> + <span i18n-content="use_single_kanji_conversionContent"></span> + </label> </td> </tr> <tr> @@ -66,6 +67,74 @@ <span i18n-content="use_dictionary_suggestContent"></span></label> </td> </tr> + <tr> + <td class="option-name" i18n-content="preedit_methodContent"></td> + <td class="option-value"> + <select id="mozc-preedit-method" class="control" + pref="settings.language.mozc_preedit_method" + data-values="preedit_methodValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="session_keymapContent"></td> + <td class="option-value"> + <select id="mozc-session-keymap" class="control" + pref="settings.language.mozc_session_keymap" + data-values="session_keymapValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="punctuation_methodContent"></td> + <td class="option-value"> + <select id="mozc-punctuation-method" class="control" + pref="settings.language.mozc_punctuation_method" + data-values="punctuation_methodValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="symbol_methodContent"></td> + <td class="option-value"> + <select id="mozc-symbol-method" class="control" + pref="settings.language.mozc_symbol_method" + data-values="symbol_methodValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="space_character_formContent"> + </td> + <td class="option-value"> + <select id="mozc-space-character-form" class="control" + pref="settings.language.mozc_space_character_form" + data-values="space_character_formValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="history_learning_levelContent"> + </td> + <td class="option-value"> + <select id="mozc-history-learning-level" class="control" + pref="settings.language.mozc_history_learning_level" + data-values="history_learning_levelValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="shift_key_mode_switchContent"> + </td> + <td class="option-value"> + <select id="mozc-shift-key-mode-switch" class="control" + pref="settings.language.mozc_shift_key_mode_switch" + data-values="shift_key_mode_switchValue"></select> + </td> + </tr> + <tr> + <td class="option-name" i18n-content="numpad_character_formContent"> + </td> + <td class="option-value"> + <select id="mozc-numpad-character-form" class="control" + pref="settings.language.mozc_numpad_character_form" + data-values="numpad_character_formValue"></select> + </td> + </tr> </table> </section> </div> diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 8f28623..5374e50 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -410,6 +410,8 @@ 'browser/chromeos/dom_ui/language_mozc_options_handler.h', 'browser/chromeos/dom_ui/language_options_handler.cc', 'browser/chromeos/dom_ui/language_options_handler.h', + 'browser/chromeos/dom_ui/language_options_util.cc', + 'browser/chromeos/dom_ui/language_options_util.h', 'browser/chromeos/dom_ui/language_pinyin_options_handler.cc', 'browser/chromeos/dom_ui/language_pinyin_options_handler.h', 'browser/chromeos/dom_ui/system_options_handler.cc', diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc index dd994ac..72bb0c5 100644 --- a/chrome/common/pref_names.cc +++ b/chrome/common/pref_names.cc @@ -303,7 +303,7 @@ const wchar_t kLanguagePinyinLookupTablePageSize[] = const wchar_t kLanguageMozcPreeditMethod[] = L"settings.language.mozc_preedit_method"; const wchar_t kLanguageMozcSessionKeymap[] = - L"settings.language.mozc_sessoin_keymap"; + L"settings.language.mozc_session_keymap"; const wchar_t kLanguageMozcPunctuationMethod[] = L"settings.language.mozc_punctuation_method"; const wchar_t kLanguageMozcSymbolMethod[] = |