OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 [ | |
6 { | |
7 "namespace": "experimental.input.ime", | |
8 "platforms": ["chromeos"], | |
9 "types": [ | |
10 { | |
11 "id": "KeyboardEvent", | |
12 "type": "object", | |
13 "description": "See http://www.w3.org/TR/DOM-Level-3-Events/#events-Keyb
oardEvent", | |
14 "properties": { | |
15 "type": {"type": "string", "description": "One of keyup or keydown.",
"enum": ["keyup", "keydown"]}, | |
16 "requestId": {"type": "string", "description": "The ID of the request.
"}, | |
17 "key": {"type": "string", "description": "Value of the key being press
ed"}, | |
18 "altKey": {"type": "boolean", "optional": true, "description": "Whethe
r or not the ALT key is pressed."}, | |
19 "ctrlKey": {"type": "boolean", "optional": true, "description": "Wheth
er or not the CTRL key is pressed."}, | |
20 "shiftKey": {"type": "boolean", "optional": true, "description": "Whet
her or not the SHIFT key is pressed."} | |
21 } | |
22 }, | |
23 { | |
24 "id": "InputContext", | |
25 "type": "object", | |
26 "description": "Describes an input Context", | |
27 "properties": { | |
28 "contextID": {"type": "integer", "description": "This is used to speci
fy targets of text field operations. This ID becomes invalid as soon as onBlur
is called."}, | |
29 "type": {"type": "string", "description": "Type of value this text fie
ld edits, (Text, Number, Password, etc)", "enum": ["text", "number", "password"]
} | |
30 } | |
31 } | |
32 ], | |
33 "functions": [ | |
34 { | |
35 "name": "setComposition", | |
36 "type": "function", | |
37 "description": "Set the current composition. If this extension does not
own the active IME, this fails.", | |
38 "parameters": [ | |
39 { | |
40 "name": "parameters", | |
41 "type": "object", | |
42 "properties": { | |
43 "contextID": { | |
44 "description": "ID of the context where the composition text wil
l be set", | |
45 "type": "integer" | |
46 }, | |
47 "text": { | |
48 "description": "Text to set", | |
49 "type": "string" | |
50 }, | |
51 "selectionStart": { | |
52 "description": "Position in the text that the selection starts a
t.", | |
53 "optional": true, | |
54 "type": "integer" | |
55 }, | |
56 "selectionEnd": { | |
57 "description": "Position in the text that the selection ends at.
", | |
58 "optional": true, | |
59 "type": "integer" | |
60 }, | |
61 "cursor": { | |
62 "description": "Position in the text of the cursor.", | |
63 "type": "integer" | |
64 }, | |
65 "segments": { | |
66 "description": "List of segments and their associated types.", | |
67 "type": "array", | |
68 "optional": true, | |
69 "items": { | |
70 "type": "object", | |
71 "properties": { | |
72 "start": { | |
73 "description": "Index of the character to start this segme
nt at", | |
74 "type": "integer" | |
75 }, | |
76 "end": { | |
77 "description": "Index of the character to end this segment
after.", | |
78 "type": "integer" | |
79 }, | |
80 "style": { | |
81 "description": "How to render this segment", | |
82 "enum": ["underline", "doubleUnderline"], | |
83 "type": "string" | |
84 } | |
85 } | |
86 } | |
87 } | |
88 } | |
89 }, | |
90 { | |
91 "type": "function", | |
92 "name": "callback", | |
93 "optional": true, | |
94 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.extension.lastErro
r is set.", | |
95 "parameters": [ | |
96 { | |
97 "name": "success", | |
98 "type": "boolean" | |
99 } | |
100 ] | |
101 } | |
102 ] | |
103 }, | |
104 { | |
105 "name": "clearComposition", | |
106 "type": "function", | |
107 "description": "Clear the current composition. If this extension does no
t own the active IME, this fails.", | |
108 "parameters": [ | |
109 { | |
110 "name": "parameters", | |
111 "type": "object", | |
112 "properties": { | |
113 "contextID": { | |
114 "description": "ID of the context where the composition will be
cleared", | |
115 "type": "integer" | |
116 } | |
117 } | |
118 }, | |
119 { | |
120 "type": "function", | |
121 "name": "callback", | |
122 "optional": true, | |
123 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.extension.lastErro
r is set.", | |
124 "parameters": [ | |
125 { | |
126 "name": "success", | |
127 "type": "boolean" | |
128 } | |
129 ] | |
130 } | |
131 ] | |
132 }, | |
133 { | |
134 "name": "commitText", | |
135 "type": "function", | |
136 "description": "Commits the provided text to the current input.", | |
137 "parameters": [ | |
138 { | |
139 "name": "parameters", | |
140 "type": "object", | |
141 "properties": { | |
142 "contextID": { | |
143 "description": "ID of the context where the text will be committ
ed", | |
144 "type": "integer" | |
145 }, | |
146 "text": { | |
147 "description": "The text to commit", | |
148 "type": "string" | |
149 } | |
150 } | |
151 }, | |
152 { | |
153 "type": "function", | |
154 "name": "callback", | |
155 "optional": true, | |
156 "description": "Called when the operation completes with a boolean i
ndicating if the text was accepted or not. On failure, chrome.extension.lastErro
r is set.", | |
157 "parameters": [ | |
158 { | |
159 "name": "success", | |
160 "type": "boolean" | |
161 } | |
162 ] | |
163 } | |
164 ] | |
165 }, | |
166 { | |
167 "name": "setCandidateWindowProperties", | |
168 "type": "function", | |
169 "description": "Sets the properties of the candidate window. This fails
if the extension doesn’t own the active IME", | |
170 "parameters": [ | |
171 { | |
172 "name": "parameters", | |
173 "type": "object", | |
174 "properties": { | |
175 "engineID": { | |
176 "description": "ID of the engine to set properties on.", | |
177 "type": "string" | |
178 }, | |
179 "properties": { | |
180 "type": "object", | |
181 "properties": { | |
182 "visible": { | |
183 "type": "boolean", | |
184 "optional": true, | |
185 "description": "True to show the Candidate window, false to
hide it." | |
186 }, | |
187 "cursorVisible": { | |
188 "type": "boolean", | |
189 "optional": true, | |
190 "description": "True to show the cursor, false to hide it." | |
191 }, | |
192 "vertical": { | |
193 "type": "boolean", | |
194 "optional": true, | |
195 "description": "True if the candidate window should be rende
red vertical, false to make it horizontal." | |
196 }, | |
197 "pageSize": { | |
198 "type": "integer", | |
199 "optional": true, | |
200 "description": "The number of candidates to display per page
." | |
201 }, | |
202 "auxiliaryText": { | |
203 "type": "string", | |
204 "optional": true, | |
205 "description": "Text that is shown at the bottom of the cand
idate window." | |
206 }, | |
207 "auxiliaryTextVisible": { | |
208 "type": "boolean", | |
209 "optional": true, | |
210 "description": "True to display the auxiliary text, false to
hide it." | |
211 } | |
212 } | |
213 } | |
214 } | |
215 }, | |
216 { | |
217 "type": "function", | |
218 "name": "callback", | |
219 "optional": true, | |
220 "description": "Called when the operation completes.", | |
221 "parameters": [ | |
222 { | |
223 "name": "success", | |
224 "type": "boolean" | |
225 } | |
226 ] | |
227 } | |
228 ] | |
229 }, | |
230 { | |
231 "name": "setCandidates", | |
232 "type": "function", | |
233 "description": "Sets the current candidate list. This fails if this exte
nsion doesn’t own the active IME", | |
234 "parameters": [ | |
235 { | |
236 "name": "parameters", | |
237 "type": "object", | |
238 "properties": { | |
239 "contextID": { | |
240 "description": "ID of the context that owns the candidate window
.", | |
241 "type": "integer" | |
242 }, | |
243 "candidates": { | |
244 "description": "List of candidates to show in the candidate wind
ow", | |
245 "type": "array", | |
246 "items": { | |
247 "type": "object", | |
248 "properties": { | |
249 "candidate": {"type": "string", "description": "The candidat
e"}, | |
250 "id": {"type": "integer", "description": "The candidate's id
"}, | |
251 "parentId": {"type": "integer", "optional": true, "descripti
on": "The id to add these candidates under"}, | |
252 "label": {"type": "string", "optional": true, "description":
"Short string displayed to next to the candidate, often the shortcut key or ind
ex"}, | |
253 "annotation": {"type": "string", "optional": true, "descript
ion": "Additional text describing the candidate"} | |
254 } | |
255 } | |
256 } | |
257 } | |
258 }, | |
259 { | |
260 "type": "function", | |
261 "name": "callback", | |
262 "optional": true, | |
263 "description": "Called when the operation completes.", | |
264 "parameters": [ | |
265 { | |
266 "name": "success", | |
267 "type": "boolean" | |
268 } | |
269 ] | |
270 } | |
271 ] | |
272 }, | |
273 { | |
274 "name": "setCursorPosition", | |
275 "type": "function", | |
276 "description": "Set the position of the cursor in the candidate window.
This is a no-op if this extension does not own the active IME.", | |
277 "parameters": [ | |
278 { | |
279 "name": "parameters", | |
280 "type": "object", | |
281 "properties": { | |
282 "contextID": { | |
283 "description": "ID of the context that owns the candidate window
.", | |
284 "type": "integer" | |
285 }, | |
286 "candidateID": { | |
287 "description": "ID of the candidate to select.", | |
288 "type": "integer" | |
289 } | |
290 } | |
291 }, | |
292 { | |
293 "type": "function", | |
294 "name": "callback", | |
295 "optional": true, | |
296 "description": "Called when the operation completes", | |
297 "parameters": [ | |
298 { | |
299 "name": "success", | |
300 "type": "boolean" | |
301 } | |
302 ] | |
303 } | |
304 ] | |
305 }, | |
306 { | |
307 "name": "setMenuItems", | |
308 "type": "function", | |
309 "description": "Adds the provided menu items to the language menu when t
his IME is active.", | |
310 "parameters": [ | |
311 { | |
312 "name": "parameters", | |
313 "type": "object", | |
314 "properties": { | |
315 "engineID": { | |
316 "description": "ID of the engine to use", | |
317 "type": "string" | |
318 }, | |
319 "items": { | |
320 "description": "MenuItems to add. They will be added in the orde
r they exist in the array.", | |
321 "type": "array", | |
322 "items": { | |
323 "type": "object", | |
324 "description": "A menu item used by an input method to interac
t with the user from the language menu.", | |
325 "properties": { | |
326 "id": {"type": "string", "description": "String that will be
passed to callbacks referencing this MenuItem."}, | |
327 "label": {"type": "string", "optional": true, "description":
"Text displayed in the menu for this item."}, | |
328 "style": { | |
329 "type": "string", | |
330 "optional": true, | |
331 "description": "Enum representing if this item is: none, c
heck, radio, or a separator. Radio buttons between separators are considered gr
ouped.", | |
332 "enum": ["none", "check", "radio", "separator"] | |
333 }, | |
334 "visible": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is visible."}, | |
335 "checked": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item should be drawn with a check."}, | |
336 "enabled": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is enabled."} | |
337 } | |
338 } | |
339 } | |
340 } | |
341 }, | |
342 { | |
343 "type": "function", | |
344 "name": "callback", | |
345 "optional": true, | |
346 "description": "", | |
347 "parameters": [] | |
348 } | |
349 ] | |
350 }, | |
351 { | |
352 "name": "updateMenuItems", | |
353 "type": "function", | |
354 "description": "Updates the state of the MenuItems specified", | |
355 "parameters": [ | |
356 { | |
357 "name": "parameters", | |
358 "type": "object", | |
359 "properties": { | |
360 "engineID": { | |
361 "description": "ID of the engine to use", | |
362 "type": "string" | |
363 }, | |
364 "items": { | |
365 "description": "Array of MenuItems to update", | |
366 "type": "array", | |
367 "items": { | |
368 "type": "object", | |
369 "description": "A menu item used by an input method to interac
t with the user from the language menu.", | |
370 "properties": { | |
371 "id": {"type": "string", "description": "String that will be
passed to callbacks referencing this MenuItem."}, | |
372 "label": {"type": "string", "optional": true, "description":
"Text displayed in the menu for this item."}, | |
373 "style": { | |
374 "type": "string", | |
375 "optional": true, | |
376 "description": "Enum representing if this item is: none, c
heck, radio, or a separator. Radio buttons between separators are considered gr
ouped.", | |
377 "enum": ["none", "check", "radio", "separator"] | |
378 }, | |
379 "visible": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is visible."}, | |
380 "checked": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item should be drawn with a check."}, | |
381 "enabled": {"type": "boolean", "optional": true, "descriptio
n": "Indicates this item is enabled."} | |
382 } | |
383 } | |
384 } | |
385 } | |
386 }, | |
387 { | |
388 "type": "function", | |
389 "name": "callback", | |
390 "optional": true, | |
391 "description": "Called when the operation completes", | |
392 "parameters": [] | |
393 } | |
394 ] | |
395 }, | |
396 { | |
397 "name": "eventHandled", | |
398 "nodoc": true, | |
399 "type": "function", | |
400 "description": "Used internally to send a response for onKeyEvent.", | |
401 "parameters": [ | |
402 {"type": "string", "name": "requestId"}, | |
403 {"type": "boolean", "name": "response"} | |
404 ] | |
405 } | |
406 ], | |
407 "events": [ | |
408 { | |
409 "name": "onActivate", | |
410 "type": "function", | |
411 "description": "This event is sent when an IME is activated. It signals
that the IME will be receiving onKeyPress events.", | |
412 "parameters": [ | |
413 { | |
414 "type": "string", | |
415 "name": "engineID", | |
416 "description": "ID of the engine receiving the event" | |
417 } | |
418 ] | |
419 }, | |
420 { | |
421 "name": "onDeactivated", | |
422 "type": "function", | |
423 "description": "This event is sent when an IME is deactivated. It signal
s that the IME will no longer be receiving onKeyPress events.", | |
424 "parameters": [ | |
425 { | |
426 "type": "string", | |
427 "name": "engineID", | |
428 "description": "ID of the engine receiving the event" | |
429 } | |
430 ] | |
431 }, | |
432 { | |
433 "name": "onFocus", | |
434 "type": "function", | |
435 "description": "This event is sent when focus enters a text box. It is s
ent to all extensions that are listening to this event, and enabled by the user.
", | |
436 "parameters": [ | |
437 { | |
438 "type": "InputContext", | |
439 "name": "context", | |
440 "description": "Describes the text field that has acquired focus." | |
441 } | |
442 ] | |
443 }, | |
444 { | |
445 "name": "onBlur", | |
446 "type": "function", | |
447 "description": "This event is sent when focus leaves a text box. It is s
ent to all extensions that are listening to this event, and enabled by the user.
", | |
448 "parameters": [ | |
449 { | |
450 "type": "integer", | |
451 "name": "contextID", | |
452 "description": "The ID of the text field that has lost focus. The ID
is invalid after this call" | |
453 } | |
454 ] | |
455 }, | |
456 { | |
457 "name": "onInputContextUpdate", | |
458 "type": "function", | |
459 "description": "This event is sent when the properties of the current In
putContext change, such as the the type. It is sent to all extensions that are l
istening to this event, and enabled by the user.", | |
460 "parameters": [ | |
461 { | |
462 "type": "InputContext", | |
463 "name": "context", | |
464 "description": "An InputContext object describing the text field tha
t has changed." | |
465 } | |
466 ] | |
467 }, | |
468 { | |
469 "name": "onKeyEvent", | |
470 "type": "function", | |
471 "description": "This event is sent if this extension owns the active IME
.", | |
472 "parameters": [ | |
473 { | |
474 "type": "string", | |
475 "name": "engineID", | |
476 "description": "ID of the engine receiving the event" | |
477 }, | |
478 { | |
479 "type": "KeyboardEvent", | |
480 "name": "keyData", | |
481 "description": "Data on the key event" | |
482 } | |
483 ], | |
484 "returns": { | |
485 "type": "boolean", | |
486 "description": "True if the keystroke was handled, false if not" | |
487 } | |
488 }, | |
489 { | |
490 "name": "onCandidateClicked", | |
491 "type": "function", | |
492 "description": "This event is sent if this extension owns the active IME
.", | |
493 "parameters": [ | |
494 { | |
495 "type": "string", | |
496 "name": "engineID", | |
497 "description": "ID of the engine receiving the event" | |
498 }, | |
499 { | |
500 "type": "integer", | |
501 "name": "candidateID", | |
502 "description": "ID of the candidate that was clicked." | |
503 }, | |
504 { | |
505 "type": "string", | |
506 "name": "button", | |
507 "description": "Which mouse buttons was clicked.", | |
508 "enum": ["left", "middle", "right"] | |
509 } | |
510 ] | |
511 }, | |
512 { | |
513 "name": "onMenuItemActivated", | |
514 "type": "function", | |
515 "description": "Called when the user selects a menu item", | |
516 "parameters": [ | |
517 { | |
518 "type": "string", | |
519 "name": "engineID", | |
520 "description": "ID of the engine receiving the event" | |
521 }, | |
522 { | |
523 "type": "string", | |
524 "name": "name", | |
525 "description": "Name of the MenuItem which was activated" | |
526 } | |
527 ] | |
528 } | |
529 ] | |
530 } | |
531 ] | |
OLD | NEW |