Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / common / extensions / api / input_ime.json
blobe682d40b82f5dd438f403d95d71594815730d05c
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.
6   {
7     "namespace": "input.ime",
8     "description": "Use the <code>chrome.input.ime</code> API to implement a custom IME for Chrome OS. This allows your extension to handle keystrokes, set the composition, and manage the candidate window.",
9     "platforms": ["chromeos"],
10     "types": [
11       {
12         "id": "KeyboardEvent",
13         "type": "object",
14         "description": "See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent",
15         "properties": {
16           "type": {"type": "string", "description": "One of keyup or keydown.", "enum": ["keyup", "keydown"]},
17           "requestId": {"type": "string", "description": "The ID of the request."},
18           "extensionId": {"type": "string", "optional": true, "description": "The extension ID of the sender of this keyevent."},
19           "key": {"type": "string", "description": "Value of the key being pressed"},
20           "code": {"type": "string", "description": "Value of the physical key being pressed. The value is not affected by current keyboard layout or modifier state."},
21           "altKey": {"type": "boolean", "optional": true, "description": "Whether or not the ALT key is pressed."},
22           "ctrlKey": {"type": "boolean", "optional": true, "description": "Whether or not the CTRL key is pressed."},
23           "shiftKey": {"type": "boolean", "optional": true, "description": "Whether or not the SHIFT key is pressed."},
24           "capsLock": {"type": "boolean", "optional": true, "description": "Whether or not the CAPS_LOCK is enabled."}
25         }
26       },
27       {
28         "id": "InputContext",
29         "type": "object",
30         "description": "Describes an input Context",
31         "properties": {
32           "contextID": {"type": "integer", "description": "This is used to specify targets of text field operations.  This ID becomes invalid as soon as onBlur is called."},
33           "type": {"type": "string", "description": "Type of value this text field edits, (Text, Number, URL, etc)", "enum": ["text", "search", "tel", "url", "email", "number"]}
34         }
35       },
36       {
37         "id": "MenuItem",
38         "type": "object",
39         "description": "A menu item used by an input method to interact with the user from the language menu.",
40         "properties": {
41           "id": {"type": "string", "description": "String that will be passed to callbacks referencing this MenuItem."},
42           "label": {"type": "string", "optional": true, "description": "Text displayed in the menu for this item."},
43           "style": {
44             "type": "string",
45             "optional": true,
46             "description": "Enum representing if this item is: check, radio, or a separator.  Radio buttons between separators are considered grouped.",
47             "enum": ["check", "radio", "separator"]
48           },
49           "visible": {"type": "boolean", "optional": true, "description": "Indicates this item is visible."},
50           "checked": {"type": "boolean", "optional": true, "description": "Indicates this item should be drawn with a check."},
51           "enabled": {"type": "boolean", "optional": true, "description": "Indicates this item is enabled."}
52         }
53       }
54     ],
55     "functions": [
56       {
57         "name": "setComposition",
58         "type": "function",
59         "description": "Set the current composition. If this extension does not own the active IME, this fails.",
60         "parameters": [
61           {
62             "name": "parameters",
63             "type": "object",
64             "properties": {
65               "contextID": {
66                 "description": "ID of the context where the composition text will be set",
67                 "type": "integer"
68               },
69               "text": {
70                 "description": "Text to set",
71                 "type": "string"
72               },
73               "selectionStart": {
74                 "description": "Position in the text that the selection starts at.",
75                 "optional": true,
76                 "type": "integer"
77               },
78               "selectionEnd": {
79                 "description": "Position in the text that the selection ends at.",
80                 "optional": true,
81                 "type": "integer"
82               },
83               "cursor": {
84                 "description": "Position in the text of the cursor.",
85                 "type": "integer"
86               },
87               "segments": {
88                 "description": "List of segments and their associated types.",
89                 "type": "array",
90                 "optional": true,
91                 "items": {
92                   "type": "object",
93                   "properties": {
94                     "start": {
95                       "description": "Index of the character to start this segment at",
96                       "type": "integer"
97                     },
98                     "end": {
99                       "description": "Index of the character to end this segment after.",
100                       "type": "integer"
101                     },
102                     "style": {
103                       "description": "How to render this segment",
104                       "enum": ["underline", "doubleUnderline"],
105                       "type": "string"
106                     }
107                   }
108                 }
109               }
110             }
111           },
112           {
113             "type": "function",
114             "name": "callback",
115             "optional": true,
116             "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
117             "parameters": [
118               {
119                 "name": "success",
120                 "type": "boolean"
121               }
122             ]
123           }
124         ]
125       },
126       {
127         "name": "clearComposition",
128         "type": "function",
129         "description": "Clear the current composition. If this extension does not own the active IME, this fails.",
130         "parameters": [
131           {
132             "name": "parameters",
133             "type": "object",
134             "properties": {
135               "contextID": {
136                 "description": "ID of the context where the composition will be cleared",
137                 "type": "integer"
138               }
139             }
140           },
141           {
142             "type": "function",
143             "name": "callback",
144             "optional": true,
145             "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
146             "parameters": [
147               {
148                 "name": "success",
149                 "type": "boolean"
150               }
151             ]
152           }
153         ]
154       },
155       {
156         "name": "commitText",
157         "type": "function",
158         "description": "Commits the provided text to the current input.",
159         "parameters": [
160           {
161             "name": "parameters",
162             "type": "object",
163             "properties": {
164               "contextID": {
165                 "description": "ID of the context where the text will be committed",
166                 "type": "integer"
167               },
168               "text": {
169                 "description": "The text to commit",
170                 "type": "string"
171               }
172             }
173           },
174           {
175             "type": "function",
176             "name": "callback",
177             "optional": true,
178             "description": "Called when the operation completes with a boolean indicating if the text was accepted or not. On failure, chrome.runtime.lastError is set.",
179             "parameters": [
180               {
181                 "name": "success",
182                 "type": "boolean"
183               }
184             ]
185           }
186         ]
187       },
188       {
189         "name": "sendKeyEvents",
190         "type": "function",
191         "description": "Sends the key events.  This function is expected to be used by virtual keyboards.  When key(s) on a virtual keyboard is pressed by a user, this function is used to propagate that event to the system.",
192         "parameters": [
193           {
194             "name": "parameters",
195             "type": "object",
196             "properties": {
197               "contextID": {
198                 "description": "ID of the context where the key events will be sent, or zero to send key events to non-input field.",
199                 "type": "integer"
200               },
201               "keyData": {
202                 "type": "array",
203                 "description": "Data on the key event.",
204                 "items": {
205                   "$ref": "KeyboardEvent"
206                 }
207               }
208             }
209           },
210           {
211             "type": "function",
212             "name": "callback",
213             "optional": true,
214             "description": "Called when the operation completes.",
215             "parameters": []
216           }
217         ]
218       },
219       {
220         "name": "hideInputView",
221         "type": "function",
222         "description": "Hides the input view window, which is popped up automatically by system. If the input view window is already hidden, this function will do nothing.",
223         "parameters": []
224       },
225       {
226         "name": "setCandidateWindowProperties",
227         "type": "function",
228         "description": "Sets the properties of the candidate window. This fails if the extension doesn't own the active IME",
229         "parameters": [
230           {
231             "name": "parameters",
232             "type": "object",
233             "properties": {
234               "engineID": {
235                 "description": "ID of the engine to set properties on.",
236                 "type": "string"
237               },
238               "properties": {
239                 "type": "object",
240                 "properties": {
241                   "visible": {
242                     "type": "boolean",
243                     "optional": true,
244                     "description": "True to show the Candidate window, false to hide it."
245                   },
246                   "cursorVisible": {
247                     "type": "boolean",
248                     "optional": true,
249                     "description": "True to show the cursor, false to hide it."
250                   },
251                   "vertical": {
252                     "type": "boolean",
253                     "optional": true,
254                     "description": "True if the candidate window should be rendered vertical, false to make it horizontal."
255                   },
256                   "pageSize": {
257                     "type": "integer",
258                     "optional": true,
259                     "description": "The number of candidates to display per page."
260                   },
261                   "auxiliaryText": {
262                     "type": "string",
263                     "optional": true,
264                     "description": "Text that is shown at the bottom of the candidate window."
265                   },
266                   "auxiliaryTextVisible": {
267                     "type": "boolean",
268                     "optional": true,
269                     "description": "True to display the auxiliary text, false to hide it."
270                   },
271                   "windowPosition": {
272                     "type": "string",
273                     "description": "Where to display the candidate window. If set to 'cursor', the window follows the cursor. If set to 'composition', the window is locked to the beginning of the composition.",
274                     "enum": ["cursor", "composition"],
275                     "optional": true
276                   }
277                 }
278               }
279             }
280           },
281           {
282             "type": "function",
283             "name": "callback",
284             "optional": true,
285             "description": "Called when the operation completes.",
286             "parameters": [
287               {
288                 "name": "success",
289                 "type": "boolean"
290               }
291             ]
292           }
293         ]
294       },
295       {
296         "name": "setCandidates",
297         "type": "function",
298         "description": "Sets the current candidate list. This fails if this extension doesn't own the active IME",
299         "parameters": [
300           {
301             "name": "parameters",
302             "type": "object",
303             "properties": {
304               "contextID": {
305                 "description": "ID of the context that owns the candidate window.",
306                 "type": "integer"
307               },
308               "candidates": {
309                 "description": "List of candidates to show in the candidate window",
310                 "type": "array",
311                 "items": {
312                   "type": "object",
313                   "properties": {
314                     "candidate": {"type": "string", "description": "The candidate"},
315                     "id": {"type": "integer", "description": "The candidate's id"},
316                     "parentId": {"type": "integer", "optional": true, "description": "The id to add these candidates under"},
317                     "label": {"type": "string", "optional": true, "description": "Short string displayed to next to the candidate, often the shortcut key or index"},
318                     "annotation": {"type": "string", "optional": true, "description": "Additional text describing the candidate"},
319                     "usage": {
320                       "type": "object",
321                       "optional": true,
322                       "description": "The usage or detail description of word.",
323                       "properties": {
324                         "title": { "type": "string", "description": "The title string of details description."},
325                         "body": { "type": "string", "description": "The body string of detail description."}
326                       }
327                     }
328                   }
329                 }
330               }
331             }
332           },
333           {
334             "type": "function",
335             "name": "callback",
336             "optional": true,
337             "description": "Called when the operation completes.",
338             "parameters": [
339               {
340                 "name": "success",
341                 "type": "boolean"
342               }
343             ]
344           }
345         ]
346       },
347       {
348         "name": "setCursorPosition",
349         "type": "function",
350         "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.",
351         "parameters": [
352           {
353             "name": "parameters",
354             "type": "object",
355             "properties": {
356               "contextID": {
357                 "description": "ID of the context that owns the candidate window.",
358                 "type": "integer"
359               },
360               "candidateID": {
361                 "description": "ID of the candidate to select.",
362                 "type": "integer"
363               }
364             }
365           },
366           {
367             "type": "function",
368             "name": "callback",
369             "optional": true,
370             "description": "Called when the operation completes",
371             "parameters": [
372               {
373                 "name": "success",
374                 "type": "boolean"
375               }
376             ]
377           }
378         ]
379       },
380       {
381         "name": "setMenuItems",
382         "type": "function",
383         "description": "Adds the provided menu items to the language menu when this IME is active.",
384         "parameters": [
385           {
386             "name": "parameters",
387             "type": "object",
388             "properties": {
389               "engineID": {
390                 "description": "ID of the engine to use",
391                 "type": "string"
392               },
393               "items": {
394                 "description": "MenuItems to add. They will be added in the order they exist in the array.",
395                 "type": "array",
396                 "items": {
397                   "$ref": "MenuItem"
398                 }
399               }
400             }
401           },
402           {
403             "type": "function",
404             "name": "callback",
405             "optional": true,
406             "description": "",
407             "parameters": []
408           }
409         ]
410       },
411       {
412         "name": "updateMenuItems",
413         "type": "function",
414         "description": "Updates the state of the MenuItems specified",
415         "parameters": [
416           {
417             "name": "parameters",
418             "type": "object",
419             "properties": {
420               "engineID": {
421                 "description": "ID of the engine to use",
422                 "type": "string"
423               },
424               "items": {
425                 "description": "Array of MenuItems to update",
426                 "type": "array",
427                 "items": {
428                   "$ref": "MenuItem"
429                 }
430               }
431             }
432           },
433           {
434             "type": "function",
435             "name": "callback",
436             "optional": true,
437             "description": "Called when the operation completes",
438             "parameters": []
439           }
440         ]
441       },
442       {
443         "name": "deleteSurroundingText",
444         "type": "function",
445         "description": "Deletes the text around the caret.",
446         "parameters": [
447           {
448             "name": "parameters",
449             "type": "object",
450             "properties": {
451               "engineID": {
452                 "type": "string",
453                 "description": "ID of the engine receiving the event."
454               },
455               "contextID": {
456                 "type": "integer",
457                 "description": "ID of the context where the surrounding text will be deleted."
458               },
459               "offset": {
460                 "type": "integer",
461                 "description": "The offset from the caret position where deletion will start. This value can be negative."
462               },
463               "length": {
464                 "type": "integer",
465                 "description": "The number of characters to be deleted",
466                 "minimum": 0
467               }
468             }
469           },
470           {
471             "type": "function",
472             "name": "callback",
473             "optional": true,
474             "description": "Called when the operation completes.",
475             "parameters": []
476           }
477         ]
478       },
479       {
480         "name": "keyEventHandled",
481         "type": "function",
482         "description": "Indicates that the key event received by onKeyEvent is handled.  This should only be called if the onKeyEvent listener is asynchronous.",
483         "parameters": [
484           {"type": "string", "name": "requestId", "description": "Request id of the event that was handled.  This should come from keyEvent.requestId"},
485           {"type": "boolean", "name": "response", "description": "True if the keystroke was handled, false if not"}
486         ]
487       }
488     ],
489     "events": [
490       {
491         "name": "onActivate",
492         "type": "function",
493         "description": "This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events.",
494         "parameters": [
495           {
496             "type": "string",
497             "name": "engineID",
498             "description": "ID of the engine receiving the event"
499           }
500         ]
501       },
502       {
503         "name": "onDeactivated",
504         "type": "function",
505         "description": "This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events.",
506         "parameters": [
507           {
508             "type": "string",
509             "name": "engineID",
510             "description": "ID of the engine receiving the event"
511           }
512         ]
513       },
514       {
515         "name": "onFocus",
516         "type": "function",
517         "description": "This event is sent when focus enters a text box. It is sent to all extensions that are listening to this event, and enabled by the user.",
518         "parameters": [
519           {
520             "$ref": "InputContext",
521             "name": "context",
522             "description": "Describes the text field that has acquired focus."
523           }
524         ]
525       },
526       {
527         "name": "onBlur",
528         "type": "function",
529         "description": "This event is sent when focus leaves a text box. It is sent to all extensions that are listening to this event, and enabled by the user.",
530         "parameters": [
531           {
532             "type": "integer",
533             "name": "contextID",
534             "description": "The ID of the text field that has lost focus. The ID is invalid after this call"
535           }
536         ]
537       },
538       {
539         "name": "onInputContextUpdate",
540         "type": "function",
541         "description": "This event is sent when the properties of the current InputContext change, such as the the type. It is sent to all extensions that are listening to this event, and enabled by the user.",
542         "parameters": [
543           {
544             "$ref": "InputContext",
545             "name": "context",
546             "description": "An InputContext object describing the text field that has changed."
547           }
548         ]
549       },
550       {
551         "name": "onKeyEvent",
552         "type": "function",
553         "description": "This event is sent if this extension owns the active IME.",
554         "options": {
555           "supportsFilters": false,
556           "supportsListeners": true,
557           "supportsRules": false,
558           "maxListeners": 1
559         },
560         "parameters": [
561           {
562             "type": "string",
563             "name": "engineID",
564             "description": "ID of the engine receiving the event"
565           },
566           {
567             "$ref": "KeyboardEvent",
568             "name": "keyData",
569             "description": "Data on the key event"
570           }
571         ],
572         "extraParameters": [
573           {
574             "type": "array",
575             "optional": true,
576             "name": "extraInfoSpec",
577             "description": "Array of extra information that specifies how the callback is invoked.",
578             "items": {
579               "type": "string",
580               "enum": ["async"]
581             }
582           }
583         ],
584         "returns": {
585           "type": "boolean",
586           "description": "True if the keystroke was handled, false if not.  This function should always return a value if |async| is not specified.",
587           "optional": true
588         }
589       },
590       {
591         "name": "onCandidateClicked",
592         "type": "function",
593         "description": "This event is sent if this extension owns the active IME.",
594         "parameters": [
595           {
596             "type": "string",
597             "name": "engineID",
598             "description": "ID of the engine receiving the event"
599           },
600           {
601             "type": "integer",
602             "name": "candidateID",
603             "description": "ID of the candidate that was clicked."
604           },
605           {
606             "type": "string",
607             "name": "button",
608             "description": "Which mouse buttons was clicked.",
609             "enum": ["left", "middle", "right"]
610           }
611         ]
612       },
613       {
614         "name": "onMenuItemActivated",
615         "type": "function",
616         "description": "Called when the user selects a menu item",
617         "parameters": [
618           {
619             "type": "string",
620             "name": "engineID",
621             "description": "ID of the engine receiving the event"
622           },
623           {
624             "type": "string",
625             "name": "name",
626             "description": "Name of the MenuItem which was activated"
627           }
628         ]
629       },
630       {
631         "name": "onSurroundingTextChanged",
632         "type": "function",
633         "description": "Called when the editable string around caret is changed or when the caret position is moved. The text length is limited to 100 characters for each back and forth direction.",
634         "parameters": [
635           {
636             "type": "string",
637             "name": "engineID",
638             "description": "ID of the engine receiving the event"
639           },
640           {
641             "type": "object",
642             "name": "surroundingInfo",
643             "description": "The surrounding information.",
644             "properties": {
645               "text": {
646                 "type": "string",
647                 "description": "The text around cursor."
648               },
649               "focus": {
650                 "type": "integer",
651                 "description": "The ending position of the selection. This value indicates caret position if there is no selection."
652               },
653               "anchor": {
654                 "type": "integer",
655                 "description": "The beginning position of the selection. This value indicates caret position if is no selection."
656               }
657             }
658           }
659         ]
660       },
661       {
662         "name": "onReset",
663         "type": "function",
664         "description": "This event is sent when chrome terminates ongoing text input session.",
665         "parameters": [
666           {
667             "type": "string",
668             "name": "engineID",
669             "description": "ID of the engine receiving the event"
670           }
671         ]
672       }
673     ]
674   }