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.
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"],
12 "id": "KeyboardEvent",
14 "description": "See http://www.w3.org/TR/DOM-Level-3-Events/#events-KeyboardEvent",
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."}
30 "description": "Describes an input Context",
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"]}
39 "description": "A menu item used by an input method to interact with the user from the language menu.",
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."},
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"]
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."}
57 "name": "setComposition",
59 "description": "Set the current composition. If this extension does not own the active IME, this fails.",
66 "description": "ID of the context where the composition text will be set",
70 "description": "Text to set",
74 "description": "Position in the text that the selection starts at.",
79 "description": "Position in the text that the selection ends at.",
84 "description": "Position in the text of the cursor.",
88 "description": "List of segments and their associated types.",
95 "description": "Index of the character to start this segment at",
99 "description": "Index of the character to end this segment after.",
103 "description": "How to render this segment",
104 "enum": ["underline", "doubleUnderline"],
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.",
127 "name": "clearComposition",
129 "description": "Clear the current composition. If this extension does not own the active IME, this fails.",
132 "name": "parameters",
136 "description": "ID of the context where the composition will be cleared",
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.",
156 "name": "commitText",
158 "description": "Commits the provided text to the current input.",
161 "name": "parameters",
165 "description": "ID of the context where the text will be committed",
169 "description": "The text to commit",
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.",
189 "name": "sendKeyEvents",
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.",
194 "name": "parameters",
198 "description": "ID of the context where the key events will be sent, or zero to send key events to non-input field.",
203 "description": "Data on the key event.",
205 "$ref": "KeyboardEvent"
214 "description": "Called when the operation completes.",
220 "name": "hideInputView",
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.",
226 "name": "setCandidateWindowProperties",
228 "description": "Sets the properties of the candidate window. This fails if the extension doesn't own the active IME",
231 "name": "parameters",
235 "description": "ID of the engine to set properties on.",
244 "description": "True to show the Candidate window, false to hide it."
249 "description": "True to show the cursor, false to hide it."
254 "description": "True if the candidate window should be rendered vertical, false to make it horizontal."
259 "description": "The number of candidates to display per page."
264 "description": "Text that is shown at the bottom of the candidate window."
266 "auxiliaryTextVisible": {
269 "description": "True to display the auxiliary text, false to hide it."
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"],
285 "description": "Called when the operation completes.",
296 "name": "setCandidates",
298 "description": "Sets the current candidate list. This fails if this extension doesn't own the active IME",
301 "name": "parameters",
305 "description": "ID of the context that owns the candidate window.",
309 "description": "List of candidates to show in the candidate window",
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"},
322 "description": "The usage or detail description of word.",
324 "title": { "type": "string", "description": "The title string of details description."},
325 "body": { "type": "string", "description": "The body string of detail description."}
337 "description": "Called when the operation completes.",
348 "name": "setCursorPosition",
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.",
353 "name": "parameters",
357 "description": "ID of the context that owns the candidate window.",
361 "description": "ID of the candidate to select.",
370 "description": "Called when the operation completes",
381 "name": "setMenuItems",
383 "description": "Adds the provided menu items to the language menu when this IME is active.",
386 "name": "parameters",
390 "description": "ID of the engine to use",
394 "description": "MenuItems to add. They will be added in the order they exist in the array.",
412 "name": "updateMenuItems",
414 "description": "Updates the state of the MenuItems specified",
417 "name": "parameters",
421 "description": "ID of the engine to use",
425 "description": "Array of MenuItems to update",
437 "description": "Called when the operation completes",
443 "name": "deleteSurroundingText",
445 "description": "Deletes the text around the caret.",
448 "name": "parameters",
453 "description": "ID of the engine receiving the event."
457 "description": "ID of the context where the surrounding text will be deleted."
461 "description": "The offset from the caret position where deletion will start. This value can be negative."
465 "description": "The number of characters to be deleted",
474 "description": "Called when the operation completes.",
480 "name": "keyEventHandled",
482 "description": "Indicates that the key event received by onKeyEvent is handled. This should only be called if the onKeyEvent listener is asynchronous.",
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"}
491 "name": "onActivate",
493 "description": "This event is sent when an IME is activated. It signals that the IME will be receiving onKeyPress events.",
498 "description": "ID of the engine receiving the event"
503 "name": "onDeactivated",
505 "description": "This event is sent when an IME is deactivated. It signals that the IME will no longer be receiving onKeyPress events.",
510 "description": "ID of the engine receiving the event"
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.",
520 "$ref": "InputContext",
522 "description": "Describes the text field that has acquired focus."
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.",
534 "description": "The ID of the text field that has lost focus. The ID is invalid after this call"
539 "name": "onInputContextUpdate",
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.",
544 "$ref": "InputContext",
546 "description": "An InputContext object describing the text field that has changed."
551 "name": "onKeyEvent",
553 "description": "This event is sent if this extension owns the active IME.",
555 "supportsFilters": false,
556 "supportsListeners": true,
557 "supportsRules": false,
564 "description": "ID of the engine receiving the event"
567 "$ref": "KeyboardEvent",
569 "description": "Data on the key event"
576 "name": "extraInfoSpec",
577 "description": "Array of extra information that specifies how the callback is invoked.",
586 "description": "True if the keystroke was handled, false if not. This function should always return a value if |async| is not specified.",
591 "name": "onCandidateClicked",
593 "description": "This event is sent if this extension owns the active IME.",
598 "description": "ID of the engine receiving the event"
602 "name": "candidateID",
603 "description": "ID of the candidate that was clicked."
608 "description": "Which mouse buttons was clicked.",
609 "enum": ["left", "middle", "right"]
614 "name": "onMenuItemActivated",
616 "description": "Called when the user selects a menu item",
621 "description": "ID of the engine receiving the event"
626 "description": "Name of the MenuItem which was activated"
631 "name": "onSurroundingTextChanged",
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.",
638 "description": "ID of the engine receiving the event"
642 "name": "surroundingInfo",
643 "description": "The surrounding information.",
647 "description": "The text around cursor."
651 "description": "The ending position of the selection. This value indicates caret position if there is no selection."
655 "description": "The beginning position of the selection. This value indicates caret position if is no selection."
664 "description": "This event is sent when chrome terminates ongoing text input session.",
669 "description": "ID of the engine receiving the event"