| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/preferences.h" | 5 #include "chrome/browser/chromeos/preferences.h" |
| 6 | 6 |
| 7 #include "base/string_util.h" | 7 #include "base/string_util.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/cros/cros_library.h" | 10 #include "chrome/browser/chromeos/cros/cros_library.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 prefs->RegisterIntegerPref(kChewingHsuSelKeyType.pref_name, | 50 prefs->RegisterIntegerPref(kChewingHsuSelKeyType.pref_name, |
| 51 kChewingHsuSelKeyType.default_pref_value); | 51 kChewingHsuSelKeyType.default_pref_value); |
| 52 | 52 |
| 53 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { | 53 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { |
| 54 prefs->RegisterIntegerPref(kChewingIntegerPrefs[i].pref_name, | 54 prefs->RegisterIntegerPref(kChewingIntegerPrefs[i].pref_name, |
| 55 kChewingIntegerPrefs[i].default_pref_value); | 55 kChewingIntegerPrefs[i].default_pref_value); |
| 56 } | 56 } |
| 57 prefs->RegisterStringPref( | 57 prefs->RegisterStringPref( |
| 58 prefs::kLanguageHangulKeyboard, | 58 prefs::kLanguageHangulKeyboard, |
| 59 kHangulKeyboardNameIDPairs[0].keyboard_id); | 59 kHangulKeyboardNameIDPairs[0].keyboard_id); |
| 60 prefs->RegisterStringPref(prefs::kLanguageHangulHanjaKeys, kHangulHanjaKeys); |
| 60 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { | 61 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { |
| 61 prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name, | 62 prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name, |
| 62 kPinyinBooleanPrefs[i].default_pref_value); | 63 kPinyinBooleanPrefs[i].default_pref_value); |
| 63 } | 64 } |
| 64 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { | 65 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { |
| 65 prefs->RegisterIntegerPref(kPinyinIntegerPrefs[i].pref_name, | 66 prefs->RegisterIntegerPref(kPinyinIntegerPrefs[i].pref_name, |
| 66 kPinyinIntegerPrefs[i].default_pref_value); | 67 kPinyinIntegerPrefs[i].default_pref_value); |
| 67 } | 68 } |
| 68 prefs->RegisterIntegerPref(kPinyinDoublePinyinSchema.pref_name, | 69 prefs->RegisterIntegerPref(kPinyinDoublePinyinSchema.pref_name, |
| 69 kPinyinDoublePinyinSchema.default_pref_value); | 70 kPinyinDoublePinyinSchema.default_pref_value); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 language_chewing_multiple_choice_prefs_[i].Init( | 103 language_chewing_multiple_choice_prefs_[i].Init( |
| 103 kChewingMultipleChoicePrefs[i].pref_name, prefs, this); | 104 kChewingMultipleChoicePrefs[i].pref_name, prefs, this); |
| 104 } | 105 } |
| 105 language_chewing_hsu_sel_key_type_.Init( | 106 language_chewing_hsu_sel_key_type_.Init( |
| 106 kChewingHsuSelKeyType.pref_name, prefs, this); | 107 kChewingHsuSelKeyType.pref_name, prefs, this); |
| 107 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { | 108 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { |
| 108 language_chewing_integer_prefs_[i].Init( | 109 language_chewing_integer_prefs_[i].Init( |
| 109 kChewingIntegerPrefs[i].pref_name, prefs, this); | 110 kChewingIntegerPrefs[i].pref_name, prefs, this); |
| 110 } | 111 } |
| 111 language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this); | 112 language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this); |
| 113 language_hangul_hanja_keys_.Init( |
| 114 prefs::kLanguageHangulHanjaKeys, prefs, this); |
| 112 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { | 115 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { |
| 113 language_pinyin_boolean_prefs_[i].Init( | 116 language_pinyin_boolean_prefs_[i].Init( |
| 114 kPinyinBooleanPrefs[i].pref_name, prefs, this); | 117 kPinyinBooleanPrefs[i].pref_name, prefs, this); |
| 115 } | 118 } |
| 116 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { | 119 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { |
| 117 language_pinyin_int_prefs_[i].Init( | 120 language_pinyin_int_prefs_[i].Init( |
| 118 kPinyinIntegerPrefs[i].pref_name, prefs, this); | 121 kPinyinIntegerPrefs[i].pref_name, prefs, this); |
| 119 } | 122 } |
| 120 language_pinyin_double_pinyin_schema_.Init( | 123 language_pinyin_double_pinyin_schema_.Init( |
| 121 kPinyinDoublePinyinSchema.pref_name, prefs, this); | 124 kPinyinDoublePinyinSchema.pref_name, prefs, this); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (!pref_name || *pref_name == kChewingIntegerPrefs[i].pref_name) { | 228 if (!pref_name || *pref_name == kChewingIntegerPrefs[i].pref_name) { |
| 226 SetLanguageConfigInteger(kChewingSectionName, | 229 SetLanguageConfigInteger(kChewingSectionName, |
| 227 kChewingIntegerPrefs[i].ibus_config_name, | 230 kChewingIntegerPrefs[i].ibus_config_name, |
| 228 language_chewing_integer_prefs_[i].GetValue()); | 231 language_chewing_integer_prefs_[i].GetValue()); |
| 229 } | 232 } |
| 230 } | 233 } |
| 231 if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) { | 234 if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) { |
| 232 SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName, | 235 SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName, |
| 233 language_hangul_keyboard_.GetValue()); | 236 language_hangul_keyboard_.GetValue()); |
| 234 } | 237 } |
| 238 if (!pref_name || *pref_name == prefs::kLanguageHangulHanjaKeys) { |
| 239 SetLanguageConfigString(kHangulSectionName, kHangulHanjaKeysConfigName, |
| 240 language_hangul_hanja_keys_.GetValue()); |
| 241 } |
| 235 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { | 242 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { |
| 236 if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) { | 243 if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) { |
| 237 SetLanguageConfigBoolean(kPinyinSectionName, | 244 SetLanguageConfigBoolean(kPinyinSectionName, |
| 238 kPinyinBooleanPrefs[i].ibus_config_name, | 245 kPinyinBooleanPrefs[i].ibus_config_name, |
| 239 language_pinyin_boolean_prefs_[i].GetValue()); | 246 language_pinyin_boolean_prefs_[i].GetValue()); |
| 240 } | 247 } |
| 241 } | 248 } |
| 242 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { | 249 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { |
| 243 if (!pref_name || *pref_name == kPinyinIntegerPrefs[i].pref_name) { | 250 if (!pref_name || *pref_name == kPinyinIntegerPrefs[i].pref_name) { |
| 244 SetLanguageConfigInteger(kPinyinSectionName, | 251 SetLanguageConfigInteger(kPinyinSectionName, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 std::vector<std::string> split_values; | 334 std::vector<std::string> split_values; |
| 328 if (!value.empty()) | 335 if (!value.empty()) |
| 329 SplitString(value, ',', &split_values); | 336 SplitString(value, ',', &split_values); |
| 330 | 337 |
| 331 // We should call the cros API even when |value| is empty, to disable default | 338 // We should call the cros API even when |value| is empty, to disable default |
| 332 // config. | 339 // config. |
| 333 SetLanguageConfigStringList(section, name, split_values); | 340 SetLanguageConfigStringList(section, name, split_values); |
| 334 } | 341 } |
| 335 | 342 |
| 336 } // namespace chromeos | 343 } // namespace chromeos |
| OLD | NEW |