OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 // A preferred physical keyboard layout for the input method (e.g., "us", | 68 // A preferred physical keyboard layout for the input method (e.g., "us", |
69 // "us(dvorak)", "jp"). Comma separated layout names do NOT appear. | 69 // "us(dvorak)", "jp"). Comma separated layout names do NOT appear. |
70 std::string keyboard_layout_; | 70 std::string keyboard_layout_; |
71 // Preferred virtual keyboard layouts for the input method. Comma separated | 71 // Preferred virtual keyboard layouts for the input method. Comma separated |
72 // layout names in order of priority, such as "handwriting,us", could appear. | 72 // layout names in order of priority, such as "handwriting,us", could appear. |
73 std::vector<std::string> virtual_keyboard_layouts_; | 73 std::vector<std::string> virtual_keyboard_layouts_; |
74 // Language code like "ko", "ja", "en-US", and "zh-CN". | 74 // Language code like "ko", "ja", "en-US", and "zh-CN". |
75 std::string language_code_; | 75 std::string language_code_; |
76 }; | 76 }; |
77 | 77 |
78 // A structure which represents a property for an input method engine. For | 78 // A structure which represents a property for an input method engine. |
79 // details, please check a comment for the LanguageRegisterImePropertiesFunction | 79 struct InputMethodProperty { |
80 // typedef below. | 80 InputMethodProperty(const std::string& in_key, |
81 // TODO(yusukes): Rename this struct. "InputMethodProperty" might be better? | |
82 struct ImeProperty { | |
83 ImeProperty(const std::string& in_key, | |
84 const std::string& in_label, | 81 const std::string& in_label, |
85 bool in_is_selection_item, | 82 bool in_is_selection_item, |
86 bool in_is_selection_item_checked, | 83 bool in_is_selection_item_checked, |
87 int in_selection_item_id); | 84 int in_selection_item_id); |
88 | 85 |
89 ImeProperty(); | 86 InputMethodProperty(); |
90 ~ImeProperty(); | 87 ~InputMethodProperty(); |
91 | 88 |
92 // Debug print function. | 89 // Debug print function. |
93 std::string ToString() const; | 90 std::string ToString() const; |
94 | 91 |
95 std::string key; // A key which identifies the property. Non-empty string. | 92 std::string key; // A key which identifies the property. Non-empty string. |
96 // (e.g. "InputMode.HalfWidthKatakana") | 93 // (e.g. "InputMode.HalfWidthKatakana") |
97 // DEPRECATED: TODO(yusukes): Remove this when it's ready. | |
98 std::string deprecated_icon_path; | |
99 std::string label; // A description of the property. Non-empty string. | 94 std::string label; // A description of the property. Non-empty string. |
100 // (e.g. "Switch to full punctuation mode", "Hiragana") | 95 // (e.g. "Switch to full punctuation mode", "Hiragana") |
101 bool is_selection_item; // true if the property is a selection item. | 96 bool is_selection_item; // true if the property is a selection item. |
102 bool is_selection_item_checked; // true if |is_selection_item| is true and | 97 bool is_selection_item_checked; // true if |is_selection_item| is true and |
103 // the selection_item is selected. | 98 // the selection_item is selected. |
104 int selection_item_id; // A group ID (>= 0) of the selection item. | 99 int selection_item_id; // A group ID (>= 0) of the selection item. |
105 // kInvalidSelectionItemId if |is_selection_item| is | 100 // kInvalidSelectionItemId if |is_selection_item| is |
106 // false. | 101 // false. |
107 static const int kInvalidSelectionItemId = -1; | 102 static const int kInvalidSelectionItemId = -1; |
108 }; | 103 }; |
109 typedef std::vector<ImeProperty> ImePropertyList; | 104 typedef std::vector<InputMethodProperty> InputMethodPropertyList; |
110 | 105 |
111 // A structure which represents a value of an input method configuration item. | 106 // A structure which represents a value of an input method configuration item. |
112 // This struct is used by SetInputMethodConfig(). | 107 // This struct is used by SetInputMethodConfig(). |
113 struct InputMethodConfigValue { | 108 struct InputMethodConfigValue { |
114 InputMethodConfigValue(); | 109 InputMethodConfigValue(); |
115 ~InputMethodConfigValue(); | 110 ~InputMethodConfigValue(); |
116 | 111 |
117 // Debug print function. | 112 // Debug print function. |
118 std::string ToString() const; | 113 std::string ToString() const; |
119 | 114 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // selection_item_id: 1 | 155 // selection_item_id: 1 |
161 // ---------------------------------- | 156 // ---------------------------------- |
162 // key: InputMode.Katakana | 157 // key: InputMode.Katakana |
163 // label: Katakana | 158 // label: Katakana |
164 // is_selection_item: true | 159 // is_selection_item: true |
165 // is_selection_item_checked: false | 160 // is_selection_item_checked: false |
166 // selection_item_id: 1 | 161 // selection_item_id: 1 |
167 // ---------------------------------- | 162 // ---------------------------------- |
168 // ... | 163 // ... |
169 // ---------------------------------- | 164 // ---------------------------------- |
170 virtual void OnRegisterImeProperties(const ImePropertyList& prop_list) = 0; | 165 virtual void OnRegisterImeProperties( |
| 166 const InputMethodPropertyList& prop_list) = 0; |
171 | 167 |
172 // Called when "UpdateProperty" signal is sent from ibus-daemon. The | 168 // Called when "UpdateProperty" signal is sent from ibus-daemon. The |
173 // signal contains one or more properties which is updated | 169 // signal contains one or more properties which is updated |
174 // recently. Keys the signal contains are a subset of keys registered | 170 // recently. Keys the signal contains are a subset of keys registered |
175 // by the "RegisterProperties" signal above. For example, Japanese | 171 // by the "RegisterProperties" signal above. For example, Japanese |
176 // input method might send the following properties: | 172 // input method might send the following properties: |
177 // | 173 // |
178 // ---------------------------------- | 174 // ---------------------------------- |
179 // key: InputMode.Hiragana | 175 // key: InputMode.Hiragana |
180 // label: Hiragana | 176 // label: Hiragana |
181 // is_selection_item: true | 177 // is_selection_item: true |
182 // is_selection_item_checked: false | 178 // is_selection_item_checked: false |
183 // selection_item_id: ... | 179 // selection_item_id: ... |
184 // ---------------------------------- | 180 // ---------------------------------- |
185 // key: InputMode.Katakana | 181 // key: InputMode.Katakana |
186 // label: Katakana | 182 // label: Katakana |
187 // is_selection_item: true | 183 // is_selection_item: true |
188 // is_selection_item_checked: true | 184 // is_selection_item_checked: true |
189 // selection_item_id: ... | 185 // selection_item_id: ... |
190 // ---------------------------------- | 186 // ---------------------------------- |
191 // | 187 // |
192 // Note: Please do not use selection_item_ids in |prop_list|. Dummy | 188 // Note: Please do not use selection_item_ids in |prop_list|. Dummy |
193 // values are filled in the field. | 189 // values are filled in the field. |
194 virtual void OnUpdateImeProperty(const ImePropertyList& prop_list) = 0; | 190 virtual void OnUpdateImeProperty( |
| 191 const InputMethodPropertyList& prop_list) = 0; |
195 | 192 |
196 // Called when ibus connects or disconnects. | 193 // Called when ibus connects or disconnects. |
197 virtual void OnConnectionChange(bool connected) = 0; | 194 virtual void OnConnectionChange(bool connected) = 0; |
198 }; | 195 }; |
199 | 196 |
200 // Creates an instance of the class. The constructor is unused. | 197 // Creates an instance of the class. The constructor is unused. |
201 static IBusController* Create(); | 198 static IBusController* Create(); |
202 | 199 |
203 virtual ~IBusController(); | 200 virtual ~IBusController(); |
204 | 201 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 virtual bool InputMethodIdIsWhitelisted( | 266 virtual bool InputMethodIdIsWhitelisted( |
270 const std::string& input_method_id) = 0; | 267 const std::string& input_method_id) = 0; |
271 // Returns true if |xkb_layout| is supported. | 268 // Returns true if |xkb_layout| is supported. |
272 virtual bool XkbLayoutIsSupported(const std::string& xkb_layout) = 0; | 269 virtual bool XkbLayoutIsSupported(const std::string& xkb_layout) = 0; |
273 }; | 270 }; |
274 | 271 |
275 } // namespace input_method | 272 } // namespace input_method |
276 } // namespace chromeos | 273 } // namespace chromeos |
277 | 274 |
278 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ | 275 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_IBUS_CONTROLLER_H_ |
OLD | NEW |