Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1939)

Side by Side Diff: chrome/browser/chromeos/preferences.cc

Issue 2457001: Add Chewing integer preferences (Closed)
Patch Set: Code Review Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/chromeos/cros/cros_library.h" 9 #include "chrome/browser/chromeos/cros/cros_library.h"
10 #include "chrome/browser/chromeos/cros/language_library.h" 10 #include "chrome/browser/chromeos/cros/language_library.h"
(...skipping 22 matching lines...) Expand all
33 UTF8ToWide(kFallbackInputMethodId)); // EN layout 33 UTF8ToWide(kFallbackInputMethodId)); // EN layout
34 for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) { 34 for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
35 prefs->RegisterBooleanPref(kChewingBooleanPrefs[i].pref_name, 35 prefs->RegisterBooleanPref(kChewingBooleanPrefs[i].pref_name,
36 kChewingBooleanPrefs[i].default_pref_value); 36 kChewingBooleanPrefs[i].default_pref_value);
37 } 37 }
38 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) { 38 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
39 prefs->RegisterStringPref( 39 prefs->RegisterStringPref(
40 kChewingMultipleChoicePrefs[i].pref_name, 40 kChewingMultipleChoicePrefs[i].pref_name,
41 kChewingMultipleChoicePrefs[i].default_pref_value); 41 kChewingMultipleChoicePrefs[i].default_pref_value);
42 } 42 }
43 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
44 prefs->RegisterIntegerPref(kChewingIntegerPrefs[i].pref_name,
45 kChewingIntegerPrefs[i].default_pref_value);
46 }
43 prefs->RegisterStringPref(prefs::kLanguageHangulKeyboard, 47 prefs->RegisterStringPref(prefs::kLanguageHangulKeyboard,
44 kHangulKeyboardNameIDPairs[0].keyboard_id); 48 kHangulKeyboardNameIDPairs[0].keyboard_id);
45 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { 49 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
46 prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name, 50 prefs->RegisterBooleanPref(kPinyinBooleanPrefs[i].pref_name,
47 kPinyinBooleanPrefs[i].default_pref_value); 51 kPinyinBooleanPrefs[i].default_pref_value);
48 } 52 }
49 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { 53 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) {
50 prefs->RegisterIntegerPref(kPinyinIntegerPrefs[i].pref_name, 54 prefs->RegisterIntegerPref(kPinyinIntegerPrefs[i].pref_name,
51 kPinyinIntegerPrefs[i].default_pref_value); 55 kPinyinIntegerPrefs[i].default_pref_value);
52 } 56 }
(...skipping 16 matching lines...) Expand all
69 prefs::kLanguageHotkeyPreviousEngine, prefs, this); 73 prefs::kLanguageHotkeyPreviousEngine, prefs, this);
70 language_preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this); 74 language_preload_engines_.Init(prefs::kLanguagePreloadEngines, prefs, this);
71 for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) { 75 for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) {
72 language_chewing_boolean_prefs_[i].Init( 76 language_chewing_boolean_prefs_[i].Init(
73 kChewingBooleanPrefs[i].pref_name, prefs, this); 77 kChewingBooleanPrefs[i].pref_name, prefs, this);
74 } 78 }
75 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) { 79 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
76 language_chewing_multiple_choice_prefs_[i].Init( 80 language_chewing_multiple_choice_prefs_[i].Init(
77 kChewingMultipleChoicePrefs[i].pref_name, prefs, this); 81 kChewingMultipleChoicePrefs[i].pref_name, prefs, this);
78 } 82 }
83 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
84 language_chewing_integer_prefs_[i].Init(
85 kChewingIntegerPrefs[i].pref_name, prefs, this);
86 }
79 language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this); 87 language_hangul_keyboard_.Init(prefs::kLanguageHangulKeyboard, prefs, this);
80 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { 88 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
81 language_pinyin_boolean_prefs_[i].Init( 89 language_pinyin_boolean_prefs_[i].Init(
82 kPinyinBooleanPrefs[i].pref_name, prefs, this); 90 kPinyinBooleanPrefs[i].pref_name, prefs, this);
83 } 91 }
84 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { 92 for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) {
85 language_pinyin_int_prefs_[i].Init( 93 language_pinyin_int_prefs_[i].Init(
86 kPinyinIntegerPrefs[i].pref_name, prefs, this); 94 kPinyinIntegerPrefs[i].pref_name, prefs, this);
87 } 95 }
88 for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) { 96 for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 155 }
148 } 156 }
149 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) { 157 for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) {
150 if (!pref_name || *pref_name == kChewingMultipleChoicePrefs[i].pref_name) { 158 if (!pref_name || *pref_name == kChewingMultipleChoicePrefs[i].pref_name) {
151 SetLanguageConfigString( 159 SetLanguageConfigString(
152 kChewingSectionName, 160 kChewingSectionName,
153 kChewingMultipleChoicePrefs[i].ibus_config_name, 161 kChewingMultipleChoicePrefs[i].ibus_config_name,
154 language_chewing_multiple_choice_prefs_[i].GetValue()); 162 language_chewing_multiple_choice_prefs_[i].GetValue());
155 } 163 }
156 } 164 }
165 for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) {
166 if (!pref_name || *pref_name == kChewingIntegerPrefs[i].pref_name) {
167 SetLanguageConfigInteger(kChewingSectionName,
168 kChewingIntegerPrefs[i].ibus_config_name,
169 language_chewing_integer_prefs_[i].GetValue());
170 }
171 }
157 if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) { 172 if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) {
158 SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName, 173 SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName,
159 language_hangul_keyboard_.GetValue()); 174 language_hangul_keyboard_.GetValue());
160 } 175 }
161 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { 176 for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) {
162 if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) { 177 if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) {
163 SetLanguageConfigBoolean(kPinyinSectionName, 178 SetLanguageConfigBoolean(kPinyinSectionName,
164 kPinyinBooleanPrefs[i].ibus_config_name, 179 kPinyinBooleanPrefs[i].ibus_config_name,
165 language_pinyin_boolean_prefs_[i].GetValue()); 180 language_pinyin_boolean_prefs_[i].GetValue());
166 } 181 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 std::vector<std::wstring> split_values; 250 std::vector<std::wstring> split_values;
236 if (!value.empty()) { 251 if (!value.empty()) {
237 SplitString(value, L',', &split_values); 252 SplitString(value, L',', &split_values);
238 } 253 }
239 // We should call the cros API even when |value| is empty, to disable default 254 // We should call the cros API even when |value| is empty, to disable default
240 // config. 255 // config.
241 SetLanguageConfigStringList(section, name, split_values); 256 SetLanguageConfigStringList(section, name, split_values);
242 } 257 }
243 258
244 } // namespace chromeos 259 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.h ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698