summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-20 02:50:23 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-20 02:50:23 +0000
commitb65c5d24f7c869b7caefe14533ae83e71c200101 (patch)
treecaa6ee0a19c95b014acba45b109862291036551f
parentc3b3e06a5b08d71e8fe0642c2aacd480cee5b691 (diff)
downloadchromium_src-b65c5d24f7c869b7caefe14533ae83e71c200101.zip
chromium_src-b65c5d24f7c869b7caefe14533ae83e71c200101.tar.gz
chromium_src-b65c5d24f7c869b7caefe14533ae83e71c200101.tar.bz2
Add language_prefs namespace to language_preferences.h.
language_preferences.h exports lots of constants hence polutes chromeos namespace. TEST=compiles. try bots. BUG=chromium-os:5848 Review URL: http://codereview.chromium.org/3132023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56803 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/cros/input_method_library.cc15
-rw-r--r--chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc28
-rw-r--r--chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc6
-rw-r--r--chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc18
-rw-r--r--chrome/browser/chromeos/dom_ui/language_options_util.h4
-rw-r--r--chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc21
-rw-r--r--chrome/browser/chromeos/dom_ui/system_options_handler.cc13
-rw-r--r--chrome/browser/chromeos/input_method/input_method_util.cc7
-rw-r--r--chrome/browser/chromeos/language_preferences.cc4
-rw-r--r--chrome/browser/chromeos/language_preferences.h2
-rw-r--r--chrome/browser/chromeos/language_preferences_unittest.cc2
-rw-r--r--chrome/browser/chromeos/login/language_switch_menu.cc6
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc14
-rw-r--r--chrome/browser/chromeos/login/wizard_controller.cc2
-rw-r--r--chrome/browser/chromeos/options/language_chewing_config_view.cc61
-rw-r--r--chrome/browser/chromeos/options/language_chewing_config_view.h14
-rw-r--r--chrome/browser/chromeos/options/language_config_util.h8
-rw-r--r--chrome/browser/chromeos/options/language_hangul_config_view.cc8
-rw-r--r--chrome/browser/chromeos/options/language_mozc_config_view.cc71
-rw-r--r--chrome/browser/chromeos/options/language_mozc_config_view.h6
-rw-r--r--chrome/browser/chromeos/options/language_pinyin_config_view.cc23
-rw-r--r--chrome/browser/chromeos/options/language_pinyin_config_view.h6
-rw-r--r--chrome/browser/chromeos/options/system_page_view.cc44
-rw-r--r--chrome/browser/chromeos/preferences.cc253
-rw-r--r--chrome/browser/chromeos/preferences.h22
-rw-r--r--chrome/browser/chromeos/status/language_menu_button.cc5
26 files changed, 379 insertions, 284 deletions
diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc
index e4a53b3..d3c51b7 100644
--- a/chrome/browser/chromeos/cros/input_method_library.cc
+++ b/chrome/browser/chromeos/cros/input_method_library.cc
@@ -50,7 +50,7 @@ class InputMethodLibraryImpl : public InputMethodLibrary {
ime_running_(false),
ime_connected_(false),
defer_ime_startup_(false),
- active_input_method_(kHardwareKeyboardLayout),
+ active_input_method_(language_prefs::kHardwareKeyboardLayout),
need_input_method_set_(false),
ime_handle_(0),
candidate_window_handle_(0),
@@ -105,7 +105,7 @@ class InputMethodLibraryImpl : public InputMethodLibrary {
void ChangeInputMethod(const std::string& input_method_id) {
active_input_method_ = input_method_id;
if (EnsureLoadedAndStarted()) {
- if (input_method_id != kHardwareKeyboardLayout) {
+ if (input_method_id != language_prefs::kHardwareKeyboardLayout) {
StartInputMethodProcesses();
}
chromeos::ChangeInputMethod(
@@ -171,12 +171,13 @@ class InputMethodLibraryImpl : public InputMethodLibrary {
const char* section,
const char* config_name,
const ImeConfigValue& value) {
- if (!strcmp(kGeneralSectionName, section) &&
- !strcmp(kPreloadEnginesConfigName, config_name)) {
+ if (!strcmp(language_prefs::kGeneralSectionName, section) &&
+ !strcmp(language_prefs::kPreloadEnginesConfigName, config_name)) {
if (EnsureLoadedAndStarted()) {
if (value.type == ImeConfigValue::kValueTypeStringList &&
value.string_list_value.size() == 1 &&
- value.string_list_value[0] == kHardwareKeyboardLayout) {
+ value.string_list_value[0] ==
+ language_prefs::kHardwareKeyboardLayout) {
StopInputMethodProcesses();
} else if (!defer_ime_startup_) {
StartInputMethodProcesses();
@@ -201,7 +202,7 @@ class InputMethodLibraryImpl : public InputMethodLibrary {
config_name.c_str(),
value)) {
// Check if it's a change in active input methods.
- if (config_name == kPreloadEnginesConfigName) {
+ if (config_name == language_prefs::kPreloadEnginesConfigName) {
active_input_methods_are_changed = true;
}
// Successfully sent. Remove the command and proceed to the next one.
@@ -450,7 +451,7 @@ class InputMethodLibraryImpl : public InputMethodLibrary {
ime_running_ = false;
if (ime_handle_) {
chromeos::ChangeInputMethod(input_method_status_connection_,
- kHardwareKeyboardLayout);
+ language_prefs::kHardwareKeyboardLayout);
kill(ime_handle_, SIGTERM);
ime_handle_ = 0;
}
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 ec2cfdd..77c6b60 100644
--- a/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_chewing_options_handler.cc
@@ -27,15 +27,16 @@ void LanguageChewingOptionsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
DCHECK(localized_strings);
// Language Chewing page - ChromeOS
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
localized_strings->SetString(
- GetI18nContentValue(kChewingBooleanPrefs[i]),
- l10n_util::GetStringUTF16(kChewingBooleanPrefs[i].message_id));
+ GetI18nContentValue(language_prefs::kChewingBooleanPrefs[i]),
+ l10n_util::GetStringUTF16(
+ language_prefs::kChewingBooleanPrefs[i].message_id));
}
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
- const LanguageIntegerRangePreference& preference =
- kChewingIntegerPrefs[i];
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
+ const language_prefs::LanguageIntegerRangePreference& preference =
+ language_prefs::kChewingIntegerPrefs[i];
localized_strings->SetString(
GetI18nContentValue(preference),
l10n_util::GetStringUTF16(preference.message_id));
@@ -47,10 +48,10 @@ void LanguageChewingOptionsHandler::GetLocalizedValues(
base::IntToString(preference.max_pref_value));
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs;
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs;
++i) {
- const LanguageMultipleChoicePreference<const char*>& preference =
- kChewingMultipleChoicePrefs[i];
+ const language_prefs::LanguageMultipleChoicePreference<const char*>&
+ preference = language_prefs::kChewingMultipleChoicePrefs[i];
localized_strings->SetString(
GetI18nContentValue(preference),
l10n_util::GetStringUTF16(preference.label_message_id));
@@ -60,11 +61,12 @@ void LanguageChewingOptionsHandler::GetLocalizedValues(
}
localized_strings->SetString(
- GetI18nContentValue(kChewingHsuSelKeyType),
- l10n_util::GetStringUTF16(kChewingHsuSelKeyType.label_message_id));
+ GetI18nContentValue(language_prefs::kChewingHsuSelKeyType),
+ l10n_util::GetStringUTF16(
+ language_prefs::kChewingHsuSelKeyType.label_message_id));
localized_strings->Set(
- GetTemplateDataPropertyName(kChewingHsuSelKeyType),
- CreateMultipleChoiceList(kChewingHsuSelKeyType));
+ GetTemplateDataPropertyName(language_prefs::kChewingHsuSelKeyType),
+ CreateMultipleChoiceList(language_prefs::kChewingHsuSelKeyType));
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc
index f645cf5..df877d1 100644
--- a/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_hangul_options_handler.cc
@@ -30,12 +30,12 @@ void LanguageHangulOptionsHandler::GetLocalizedValues(
ListValue* LanguageHangulOptionsHandler::GetKeyboardLayoutList() {
ListValue* keyboard_layout_list = new ListValue();
- for (size_t i = 0; i < kNumHangulKeyboardNameIDPairs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumHangulKeyboardNameIDPairs; ++i) {
ListValue* option = new ListValue();
option->Append(Value::CreateStringValue(
- kHangulKeyboardNameIDPairs[i].keyboard_id));
+ language_prefs::kHangulKeyboardNameIDPairs[i].keyboard_id));
option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16(
- kHangulKeyboardNameIDPairs[i].message_id)));
+ language_prefs::kHangulKeyboardNameIDPairs[i].message_id)));
keyboard_layout_list->Append(option);
}
return keyboard_layout_list;
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 17d900b..7fbdc41 100644
--- a/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_mozc_options_handler.cc
@@ -24,15 +24,16 @@ void LanguageMozcOptionsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
DCHECK(localized_strings);
// Language Mozc page - ChromeOS
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
localized_strings->SetString(
- GetI18nContentValue(kMozcBooleanPrefs[i]),
- l10n_util::GetStringUTF16(kMozcBooleanPrefs[i].message_id));
+ GetI18nContentValue(language_prefs::kMozcBooleanPrefs[i]),
+ l10n_util::GetStringUTF16(
+ language_prefs::kMozcBooleanPrefs[i].message_id));
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
- const LanguageMultipleChoicePreference<const char*>& preference =
- kMozcMultipleChoicePrefs[i];
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
+ const language_prefs::LanguageMultipleChoicePreference<const char*>&
+ preference = language_prefs::kMozcMultipleChoicePrefs[i];
localized_strings->SetString(
GetI18nContentValue(preference),
l10n_util::GetStringUTF16(preference.label_message_id));
@@ -40,8 +41,9 @@ void LanguageMozcOptionsHandler::GetLocalizedValues(
CreateMultipleChoiceList(preference));
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
- const LanguageIntegerRangePreference& preference = kMozcIntegerPrefs[i];
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
+ const language_prefs::LanguageIntegerRangePreference& preference =
+ language_prefs::kMozcIntegerPrefs[i];
localized_strings->SetString(
GetI18nContentValue(preference),
l10n_util::GetStringUTF16(preference.message_id));
diff --git a/chrome/browser/chromeos/dom_ui/language_options_util.h b/chrome/browser/chromeos/dom_ui/language_options_util.h
index 3cfd564..1723d2d 100644
--- a/chrome/browser/chromeos/dom_ui/language_options_util.h
+++ b/chrome/browser/chromeos/dom_ui/language_options_util.h
@@ -62,10 +62,10 @@ namespace chromeos {
// Creates a multiple choice list from the given preference.
template <typename T>
ListValue* CreateMultipleChoiceList(
- const LanguageMultipleChoicePreference<T>& preference) {
+ const language_prefs::LanguageMultipleChoicePreference<T>& preference) {
int list_length = 0;
for (size_t i = 0;
- i < LanguageMultipleChoicePreference<T>::kMaxItems;
+ i < language_prefs::LanguageMultipleChoicePreference<T>::kMaxItems;
++i) {
if (preference.values_and_ids[i].item_message_id == 0)
break;
diff --git a/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc
index 7c1e3c8..00b110e 100644
--- a/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_pinyin_options_handler.cc
@@ -25,34 +25,35 @@ void LanguagePinyinOptionsHandler::GetLocalizedValues(
DictionaryValue* localized_strings) {
DCHECK(localized_strings);
// Language Pinyin page - ChromeOS
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
localized_strings->SetString(
- GetI18nContentValue(kPinyinBooleanPrefs[i]),
- l10n_util::GetStringUTF16(kPinyinBooleanPrefs[i].message_id));
+ GetI18nContentValue(language_prefs::kPinyinBooleanPrefs[i]),
+ l10n_util::GetStringUTF16(
+ language_prefs::kPinyinBooleanPrefs[i].message_id));
}
localized_strings->SetString(
- GetI18nContentValue(kPinyinDoublePinyinSchema),
+ GetI18nContentValue(language_prefs::kPinyinDoublePinyinSchema),
l10n_util::GetStringUTF16(
- kPinyinDoublePinyinSchema.label_message_id));
+ language_prefs::kPinyinDoublePinyinSchema.label_message_id));
ListValue* list_value = new ListValue();
for (size_t i = 0;
- i < LanguageMultipleChoicePreference<int>::kMaxItems;
+ i < language_prefs::LanguageMultipleChoicePreference<int>::kMaxItems;
++i) {
- if (kPinyinDoublePinyinSchema.values_and_ids[i].
+ if (language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i].
item_message_id == 0)
break;
ListValue* option = new ListValue();
option->Append(Value::CreateIntegerValue(
- kPinyinDoublePinyinSchema.values_and_ids[i].
+ language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i].
ibus_config_value));
option->Append(Value::CreateStringValue(l10n_util::GetStringUTF16(
- kPinyinDoublePinyinSchema.values_and_ids[i].
+ language_prefs::kPinyinDoublePinyinSchema.values_and_ids[i].
item_message_id)));
list_value->Append(option);
}
localized_strings->Set(
- GetTemplateDataPropertyName(kPinyinDoublePinyinSchema),
+ GetTemplateDataPropertyName(language_prefs::kPinyinDoublePinyinSchema),
list_value);
}
diff --git a/chrome/browser/chromeos/dom_ui/system_options_handler.cc b/chrome/browser/chromeos/dom_ui/system_options_handler.cc
index 507f42d..8dcaea0 100644
--- a/chrome/browser/chromeos/dom_ui/system_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/system_options_handler.cc
@@ -73,9 +73,11 @@ void SystemOptionsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_DELAY_LONG));
localized_strings->SetString("repeat_delay_min",
- base::IntToString(chromeos::kXkbAutoRepeatDelayPref.min_pref_value));
+ base::IntToString(
+ chromeos::language_prefs::kXkbAutoRepeatDelayPref.min_pref_value));
localized_strings->SetString("repeat_delay_max",
- base::IntToString(chromeos::kXkbAutoRepeatDelayPref.max_pref_value));
+ base::IntToString(
+ chromeos::language_prefs::kXkbAutoRepeatDelayPref.max_pref_value));
localized_strings->SetString("repeat_speed",
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_SPEED));
@@ -86,9 +88,11 @@ void SystemOptionsHandler::GetLocalizedValues(
l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_XKB_KEY_REPEAT_SPEED_SLOW));
localized_strings->SetString("repeat_speed_min",
- base::IntToString(chromeos::kXkbAutoRepeatIntervalPref.min_pref_value));
+ base::IntToString(
+ chromeos::language_prefs::kXkbAutoRepeatIntervalPref.min_pref_value));
localized_strings->SetString("repeat_speed_max",
- base::IntToString(chromeos::kXkbAutoRepeatIntervalPref.max_pref_value));
+ base::IntToString(
+ chromeos::language_prefs::kXkbAutoRepeatIntervalPref.max_pref_value));
localized_strings->SetString("accessibility_title",
l10n_util::GetStringUTF16(
@@ -101,4 +105,3 @@ void SystemOptionsHandler::GetLocalizedValues(
reinterpret_cast<chromeos::SystemSettingsProvider*>(
settings_provider_.get())->GetTimezoneList());
}
-
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index ee03a60..8248ae1 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -560,8 +560,8 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type,
GetInputMethodIdsFromLanguageCode(language_code, type, &input_method_ids);
if (std::count(input_method_ids.begin(), input_method_ids.end(),
- kHardwareKeyboardLayout) == 0) {
- input_method_ids.push_back(kHardwareKeyboardLayout);
+ language_prefs::kHardwareKeyboardLayout) == 0) {
+ input_method_ids.push_back(language_prefs::kHardwareKeyboardLayout);
}
// First, sort the vector by input method id, then by its display name.
std::sort(input_method_ids.begin(), input_method_ids.end());
@@ -572,7 +572,8 @@ void EnableInputMethods(const std::string& language_code, InputMethodType type,
value.type = ImeConfigValue::kValueTypeStringList;
value.string_list_value = input_method_ids;
InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary();
- library->SetImeConfig(kGeneralSectionName, kPreloadEnginesConfigName, value);
+ library->SetImeConfig(language_prefs::kGeneralSectionName,
+ language_prefs::kPreloadEnginesConfigName, value);
if (!initial_input_method_id.empty()) {
library->ChangeInputMethod(initial_input_method_id);
}
diff --git a/chrome/browser/chromeos/language_preferences.cc b/chrome/browser/chromeos/language_preferences.cc
index 8c45e8a..38c7ae7 100644
--- a/chrome/browser/chromeos/language_preferences.cc
+++ b/chrome/browser/chromeos/language_preferences.cc
@@ -8,6 +8,7 @@
#include "grit/generated_resources.h"
namespace chromeos {
+namespace language_prefs {
// ---------------------------------------------------------------------------
// For ibus-daemon
@@ -402,4 +403,5 @@ const LanguageIntegerRangePreference kXkbAutoRepeatIntervalPref = {
const char kPreferredKeyboardLayout[] = "PreferredKeyboardLayout";
const char kHardwareKeyboardLayout[] = "xkb:us::eng";
-} // chromeos
+} // namespace language_prefs
+} // namespace chromeos
diff --git a/chrome/browser/chromeos/language_preferences.h b/chrome/browser/chromeos/language_preferences.h
index f1bb333..69ca394 100644
--- a/chrome/browser/chromeos/language_preferences.h
+++ b/chrome/browser/chromeos/language_preferences.h
@@ -11,6 +11,7 @@
// This file defines types and declare variables used in "Languages and
// Input" settings in Chromium OS.
namespace chromeos {
+namespace language_prefs {
// The struct is used for preferences consisting of multiple choices, like
// punctuation types used in Japanese input method.
@@ -163,6 +164,7 @@ extern const char kPreferredKeyboardLayout[];
// crosbug.com/5579.
extern const char kHardwareKeyboardLayout[];
+} // language_prefs
} // chromeos
#endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
diff --git a/chrome/browser/chromeos/language_preferences_unittest.cc b/chrome/browser/chromeos/language_preferences_unittest.cc
index 02e744e..bb9d21e 100644
--- a/chrome/browser/chromeos/language_preferences_unittest.cc
+++ b/chrome/browser/chromeos/language_preferences_unittest.cc
@@ -10,6 +10,7 @@
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
+namespace language_prefs {
namespace {
@@ -137,4 +138,5 @@ TEST(LanguagePreferencesTest, TestDefaultValuesOfIntegerRangePrefs) {
&kXkbAutoRepeatIntervalPref, 1));
}
+} // namespace language_prefs
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index 884583b..0c3521b 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -99,9 +99,9 @@ void LanguageSwitchMenu::SwitchLanguage(const std::string& locale) {
ResourceBundle::ReloadSharedInstance(locale);
// Enable the keyboard layouts that are necessary for the new locale.
- chromeos::input_method::EnableInputMethods(
- locale, chromeos::input_method::kKeyboardLayoutsOnly,
- kHardwareKeyboardLayout);
+ input_method::EnableInputMethods(
+ locale, input_method::kKeyboardLayoutsOnly,
+ language_prefs::kHardwareKeyboardLayout);
// The following line does not seem to affect locale anyhow. Maybe in
// future..
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index 3272a9e..b9d7b25 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -109,9 +109,10 @@ class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer,
if (value.string_list_value.empty()) {
value.string_list_value.push_back(kFallbackInputMethodId); // US qwerty
}
- language->SetImeConfig(chromeos::kGeneralSectionName,
- chromeos::kPreloadEnginesConfigName,
- value);
+ language->SetImeConfig(
+ chromeos::language_prefs::kGeneralSectionName,
+ chromeos::language_prefs::kPreloadEnginesConfigName,
+ value);
}
}
@@ -124,9 +125,10 @@ class ScreenLockObserver : public chromeos::ScreenLockLibrary::Observer,
chromeos::ImeConfigValue value;
value.type = chromeos::ImeConfigValue::kValueTypeStringList;
value.string_list_value = saved_active_input_method_list_;
- language->SetImeConfig(chromeos::kGeneralSectionName,
- chromeos::kPreloadEnginesConfigName,
- value);
+ language->SetImeConfig(
+ chromeos::language_prefs::kGeneralSectionName,
+ chromeos::language_prefs::kPreloadEnginesConfigName,
+ value);
// Send previous input method id first so Ctrl+space would work fine.
if (!saved_previous_input_method_id_.empty())
language->ChangeInputMethod(saved_previous_input_method_id_);
diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc
index 0f5e94f..08ef6d0 100644
--- a/chrome/browser/chromeos/login/wizard_controller.cc
+++ b/chrome/browser/chromeos/login/wizard_controller.cc
@@ -763,7 +763,7 @@ void ShowLoginWizard(const std::string& first_screen_name,
const std::string locale = g_browser_process->GetApplicationLocale();
const std::string initial_input_method_id =
g_browser_process->local_state()->GetString(
- chromeos::kPreferredKeyboardLayout);
+ chromeos::language_prefs::kPreferredKeyboardLayout);
chromeos::input_method::EnableInputMethods(
locale, chromeos::input_method::kKeyboardLayoutsOnly,
initial_input_method_id);
diff --git a/chrome/browser/chromeos/options/language_chewing_config_view.cc b/chrome/browser/chromeos/options/language_chewing_config_view.cc
index a1da7ae..40a597e 100644
--- a/chrome/browser/chromeos/options/language_chewing_config_view.cc
+++ b/chrome/browser/chromeos/options/language_chewing_config_view.cc
@@ -25,29 +25,34 @@ namespace chromeos {
LanguageChewingConfigView::LanguageChewingConfigView(Profile* profile)
: OptionsPageView(profile), contents_(NULL) {
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
chewing_boolean_prefs_[i].Init(
- kChewingBooleanPrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kChewingBooleanPrefs[i].pref_name,
+ profile->GetPrefs(), this);
chewing_boolean_checkboxes_[i] = NULL;
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
current.multiple_choice_pref.Init(
- kChewingMultipleChoicePrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kChewingMultipleChoicePrefs[i].pref_name,
+ profile->GetPrefs(), this);
current.combobox_model =
- new LanguageComboboxModel<const char*>(&kChewingMultipleChoicePrefs[i]);
+ new LanguageComboboxModel<const char*>(
+ &language_prefs::kChewingMultipleChoicePrefs[i]);
current.combobox = NULL;
}
hsu_sel_key_type_.multiple_choice_pref.Init(
- kChewingHsuSelKeyType.pref_name, profile->GetPrefs(), this);
+ language_prefs::kChewingHsuSelKeyType.pref_name, profile->GetPrefs(),
+ this);
hsu_sel_key_type_.combobox_model =
- new LanguageComboboxModel<int>(&kChewingHsuSelKeyType);
+ new LanguageComboboxModel<int>(&language_prefs::kChewingHsuSelKeyType);
hsu_sel_key_type_.combobox = NULL;
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
chewing_integer_prefs_[i].Init(
- kChewingIntegerPrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kChewingIntegerPrefs[i].pref_name,
+ profile->GetPrefs(), this);
chewing_integer_sliders_[i] = NULL;
}
}
@@ -59,13 +64,14 @@ void LanguageChewingConfigView::ButtonPressed(
views::Button* sender, const views::Event& event) {
views::Checkbox* checkbox = static_cast<views::Checkbox*>(sender);
const int pref_id = checkbox->tag();
- DCHECK(pref_id >= 0 && pref_id < static_cast<int>(kNumChewingBooleanPrefs));
+ DCHECK(pref_id >= 0 && pref_id < static_cast<int>(
+ language_prefs::kNumChewingBooleanPrefs));
chewing_boolean_prefs_[pref_id].SetValue(checkbox->checked());
}
void LanguageChewingConfigView::ItemChanged(
views::Combobox* sender, int prev_index, int new_index) {
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
if (current.combobox == sender) {
const std::string config_value =
@@ -87,11 +93,12 @@ void LanguageChewingConfigView::ItemChanged(
void LanguageChewingConfigView::SliderValueChanged(views::Slider* sender) {
size_t pref_id;
- for (pref_id = 0; pref_id < kNumChewingIntegerPrefs; ++pref_id) {
+ for (pref_id = 0; pref_id < language_prefs::kNumChewingIntegerPrefs;
+ ++pref_id) {
if (chewing_integer_sliders_[pref_id] == sender)
break;
}
- DCHECK(pref_id < kNumChewingIntegerPrefs);
+ DCHECK(pref_id < language_prefs::kNumChewingIntegerPrefs);
chewing_integer_prefs_[pref_id].SetValue(sender->value());
}
@@ -144,13 +151,14 @@ void LanguageChewingConfigView::InitControlLayout() {
column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1,
GridLayout::USE_PREF, 0, 0);
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
chewing_boolean_checkboxes_[i] = new views::Checkbox(
- l10n_util::GetString(kChewingBooleanPrefs[i].message_id));
+ l10n_util::GetString(
+ language_prefs::kChewingBooleanPrefs[i].message_id));
chewing_boolean_checkboxes_[i]->set_listener(this);
chewing_boolean_checkboxes_[i]->set_tag(i);
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
current.combobox = new LanguageCombobox(current.combobox_model);
current.combobox->set_listener(this);
@@ -159,31 +167,32 @@ void LanguageChewingConfigView::InitControlLayout() {
new LanguageCombobox(hsu_sel_key_type_.combobox_model);
hsu_sel_key_type_.combobox->set_listener(this);
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
chewing_integer_sliders_[i] = new views::Slider(
- kChewingIntegerPrefs[i].min_pref_value,
- kChewingIntegerPrefs[i].max_pref_value,
+ language_prefs::kChewingIntegerPrefs[i].min_pref_value,
+ language_prefs::kChewingIntegerPrefs[i].max_pref_value,
1,
static_cast<views::Slider::StyleFlags>(
views::Slider::STYLE_DRAW_VALUE |
views::Slider::STYLE_UPDATE_ON_RELEASE),
this);
}
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
layout->StartRow(0, kColumnSetId);
layout->AddView(chewing_boolean_checkboxes_[i]);
}
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(
- l10n_util::GetString(kChewingIntegerPrefs[i].message_id)));
+ l10n_util::GetString(
+ language_prefs::kChewingIntegerPrefs[i].message_id)));
layout->AddView(chewing_integer_sliders_[i]);
}
NotifyPrefChanged();
// Show the comboboxes.
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
const ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(current.combobox_model->GetLabel()));
@@ -204,15 +213,15 @@ void LanguageChewingConfigView::Observe(NotificationType type,
}
void LanguageChewingConfigView::NotifyPrefChanged() {
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
const bool checked = chewing_boolean_prefs_[i].GetValue();
chewing_boolean_checkboxes_[i]->SetChecked(checked);
}
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
const int value = chewing_integer_prefs_[i].GetValue();
chewing_integer_sliders_[i]->SetValue(value);
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
ChewingPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
const std::string value = current.multiple_choice_pref.GetValue();
for (int i = 0; i < current.combobox_model->num_items(); ++i) {
diff --git a/chrome/browser/chromeos/options/language_chewing_config_view.h b/chrome/browser/chromeos/options/language_chewing_config_view.h
index 4a230f0..a018131 100644
--- a/chrome/browser/chromeos/options/language_chewing_config_view.h
+++ b/chrome/browser/chromeos/options/language_chewing_config_view.h
@@ -70,20 +70,24 @@ class LanguageChewingConfigView : public views::ButtonListener,
// Updates the chewing checkboxes.
void NotifyPrefChanged();
- BooleanPrefMember chewing_boolean_prefs_[kNumChewingBooleanPrefs];
- IntegerPrefMember chewing_integer_prefs_[kNumChewingIntegerPrefs];
+ BooleanPrefMember chewing_boolean_prefs_[
+ language_prefs::kNumChewingBooleanPrefs];
+ IntegerPrefMember chewing_integer_prefs_[
+ language_prefs::kNumChewingIntegerPrefs];
views::View* contents_;
// Checkboxes for Chewing.
- views::Checkbox* chewing_boolean_checkboxes_[kNumChewingBooleanPrefs];
+ views::Checkbox* chewing_boolean_checkboxes_[
+ language_prefs::kNumChewingBooleanPrefs];
- views::Slider* chewing_integer_sliders_[kNumChewingIntegerPrefs];
+ views::Slider* chewing_integer_sliders_[
+ language_prefs::kNumChewingIntegerPrefs];
struct ChewingPrefAndAssociatedCombobox {
StringPrefMember multiple_choice_pref;
LanguageComboboxModel<const char*>* combobox_model;
LanguageCombobox* combobox;
- } prefs_and_comboboxes_[kNumChewingMultipleChoicePrefs];
+ } prefs_and_comboboxes_[language_prefs::kNumChewingMultipleChoicePrefs];
struct HsuSelKeyTypePrefAndAssociatedCombobox {
IntegerPrefMember multiple_choice_pref;
diff --git a/chrome/browser/chromeos/options/language_config_util.h b/chrome/browser/chromeos/options/language_config_util.h
index 9bca566..21a5705 100644
--- a/chrome/browser/chromeos/options/language_config_util.h
+++ b/chrome/browser/chromeos/options/language_config_util.h
@@ -17,12 +17,14 @@ template <typename DataType>
class LanguageComboboxModel : public ComboboxModel {
public:
explicit LanguageComboboxModel(
- const LanguageMultipleChoicePreference<DataType>* pref_data)
+ const language_prefs::LanguageMultipleChoicePreference<DataType>*
+ pref_data)
: pref_data_(pref_data), num_items_(0) {
// Check how many items are defined in the |pref_data->values_and_ids|
// array.
for (size_t i = 0;
- i < LanguageMultipleChoicePreference<DataType>::kMaxItems; ++i) {
+ i < language_prefs::LanguageMultipleChoicePreference<DataType>::
+ kMaxItems; ++i) {
if ((pref_data_->values_and_ids)[i].item_message_id == 0) {
break;
}
@@ -67,7 +69,7 @@ class LanguageComboboxModel : public ComboboxModel {
}
private:
- const LanguageMultipleChoicePreference<DataType>* pref_data_;
+ const language_prefs::LanguageMultipleChoicePreference<DataType>* pref_data_;
int num_items_;
DISALLOW_COPY_AND_ASSIGN(LanguageComboboxModel);
diff --git a/chrome/browser/chromeos/options/language_hangul_config_view.cc b/chrome/browser/chromeos/options/language_hangul_config_view.cc
index 02eed33..29991c6 100644
--- a/chrome/browser/chromeos/options/language_hangul_config_view.cc
+++ b/chrome/browser/chromeos/options/language_hangul_config_view.cc
@@ -28,10 +28,12 @@ namespace chromeos {
class HangulKeyboardComboboxModel : public ComboboxModel {
public:
HangulKeyboardComboboxModel() {
- for (size_t i = 0; i < kNumHangulKeyboardNameIDPairs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumHangulKeyboardNameIDPairs;
+ ++i) {
layouts_.push_back(std::make_pair(
- l10n_util::GetStringUTF8(kHangulKeyboardNameIDPairs[i].message_id),
- kHangulKeyboardNameIDPairs[i].keyboard_id));
+ l10n_util::GetStringUTF8(
+ language_prefs::kHangulKeyboardNameIDPairs[i].message_id),
+ language_prefs::kHangulKeyboardNameIDPairs[i].keyboard_id));
}
}
diff --git a/chrome/browser/chromeos/options/language_mozc_config_view.cc b/chrome/browser/chromeos/options/language_mozc_config_view.cc
index 35b8a85..15fbfdf 100644
--- a/chrome/browser/chromeos/options/language_mozc_config_view.cc
+++ b/chrome/browser/chromeos/options/language_mozc_config_view.cc
@@ -25,7 +25,7 @@ namespace {
enum ButtonTag {
// 0 to kNumMozcBooleanPrefs - 1 are reserved for the checkboxes for integer
// preferences.
- kResetToDefaultsButton = chromeos::kNumMozcBooleanPrefs,
+ kResetToDefaultsButton = chromeos::language_prefs::kNumMozcBooleanPrefs,
};
} // namespace
@@ -35,30 +35,34 @@ LanguageMozcConfigView::LanguageMozcConfigView(Profile* profile)
: OptionsPageView(profile),
contents_(NULL),
reset_to_defaults_button_(NULL) {
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
MozcPrefAndAssociatedCheckbox& current = prefs_and_checkboxes_[i];
current.boolean_pref.Init(
- kMozcBooleanPrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kMozcBooleanPrefs[i].pref_name, profile->GetPrefs(),
+ this);
current.checkbox = NULL;
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
current.multiple_choice_pref.Init(
- kMozcMultipleChoicePrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kMozcMultipleChoicePrefs[i].pref_name,
+ profile->GetPrefs(), this);
current.combobox_model =
- new LanguageComboboxModel<const char*>(&kMozcMultipleChoicePrefs[i]);
+ new LanguageComboboxModel<const char*>(
+ &language_prefs::kMozcMultipleChoicePrefs[i]);
current.combobox = NULL;
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
MozcPrefAndAssociatedSlider& current = prefs_and_sliders_[i];
current.integer_pref.Init(
- kMozcIntegerPrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kMozcIntegerPrefs[i].pref_name, profile->GetPrefs(),
+ this);
current.slider = NULL;
}
}
LanguageMozcConfigView::~LanguageMozcConfigView() {
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
delete prefs_and_comboboxes_[i].combobox_model;
}
}
@@ -71,7 +75,8 @@ void LanguageMozcConfigView::ButtonPressed(
return;
}
views::Checkbox* checkbox = static_cast<views::Checkbox*>(sender);
- DCHECK(pref_id >= 0 && pref_id < static_cast<int>(kNumMozcBooleanPrefs));
+ DCHECK(pref_id >= 0 && pref_id < static_cast<int>(
+ language_prefs::kNumMozcBooleanPrefs));
prefs_and_checkboxes_[pref_id].boolean_pref.SetValue(checkbox->checked());
}
@@ -81,7 +86,7 @@ void LanguageMozcConfigView::ItemChanged(
LOG(ERROR) << "Invalid new_index: " << new_index;
return;
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
if (current.combobox == sender) {
const std::string config_value =
@@ -96,11 +101,12 @@ void LanguageMozcConfigView::ItemChanged(
void LanguageMozcConfigView::SliderValueChanged(views::Slider* sender) {
size_t pref_id;
- for (pref_id = 0; pref_id < kNumMozcIntegerPrefs; ++pref_id) {
+ for (pref_id = 0; pref_id < language_prefs::kNumMozcIntegerPrefs;
+ ++pref_id) {
if (prefs_and_sliders_[pref_id].slider == sender)
break;
}
- DCHECK(pref_id < kNumMozcIntegerPrefs);
+ DCHECK(pref_id < language_prefs::kNumMozcIntegerPrefs);
prefs_and_sliders_[pref_id].integer_pref.SetValue(sender->value());
}
@@ -158,23 +164,23 @@ void LanguageMozcConfigView::InitControlLayout() {
column_set->AddColumn(GridLayout::FILL, GridLayout::FILL, 1,
GridLayout::USE_PREF, 0, 0);
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
MozcPrefAndAssociatedCheckbox& current = prefs_and_checkboxes_[i];
current.checkbox = new views::Checkbox(
- l10n_util::GetString(kMozcBooleanPrefs[i].message_id));
+ l10n_util::GetString(language_prefs::kMozcBooleanPrefs[i].message_id));
current.checkbox->set_listener(this);
current.checkbox->set_tag(i);
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
current.combobox = new LanguageCombobox(current.combobox_model);
current.combobox->set_listener(this);
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
MozcPrefAndAssociatedSlider& current = prefs_and_sliders_[i];
current.slider = new views::Slider(
- kMozcIntegerPrefs[i].min_pref_value,
- kMozcIntegerPrefs[i].max_pref_value,
+ language_prefs::kMozcIntegerPrefs[i].min_pref_value,
+ language_prefs::kMozcIntegerPrefs[i].max_pref_value,
1,
static_cast<views::Slider::StyleFlags>(
views::Slider::STYLE_DRAW_VALUE |
@@ -191,23 +197,24 @@ void LanguageMozcConfigView::InitControlLayout() {
layout->AddView(reset_to_defaults_button_);
// Show the checkboxes.
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
const MozcPrefAndAssociatedCheckbox& current = prefs_and_checkboxes_[i];
layout->StartRow(0, kColumnSetId);
layout->AddView(current.checkbox, 3, 1);
}
// Show the comboboxes.
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
const MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(current.combobox_model->GetLabel()));
layout->AddView(current.combobox);
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
const MozcPrefAndAssociatedSlider& current = prefs_and_sliders_[i];
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(
- l10n_util::GetString(kMozcIntegerPrefs[i].message_id)));
+ l10n_util::GetString(
+ language_prefs::kMozcIntegerPrefs[i].message_id)));
layout->AddView(current.slider);
}
NotifyPrefChanged(); // Sync the slider with current Chrome prefs.
@@ -224,12 +231,12 @@ void LanguageMozcConfigView::Observe(NotificationType type,
void LanguageMozcConfigView::NotifyPrefChanged() {
// Update comboboxes.
// TODO(yusukes): We don't have to update all UI controls.
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
MozcPrefAndAssociatedCheckbox& current = prefs_and_checkboxes_[i];
const bool checked = current.boolean_pref.GetValue();
current.checkbox->SetChecked(checked);
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
MozcPrefAndAssociatedCombobox& current = prefs_and_comboboxes_[i];
const std::string value = current.multiple_choice_pref.GetValue();
for (int i = 0; i < current.combobox_model->num_items(); ++i) {
@@ -239,7 +246,7 @@ void LanguageMozcConfigView::NotifyPrefChanged() {
}
}
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
MozcPrefAndAssociatedSlider& current = prefs_and_sliders_[i];
const int value = current.integer_pref.GetValue();
current.slider->SetValue(value);
@@ -247,17 +254,17 @@ void LanguageMozcConfigView::NotifyPrefChanged() {
}
void LanguageMozcConfigView::ResetToDefaults() {
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
prefs_and_checkboxes_[i].boolean_pref.SetValue(
- kMozcBooleanPrefs[i].default_pref_value);
+ language_prefs::kMozcBooleanPrefs[i].default_pref_value);
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
prefs_and_comboboxes_[i].multiple_choice_pref.SetValue(
- kMozcMultipleChoicePrefs[i].default_pref_value);
+ language_prefs::kMozcMultipleChoicePrefs[i].default_pref_value);
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
prefs_and_sliders_[i].integer_pref.SetValue(
- kMozcIntegerPrefs[i].default_pref_value);
+ language_prefs::kMozcIntegerPrefs[i].default_pref_value);
}
// Reflect the preference changes to the controls.
NotifyPrefChanged();
diff --git a/chrome/browser/chromeos/options/language_mozc_config_view.h b/chrome/browser/chromeos/options/language_mozc_config_view.h
index 2a798fe..e7a4066 100644
--- a/chrome/browser/chromeos/options/language_mozc_config_view.h
+++ b/chrome/browser/chromeos/options/language_mozc_config_view.h
@@ -83,18 +83,18 @@ class LanguageMozcConfigView : public views::ButtonListener,
struct MozcPrefAndAssociatedCheckbox {
BooleanPrefMember boolean_pref;
views::Checkbox* checkbox;
- } prefs_and_checkboxes_[kNumMozcBooleanPrefs];
+ } prefs_and_checkboxes_[language_prefs::kNumMozcBooleanPrefs];
struct MozcPrefAndAssociatedCombobox {
StringPrefMember multiple_choice_pref;
LanguageComboboxModel<const char*>* combobox_model;
LanguageCombobox* combobox;
- } prefs_and_comboboxes_[kNumMozcMultipleChoicePrefs];
+ } prefs_and_comboboxes_[language_prefs::kNumMozcMultipleChoicePrefs];
struct MozcPrefAndAssociatedSlider {
IntegerPrefMember integer_pref;
views::Slider* slider;
- } prefs_and_sliders_[kNumMozcIntegerPrefs];
+ } prefs_and_sliders_[language_prefs::kNumMozcIntegerPrefs];
DISALLOW_COPY_AND_ASSIGN(LanguageMozcConfigView);
};
diff --git a/chrome/browser/chromeos/options/language_pinyin_config_view.cc b/chrome/browser/chromeos/options/language_pinyin_config_view.cc
index 32d526a..5a78752 100644
--- a/chrome/browser/chromeos/options/language_pinyin_config_view.cc
+++ b/chrome/browser/chromeos/options/language_pinyin_config_view.cc
@@ -25,16 +25,19 @@ namespace chromeos {
LanguagePinyinConfigView::LanguagePinyinConfigView(Profile* profile)
: OptionsPageView(profile), contents_(NULL) {
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
pinyin_boolean_prefs_[i].Init(
- kPinyinBooleanPrefs[i].pref_name, profile->GetPrefs(), this);
+ language_prefs::kPinyinBooleanPrefs[i].pref_name, profile->GetPrefs(),
+ this);
pinyin_boolean_checkboxes_[i] = NULL;
}
double_pinyin_schema_.multiple_choice_pref.Init(
- kPinyinDoublePinyinSchema.pref_name, profile->GetPrefs(), this);
+ language_prefs::kPinyinDoublePinyinSchema.pref_name,
+ profile->GetPrefs(), this);
double_pinyin_schema_.combobox_model =
- new LanguageComboboxModel<int>(&kPinyinDoublePinyinSchema);
+ new LanguageComboboxModel<int>(
+ &language_prefs::kPinyinDoublePinyinSchema);
double_pinyin_schema_.combobox = NULL;
}
@@ -45,7 +48,8 @@ void LanguagePinyinConfigView::ButtonPressed(
views::Button* sender, const views::Event& event) {
views::Checkbox* checkbox = static_cast<views::Checkbox*>(sender);
const int pref_id = checkbox->tag();
- DCHECK(pref_id >= 0 && pref_id < static_cast<int>(kNumPinyinBooleanPrefs));
+ DCHECK(pref_id >= 0 && pref_id < static_cast<int>(
+ language_prefs::kNumPinyinBooleanPrefs));
pinyin_boolean_prefs_[pref_id].SetValue(checkbox->checked());
}
@@ -109,9 +113,10 @@ void LanguagePinyinConfigView::InitControlLayout() {
column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
GridLayout::USE_PREF, 0, 0);
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
pinyin_boolean_checkboxes_[i] = new views::Checkbox(
- l10n_util::GetString(kPinyinBooleanPrefs[i].message_id));
+ l10n_util::GetString(
+ language_prefs::kPinyinBooleanPrefs[i].message_id));
pinyin_boolean_checkboxes_[i]->set_listener(this);
pinyin_boolean_checkboxes_[i]->set_tag(i);
}
@@ -120,7 +125,7 @@ void LanguagePinyinConfigView::InitControlLayout() {
double_pinyin_schema_.combobox->set_listener(this);
NotifyPrefChanged();
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
layout->StartRow(0, kColumnSetId);
layout->AddView(pinyin_boolean_checkboxes_[i]);
}
@@ -139,7 +144,7 @@ void LanguagePinyinConfigView::Observe(NotificationType type,
}
void LanguagePinyinConfigView::NotifyPrefChanged() {
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
const bool checked = pinyin_boolean_prefs_[i].GetValue();
pinyin_boolean_checkboxes_[i]->SetChecked(checked);
}
diff --git a/chrome/browser/chromeos/options/language_pinyin_config_view.h b/chrome/browser/chromeos/options/language_pinyin_config_view.h
index 2e01e18..a72be04 100644
--- a/chrome/browser/chromeos/options/language_pinyin_config_view.h
+++ b/chrome/browser/chromeos/options/language_pinyin_config_view.h
@@ -65,12 +65,14 @@ class LanguagePinyinConfigView : public views::ButtonListener,
// Updates the pinyin checkboxes.
void NotifyPrefChanged();
- BooleanPrefMember pinyin_boolean_prefs_[kNumPinyinBooleanPrefs];
+ BooleanPrefMember pinyin_boolean_prefs_[
+ language_prefs::kNumPinyinBooleanPrefs];
// TODO(yusukes): Support integer prefs if needed.
views::View* contents_;
// A checkboxes for Pinyin.
- views::Checkbox* pinyin_boolean_checkboxes_[kNumPinyinBooleanPrefs];
+ views::Checkbox* pinyin_boolean_checkboxes_[
+ language_prefs::kNumPinyinBooleanPrefs];
struct DoublePinyinSchemaPrefAndAssociatedCombobox {
IntegerPrefMember multiple_choice_pref;
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index c7cd183..c6fb721 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -403,7 +403,8 @@ LanguageSection::LanguageSection(Profile* profile)
: SettingsPageSection(profile,
IDS_OPTIONS_SETTINGS_SECTION_TITLE_LANGUAGE),
xkb_modifier_combobox_(NULL),
- xkb_modifier_combobox_model_(&kXkbModifierMultipleChoicePrefs),
+ xkb_modifier_combobox_model_(
+ &language_prefs::kXkbModifierMultipleChoicePrefs),
xkb_auto_repeat_delay_slider_(NULL),
xkb_auto_repeat_interval_slider_(NULL) {
xkb_remap_search_key_pref_.Init(
@@ -415,9 +416,11 @@ LanguageSection::LanguageSection(Profile* profile)
xkb_auto_repeat_pref_.Init(
prefs::kLanguageXkbAutoRepeatEnabled, profile->GetPrefs(), this);
xkb_auto_repeat_delay_pref_.Init(
- kXkbAutoRepeatDelayPref.pref_name, profile->GetPrefs(), this);
+ language_prefs::kXkbAutoRepeatDelayPref.pref_name,
+ profile->GetPrefs(), this);
xkb_auto_repeat_interval_pref_.Init(
- kXkbAutoRepeatIntervalPref.pref_name, profile->GetPrefs(), this);
+ language_prefs::kXkbAutoRepeatIntervalPref.pref_name,
+ profile->GetPrefs(), this);
}
void LanguageSection::InitContents(GridLayout* layout) {
@@ -437,15 +440,15 @@ void LanguageSection::InitContents(GridLayout* layout) {
xkb_auto_repeat_checkbox_->set_listener(this);
xkb_auto_repeat_delay_slider_ = new views::Slider(
- kXkbAutoRepeatDelayPref.min_pref_value,
- kXkbAutoRepeatDelayPref.max_pref_value,
+ language_prefs::kXkbAutoRepeatDelayPref.min_pref_value,
+ language_prefs::kXkbAutoRepeatDelayPref.max_pref_value,
1,
static_cast<views::Slider::StyleFlags>(
views::Slider::STYLE_UPDATE_ON_RELEASE),
this);
xkb_auto_repeat_interval_slider_ = new views::Slider(
- kXkbAutoRepeatIntervalPref.min_pref_value,
- kXkbAutoRepeatIntervalPref.max_pref_value,
+ language_prefs::kXkbAutoRepeatIntervalPref.min_pref_value,
+ language_prefs::kXkbAutoRepeatIntervalPref.max_pref_value,
1,
static_cast<views::Slider::StyleFlags>(
views::Slider::STYLE_UPDATE_ON_RELEASE),
@@ -465,7 +468,8 @@ void LanguageSection::InitContents(GridLayout* layout) {
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, quad_column_view_set_id());
layout->AddView(new views::Label(
- l10n_util::GetString(kXkbAutoRepeatDelayPref.message_id)),
+ l10n_util::GetString(
+ language_prefs::kXkbAutoRepeatDelayPref.message_id)),
1, 1, GridLayout::LEADING, GridLayout::CENTER);
layout->AddView(new views::Label(
l10n_util::GetString(
@@ -478,7 +482,8 @@ void LanguageSection::InitContents(GridLayout* layout) {
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, quad_column_view_set_id());
layout->AddView(new views::Label(
- l10n_util::GetString(kXkbAutoRepeatIntervalPref.message_id)),
+ l10n_util::GetString(
+ language_prefs::kXkbAutoRepeatIntervalPref.message_id)),
1, 1, GridLayout::LEADING, GridLayout::CENTER);
layout->AddView(new views::Label(
l10n_util::GetString(
@@ -509,17 +514,17 @@ void LanguageSection::ItemChanged(views::Combobox* sender,
default:
LOG(ERROR) << "Unexpected mapping: " << new_index;
/* fall through */
- case kNoRemap:
+ case language_prefs::kNoRemap:
xkb_remap_search_key_pref_.SetValue(kSearchKey);
xkb_remap_control_key_pref_.SetValue(kLeftControlKey);
xkb_remap_alt_key_pref_.SetValue(kLeftAltKey);
break;
- case kSwapCtrlAndAlt:
+ case language_prefs::kSwapCtrlAndAlt:
xkb_remap_search_key_pref_.SetValue(kSearchKey);
xkb_remap_control_key_pref_.SetValue(kLeftAltKey);
xkb_remap_alt_key_pref_.SetValue(kLeftControlKey);
break;
- case kSwapSearchAndCtrl:
+ case language_prefs::kSwapSearchAndCtrl:
xkb_remap_search_key_pref_.SetValue(kLeftControlKey);
xkb_remap_control_key_pref_.SetValue(kSearchKey);
xkb_remap_alt_key_pref_.SetValue(kLeftAltKey);
@@ -545,29 +550,32 @@ void LanguageSection::NotifyPrefChanged(const std::string* pref_name) {
if ((search_remap == kSearchKey) &&
(control_remap == kLeftControlKey) &&
(alt_remap == kLeftAltKey)) {
- xkb_modifier_combobox_->SetSelectedItem(kNoRemap);
+ xkb_modifier_combobox_->SetSelectedItem(language_prefs::kNoRemap);
} else if ((search_remap == kLeftControlKey) &&
(control_remap == kSearchKey) &&
(alt_remap == kLeftAltKey)) {
- xkb_modifier_combobox_->SetSelectedItem(kSwapSearchAndCtrl);
+ xkb_modifier_combobox_->SetSelectedItem(
+ language_prefs::kSwapSearchAndCtrl);
} else if ((search_remap == kSearchKey) &&
(control_remap == kLeftAltKey) &&
(alt_remap == kLeftControlKey)) {
- xkb_modifier_combobox_->SetSelectedItem(kSwapCtrlAndAlt);
+ xkb_modifier_combobox_->SetSelectedItem(language_prefs::kSwapCtrlAndAlt);
} else {
LOG(ERROR) << "Unexpected mapping. The prefs are updated by DOMUI?";
- xkb_modifier_combobox_->SetSelectedItem(kNoRemap);
+ xkb_modifier_combobox_->SetSelectedItem(language_prefs::kNoRemap);
}
}
if (!pref_name || *pref_name == prefs::kLanguageXkbAutoRepeatEnabled) {
const bool enabled = xkb_auto_repeat_pref_.GetValue();
xkb_auto_repeat_checkbox_->SetChecked(enabled);
}
- if (!pref_name || *pref_name == kXkbAutoRepeatDelayPref.pref_name) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kXkbAutoRepeatDelayPref.pref_name) {
const int delay_value = xkb_auto_repeat_delay_pref_.GetValue();
xkb_auto_repeat_delay_slider_->SetValue(delay_value);
}
- if (!pref_name || *pref_name == kXkbAutoRepeatIntervalPref.pref_name) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kXkbAutoRepeatIntervalPref.pref_name) {
const int interval_value = xkb_auto_repeat_interval_pref_.GetValue();
xkb_auto_repeat_interval_slider_->SetValue(interval_value);
}
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc
index ae50e1d..038d40f 100644
--- a/chrome/browser/chromeos/preferences.cc
+++ b/chrome/browser/chromeos/preferences.cc
@@ -34,65 +34,76 @@ void Preferences::RegisterUserPrefs(PrefService* prefs) {
prefs->RegisterStringPref(prefs::kLanguageCurrentInputMethod, "");
prefs->RegisterStringPref(prefs::kLanguagePreviousInputMethod, "");
prefs->RegisterStringPref(prefs::kLanguageHotkeyNextEngineInMenu,
- kHotkeyNextEngineInMenu);
+ language_prefs::kHotkeyNextEngineInMenu);
prefs->RegisterStringPref(prefs::kLanguageHotkeyPreviousEngine,
- kHotkeyPreviousEngine);
+ language_prefs::kHotkeyPreviousEngine);
prefs->RegisterStringPref(prefs::kLanguagePreferredLanguages, "");
prefs->RegisterStringPref(prefs::kLanguagePreloadEngines,
kFallbackInputMethodId); // EN layout
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
- prefs->RegisterBooleanPref(kChewingBooleanPrefs[i].pref_name,
- kChewingBooleanPrefs[i].default_pref_value);
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
+ prefs->RegisterBooleanPref(
+ language_prefs::kChewingBooleanPrefs[i].pref_name,
+ language_prefs::kChewingBooleanPrefs[i].default_pref_value);
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
prefs->RegisterStringPref(
- kChewingMultipleChoicePrefs[i].pref_name,
- kChewingMultipleChoicePrefs[i].default_pref_value);
+ language_prefs::kChewingMultipleChoicePrefs[i].pref_name,
+ language_prefs::kChewingMultipleChoicePrefs[i].default_pref_value);
}
- prefs->RegisterIntegerPref(kChewingHsuSelKeyType.pref_name,
- kChewingHsuSelKeyType.default_pref_value);
+ prefs->RegisterIntegerPref(
+ language_prefs::kChewingHsuSelKeyType.pref_name,
+ language_prefs::kChewingHsuSelKeyType.default_pref_value);
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
- prefs->RegisterIntegerPref(kChewingIntegerPrefs[i].pref_name,
- kChewingIntegerPrefs[i].default_pref_value);
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
+ prefs->RegisterIntegerPref(
+ language_prefs::kChewingIntegerPrefs[i].pref_name,
+ language_prefs::kChewingIntegerPrefs[i].default_pref_value);
}
prefs->RegisterStringPref(
prefs::kLanguageHangulKeyboard,
- kHangulKeyboardNameIDPairs[0].keyboard_id);
- prefs->RegisterStringPref(prefs::kLanguageHangulHanjaKeys, kHangulHanjaKeys);
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
- prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name,
- kPinyinBooleanPrefs[i].default_pref_value);
- }
- for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) {
- prefs->RegisterIntegerPref(kPinyinIntegerPrefs[i].pref_name,
- kPinyinIntegerPrefs[i].default_pref_value);
- }
- prefs->RegisterIntegerPref(kPinyinDoublePinyinSchema.pref_name,
- kPinyinDoublePinyinSchema.default_pref_value);
+ language_prefs::kHangulKeyboardNameIDPairs[0].keyboard_id);
+ prefs->RegisterStringPref(prefs::kLanguageHangulHanjaKeys,
+ language_prefs::kHangulHanjaKeys);
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
+ prefs->RegisterBooleanPref(
+ language_prefs::kPinyinBooleanPrefs[i].pref_name,
+ language_prefs::kPinyinBooleanPrefs[i].default_pref_value);
+ }
+ for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) {
+ prefs->RegisterIntegerPref(
+ language_prefs::kPinyinIntegerPrefs[i].pref_name,
+ language_prefs::kPinyinIntegerPrefs[i].default_pref_value);
+ }
+ prefs->RegisterIntegerPref(
+ language_prefs::kPinyinDoublePinyinSchema.pref_name,
+ language_prefs::kPinyinDoublePinyinSchema.default_pref_value);
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
- prefs->RegisterBooleanPref(kMozcBooleanPrefs[i].pref_name,
- kMozcBooleanPrefs[i].default_pref_value);
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
+ prefs->RegisterBooleanPref(
+ language_prefs::kMozcBooleanPrefs[i].pref_name,
+ language_prefs::kMozcBooleanPrefs[i].default_pref_value);
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
prefs->RegisterStringPref(
- kMozcMultipleChoicePrefs[i].pref_name,
- kMozcMultipleChoicePrefs[i].default_pref_value);
+ language_prefs::kMozcMultipleChoicePrefs[i].pref_name,
+ language_prefs::kMozcMultipleChoicePrefs[i].default_pref_value);
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
- prefs->RegisterIntegerPref(kMozcIntegerPrefs[i].pref_name,
- kMozcIntegerPrefs[i].default_pref_value);
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
+ prefs->RegisterIntegerPref(
+ language_prefs::kMozcIntegerPrefs[i].pref_name,
+ language_prefs::kMozcIntegerPrefs[i].default_pref_value);
}
prefs->RegisterIntegerPref(prefs::kLanguageXkbRemapSearchKeyTo, kSearchKey);
prefs->RegisterIntegerPref(prefs::kLanguageXkbRemapControlKeyTo,
kLeftControlKey);
prefs->RegisterIntegerPref(prefs::kLanguageXkbRemapAltKeyTo, kLeftAltKey);
prefs->RegisterBooleanPref(prefs::kLanguageXkbAutoRepeatEnabled, true);
- prefs->RegisterIntegerPref(kXkbAutoRepeatDelayPref.pref_name,
- kXkbAutoRepeatDelayPref.default_pref_value);
- prefs->RegisterIntegerPref(kXkbAutoRepeatIntervalPref.pref_name,
- kXkbAutoRepeatIntervalPref.default_pref_value);
+ prefs->RegisterIntegerPref(
+ language_prefs::kXkbAutoRepeatDelayPref.pref_name,
+ language_prefs::kXkbAutoRepeatDelayPref.default_pref_value);
+ prefs->RegisterIntegerPref(
+ language_prefs::kXkbAutoRepeatIntervalPref.pref_name,
+ language_prefs::kXkbAutoRepeatIntervalPref.default_pref_value);
}
void Preferences::Init(PrefService* prefs) {
@@ -108,44 +119,44 @@ void Preferences::Init(PrefService* prefs) {
language_preferred_languages_.Init(prefs::kLanguagePreferredLanguages,
prefs, this);
language_preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this);
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
language_chewing_boolean_prefs_[i].Init(
- kChewingBooleanPrefs[i].pref_name, prefs, this);
+ language_prefs::kChewingBooleanPrefs[i].pref_name, prefs, this);
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
language_chewing_multiple_choice_prefs_[i].Init(
- kChewingMultipleChoicePrefs[i].pref_name, prefs, this);
+ language_prefs::kChewingMultipleChoicePrefs[i].pref_name, prefs, this);
}
language_chewing_hsu_sel_key_type_.Init(
- kChewingHsuSelKeyType.pref_name, prefs, this);
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
+ language_prefs::kChewingHsuSelKeyType.pref_name, prefs, this);
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
language_chewing_integer_prefs_[i].Init(
- kChewingIntegerPrefs[i].pref_name, prefs, this);
+ language_prefs::kChewingIntegerPrefs[i].pref_name, prefs, this);
}
language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this);
language_hangul_hanja_keys_.Init(
prefs::kLanguageHangulHanjaKeys, prefs, this);
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
language_pinyin_boolean_prefs_[i].Init(
- kPinyinBooleanPrefs[i].pref_name, prefs, this);
+ language_prefs::kPinyinBooleanPrefs[i].pref_name, prefs, this);
}
- for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) {
language_pinyin_int_prefs_[i].Init(
- kPinyinIntegerPrefs[i].pref_name, prefs, this);
+ language_prefs::kPinyinIntegerPrefs[i].pref_name, prefs, this);
}
language_pinyin_double_pinyin_schema_.Init(
- kPinyinDoublePinyinSchema.pref_name, prefs, this);
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
+ language_prefs::kPinyinDoublePinyinSchema.pref_name, prefs, this);
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
language_mozc_boolean_prefs_[i].Init(
- kMozcBooleanPrefs[i].pref_name, prefs, this);
+ language_prefs::kMozcBooleanPrefs[i].pref_name, prefs, this);
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
language_mozc_multiple_choice_prefs_[i].Init(
- kMozcMultipleChoicePrefs[i].pref_name, prefs, this);
+ language_prefs::kMozcMultipleChoicePrefs[i].pref_name, prefs, this);
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
language_mozc_integer_prefs_[i].Init(
- kMozcIntegerPrefs[i].pref_name, prefs, this);
+ language_prefs::kMozcIntegerPrefs[i].pref_name, prefs, this);
}
language_xkb_remap_search_key_to_.Init(
prefs::kLanguageXkbRemapSearchKeyTo, prefs, this);
@@ -156,9 +167,9 @@ void Preferences::Init(PrefService* prefs) {
language_xkb_auto_repeat_enabled_.Init(
prefs::kLanguageXkbAutoRepeatEnabled, prefs, this);
language_xkb_auto_repeat_delay_pref_.Init(
- kXkbAutoRepeatDelayPref.pref_name, prefs, this);
+ language_prefs::kXkbAutoRepeatDelayPref.pref_name, prefs, this);
language_xkb_auto_repeat_interval_pref_.Init(
- kXkbAutoRepeatIntervalPref.pref_name, prefs, this);
+ language_prefs::kXkbAutoRepeatIntervalPref.pref_name, prefs, this);
std::string locale(g_browser_process->GetApplicationLocale());
// Add input methods based on the application locale when the user first
@@ -226,14 +237,14 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) {
if (!pref_name || *pref_name == prefs::kLanguageHotkeyNextEngineInMenu) {
SetLanguageConfigStringListAsCSV(
- kHotKeySectionName,
- kNextEngineInMenuConfigName,
+ language_prefs::kHotKeySectionName,
+ language_prefs::kNextEngineInMenuConfigName,
language_hotkey_next_engine_in_menu_.GetValue());
}
if (!pref_name || *pref_name == prefs::kLanguageHotkeyPreviousEngine) {
SetLanguageConfigStringListAsCSV(
- kHotKeySectionName,
- kPreviousEngineConfigName,
+ language_prefs::kHotKeySectionName,
+ language_prefs::kPreviousEngineConfigName,
language_hotkey_previous_engine_.GetValue());
}
if (!pref_name || *pref_name == prefs::kLanguagePreferredLanguages) {
@@ -241,86 +252,106 @@ void Preferences::NotifyPrefChanged(const std::string* pref_name) {
// preferencs, we don't need to send this to ibus-daemon.
}
if (!pref_name || *pref_name == prefs::kLanguagePreloadEngines) {
- SetLanguageConfigStringListAsCSV(kGeneralSectionName,
- kPreloadEnginesConfigName,
+ SetLanguageConfigStringListAsCSV(language_prefs::kGeneralSectionName,
+ language_prefs::kPreloadEnginesConfigName,
language_preload_engines_.GetValue());
}
- for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
- if (!pref_name || *pref_name == kChewingBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(kChewingSectionName,
- kChewingBooleanPrefs[i].ibus_config_name,
- language_chewing_boolean_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kChewingBooleanPrefs[i].pref_name) {
+ SetLanguageConfigBoolean(
+ language_prefs::kChewingSectionName,
+ language_prefs::kChewingBooleanPrefs[i].ibus_config_name,
+ language_chewing_boolean_prefs_[i].GetValue());
}
}
- for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
- if (!pref_name || *pref_name == kChewingMultipleChoicePrefs[i].pref_name) {
+ for (size_t i = 0; i < language_prefs::kNumChewingMultipleChoicePrefs; ++i) {
+ if (!pref_name ||
+ *pref_name ==
+ language_prefs::kChewingMultipleChoicePrefs[i].pref_name) {
SetLanguageConfigString(
- kChewingSectionName,
- kChewingMultipleChoicePrefs[i].ibus_config_name,
+ language_prefs::kChewingSectionName,
+ language_prefs::kChewingMultipleChoicePrefs[i].ibus_config_name,
language_chewing_multiple_choice_prefs_[i].GetValue());
}
}
- if (!pref_name || *pref_name == kChewingHsuSelKeyType.pref_name) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kChewingHsuSelKeyType.pref_name) {
SetLanguageConfigInteger(
- kChewingSectionName,
- kChewingHsuSelKeyType.ibus_config_name,
+ language_prefs::kChewingSectionName,
+ language_prefs::kChewingHsuSelKeyType.ibus_config_name,
language_chewing_hsu_sel_key_type_.GetValue());
}
- for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
- if (!pref_name || *pref_name == kChewingIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(kChewingSectionName,
- kChewingIntegerPrefs[i].ibus_config_name,
- language_chewing_integer_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kChewingIntegerPrefs[i].pref_name) {
+ SetLanguageConfigInteger(
+ language_prefs::kChewingSectionName,
+ language_prefs::kChewingIntegerPrefs[i].ibus_config_name,
+ language_chewing_integer_prefs_[i].GetValue());
}
}
- if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) {
- SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName,
+ if (!pref_name ||
+ *pref_name == prefs::kLanguageHangulKeyboard) {
+ SetLanguageConfigString(language_prefs::kHangulSectionName,
+ language_prefs::kHangulKeyboardConfigName,
language_hangul_keyboard_.GetValue());
}
if (!pref_name || *pref_name == prefs::kLanguageHangulHanjaKeys) {
- SetLanguageConfigString(kHangulSectionName, kHangulHanjaKeysConfigName,
+ SetLanguageConfigString(language_prefs::kHangulSectionName,
+ language_prefs::kHangulHanjaKeysConfigName,
language_hangul_hanja_keys_.GetValue());
}
- for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
- if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(kPinyinSectionName,
- kPinyinBooleanPrefs[i].ibus_config_name,
- language_pinyin_boolean_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kPinyinBooleanPrefs[i].pref_name) {
+ SetLanguageConfigBoolean(
+ language_prefs::kPinyinSectionName,
+ language_prefs::kPinyinBooleanPrefs[i].ibus_config_name,
+ language_pinyin_boolean_prefs_[i].GetValue());
}
}
- for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) {
- if (!pref_name || *pref_name == kPinyinIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(kPinyinSectionName,
- kPinyinIntegerPrefs[i].ibus_config_name,
- language_pinyin_int_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumPinyinIntegerPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kPinyinIntegerPrefs[i].pref_name) {
+ SetLanguageConfigInteger(
+ language_prefs::kPinyinSectionName,
+ language_prefs::kPinyinIntegerPrefs[i].ibus_config_name,
+ language_pinyin_int_prefs_[i].GetValue());
}
}
- if (!pref_name || *pref_name == kPinyinDoublePinyinSchema.pref_name) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kPinyinDoublePinyinSchema.pref_name) {
SetLanguageConfigInteger(
- kPinyinSectionName,
- kPinyinDoublePinyinSchema.ibus_config_name,
+ language_prefs::kPinyinSectionName,
+ language_prefs::kPinyinDoublePinyinSchema.ibus_config_name,
language_pinyin_double_pinyin_schema_.GetValue());
}
- for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) {
- if (!pref_name || *pref_name == kMozcBooleanPrefs[i].pref_name) {
- SetLanguageConfigBoolean(kMozcSectionName,
- kMozcBooleanPrefs[i].ibus_config_name,
- language_mozc_boolean_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kMozcBooleanPrefs[i].pref_name) {
+ SetLanguageConfigBoolean(
+ language_prefs::kMozcSectionName,
+ language_prefs::kMozcBooleanPrefs[i].ibus_config_name,
+ language_mozc_boolean_prefs_[i].GetValue());
}
}
- for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
- if (!pref_name || *pref_name == kMozcMultipleChoicePrefs[i].pref_name) {
+ for (size_t i = 0; i < language_prefs::kNumMozcMultipleChoicePrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kMozcMultipleChoicePrefs[i].pref_name) {
SetLanguageConfigString(
- kMozcSectionName,
- kMozcMultipleChoicePrefs[i].ibus_config_name,
+ language_prefs::kMozcSectionName,
+ language_prefs::kMozcMultipleChoicePrefs[i].ibus_config_name,
language_mozc_multiple_choice_prefs_[i].GetValue());
}
}
- for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) {
- if (!pref_name || *pref_name == kMozcIntegerPrefs[i].pref_name) {
- SetLanguageConfigInteger(kMozcSectionName,
- kMozcIntegerPrefs[i].ibus_config_name,
- language_mozc_integer_prefs_[i].GetValue());
+ for (size_t i = 0; i < language_prefs::kNumMozcIntegerPrefs; ++i) {
+ if (!pref_name ||
+ *pref_name == language_prefs::kMozcIntegerPrefs[i].pref_name) {
+ SetLanguageConfigInteger(
+ language_prefs::kMozcSectionName,
+ language_prefs::kMozcIntegerPrefs[i].ibus_config_name,
+ language_mozc_integer_prefs_[i].GetValue());
}
}
if (!pref_name || (*pref_name == prefs::kLanguageXkbRemapSearchKeyTo ||
diff --git a/chrome/browser/chromeos/preferences.h b/chrome/browser/chromeos/preferences.h
index 18f137d..5daf8dc 100644
--- a/chrome/browser/chromeos/preferences.h
+++ b/chrome/browser/chromeos/preferences.h
@@ -94,20 +94,26 @@ class Preferences : public NotificationObserver {
StringPrefMember language_hotkey_previous_engine_;
StringPrefMember language_preferred_languages_;
StringPrefMember language_preload_engines_;
- BooleanPrefMember language_chewing_boolean_prefs_[kNumChewingBooleanPrefs];
+ BooleanPrefMember language_chewing_boolean_prefs_[
+ language_prefs::kNumChewingBooleanPrefs];
StringPrefMember language_chewing_multiple_choice_prefs_[
- kNumChewingMultipleChoicePrefs];
+ language_prefs::kNumChewingMultipleChoicePrefs];
IntegerPrefMember language_chewing_hsu_sel_key_type_;
- IntegerPrefMember language_chewing_integer_prefs_[kNumChewingIntegerPrefs];
+ IntegerPrefMember language_chewing_integer_prefs_[
+ language_prefs::kNumChewingIntegerPrefs];
StringPrefMember language_hangul_keyboard_;
StringPrefMember language_hangul_hanja_keys_;
- BooleanPrefMember language_pinyin_boolean_prefs_[kNumPinyinBooleanPrefs];
- IntegerPrefMember language_pinyin_int_prefs_[kNumPinyinIntegerPrefs];
+ BooleanPrefMember language_pinyin_boolean_prefs_[
+ language_prefs::kNumPinyinBooleanPrefs];
+ IntegerPrefMember language_pinyin_int_prefs_[
+ language_prefs::kNumPinyinIntegerPrefs];
IntegerPrefMember language_pinyin_double_pinyin_schema_;
- BooleanPrefMember language_mozc_boolean_prefs_[kNumMozcBooleanPrefs];
+ BooleanPrefMember language_mozc_boolean_prefs_[
+ language_prefs::kNumMozcBooleanPrefs];
StringPrefMember language_mozc_multiple_choice_prefs_[
- kNumMozcMultipleChoicePrefs];
- IntegerPrefMember language_mozc_integer_prefs_[kNumMozcIntegerPrefs];
+ language_prefs::kNumMozcMultipleChoicePrefs];
+ IntegerPrefMember language_mozc_integer_prefs_[
+ language_prefs::kNumMozcIntegerPrefs];
IntegerPrefMember language_xkb_remap_search_key_to_;
IntegerPrefMember language_xkb_remap_control_key_to_;
IntegerPrefMember language_xkb_remap_alt_key_to_;
diff --git a/chrome/browser/chromeos/status/language_menu_button.cc b/chrome/browser/chromeos/status/language_menu_button.cc
index 5b042a7..6e89c3d 100644
--- a/chrome/browser/chromeos/status/language_menu_button.cc
+++ b/chrome/browser/chromeos/status/language_menu_button.cc
@@ -441,7 +441,7 @@ void LanguageMenuButton::InputMethodChanged(InputMethodLibrary* obj) {
// buttun for the login screen is destroyed.
if (!logged_in_ && g_browser_process && g_browser_process->local_state()) {
g_browser_process->local_state()->SetString(
- kPreferredKeyboardLayout, current_input_method.id);
+ language_prefs::kPreferredKeyboardLayout, current_input_method.id);
g_browser_process->local_state()->SavePersistentPrefs();
}
}
@@ -654,7 +654,8 @@ std::wstring LanguageMenuButton::GetTextForMenu(
}
void LanguageMenuButton::RegisterPrefs(PrefService* local_state) {
- local_state->RegisterStringPref(kPreferredKeyboardLayout, "");
+ local_state->RegisterStringPref(language_prefs::kPreferredKeyboardLayout,
+ "");
}
void LanguageMenuButton::GetAmbiguousLanguageCodeSet(