blob: 252ed8c0b7dbd22219ccb973ffc25d6c86fbb03d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
// Copyright (c) 2012 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.
#ifndef CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
#define CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
#include <stddef.h> // For size_t
#include "components/user_prefs/pref_registry_syncable.h"
class PrefRegistrySimple;
// TODO(yusukes): Rename this file to input_method_preference.cc. Since
// "language" usually means UI language, the current file name is confusing.
// The namespace should also be changed to "namespace input_method {".
// This file defines types and declare variables used in "Languages and
// Input" settings in Chromium OS.
namespace chromeos {
namespace language_prefs {
// TODO(yusukes): Remove the "Language" prefix from all structs and variables.
// They're redundant (we already have the language_prefs namespace) and even
// confusing.
// The struct is used for preferences consisting of multiple choices, like
// punctuation types used in Japanese input method.
template <typename DataType>
struct LanguageMultipleChoicePreference {
const char* pref_name; // Chrome preference name.
DataType default_pref_value;
const char* ibus_config_name;
// Currently we have 10 combobox items at most.
static const size_t kMaxItems = 11;
struct {
DataType ibus_config_value;
int item_message_id; // Resource grd ID for the combobox item.
} values_and_ids[kMaxItems];
int label_message_id; // Resource grd ID for the label.
user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status;
};
// The struct is used for preferences of boolean values, like switches to
// enable or disable particular features.
struct LanguageBooleanPrefs {
const char* pref_name; // Chrome preference name.
bool default_pref_value;
const char* ibus_config_name;
int message_id;
user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status;
};
// The struct is used for preferences of integer range values, like the
// key repeat rate.
struct LanguageIntegerRangePreference {
const char* pref_name; // Chrome preference name.
int default_pref_value;
int min_pref_value;
int max_pref_value;
const char* ibus_config_name;
int message_id;
user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status;
};
// ---------------------------------------------------------------------------
// For ibus-daemon
// ---------------------------------------------------------------------------
extern const char kGeneralSectionName[];
extern const char kPreloadEnginesConfigName[];
// ---------------------------------------------------------------------------
// For Traditional Chinese input method (ibus-mozc-chewing)
// ---------------------------------------------------------------------------
extern const char kChewingSectionName[];
extern const LanguageBooleanPrefs kChewingBooleanPrefs[];
// This is not ideal, but we should hard-code the number here as the value
// is referenced in other header files as array sizes. We have a
// COMPILE_ASSERT in .cc to ensure that the number is correct.
const size_t kNumChewingBooleanPrefs = 8 - 2; // -2 is for crosbug.com/14185
extern const LanguageIntegerRangePreference kChewingIntegerPrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumChewingIntegerPrefs = 2;
const int kChewingMaxChiSymbolLenIndex = 0;
const int kChewingCandPerPageIndex = 1;
extern const LanguageMultipleChoicePreference<const char*>
kChewingMultipleChoicePrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumChewingMultipleChoicePrefs = 2;
extern const LanguageMultipleChoicePreference<int> kChewingHsuSelKeyType;
// ---------------------------------------------------------------------------
// For Korean input method (ibus-mozc-hangul)
// ---------------------------------------------------------------------------
extern const char kHangulSectionName[];
extern const char kHangulKeyboardConfigName[];
extern const char kHangulHanjaBindingKeysConfigName[];
extern const char kHangulHanjaBindingKeys[];
struct HangulKeyboardNameIDPair {
int message_id;
const char* keyboard_id;
};
extern const HangulKeyboardNameIDPair kHangulKeyboardNameIDPairs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumHangulKeyboardNameIDPairs = 5;
// ---------------------------------------------------------------------------
// For Simplified Chinese input method (ibus-mozc-pinyin)
// ---------------------------------------------------------------------------
extern const char kPinyinSectionName[];
extern const LanguageBooleanPrefs kPinyinBooleanPrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumPinyinBooleanPrefs = 11;
extern const LanguageMultipleChoicePreference<int> kPinyinDoublePinyinSchema;
struct PinyinIntegerPref {
const char* pref_name; // Chrome preference name.
int default_pref_value;
const char* ibus_config_name;
user_prefs::PrefRegistrySyncable::PrefSyncStatus sync_status;
// TODO(yusukes): Add message_id if needed.
};
extern const PinyinIntegerPref kPinyinIntegerPrefs[];
const size_t kNumPinyinIntegerPrefs = 1;
// ---------------------------------------------------------------------------
// For Japanese input method (ibus-mozc)
// ---------------------------------------------------------------------------
extern const char kMozcSectionName[];
extern const LanguageBooleanPrefs kMozcBooleanPrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumMozcBooleanPrefs = 4;
extern const LanguageMultipleChoicePreference<const char*>
kMozcMultipleChoicePrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumMozcMultipleChoicePrefs = 8;
extern const LanguageIntegerRangePreference kMozcIntegerPrefs[];
// See comments at kNumChewingBooleanPrefs for why we hard-code this here.
const size_t kNumMozcIntegerPrefs = 1;
// ---------------------------------------------------------------------------
// For keyboard stuff
// ---------------------------------------------------------------------------
// A delay between the first and the start of the rest.
extern const int kXkbAutoRepeatDelayInMs;
// An interval between the repeated keys.
extern const int kXkbAutoRepeatIntervalInMs;
// A string Chrome preference (Local State) of the preferred keyboard layout in
// the login screen.
extern const char kPreferredKeyboardLayout[];
// Registers non-user prefs for the default keyboard layout on the login screen.
void RegisterPrefs(PrefRegistrySimple* registry);
} // language_prefs
} // chromeos
#endif // CHROME_BROWSER_CHROMEOS_LANGUAGE_PREFERENCES_H_
|