1// Copyright 2013 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": "virtualKeyboardPrivate",
8    "compiler_options": {
9      "implemented_in": "chrome/browser/extensions/api/input/input.h"
10    },
11    "platforms": ["chromeos"],
12    "description": "none",
13    "types": [
14      {
15        "id": "VirtualKeyboardEvent",
16        "type": "object",
17        "properties": {
18          "type": {"type": "string", "description": "One of keyup or keydown.", "enum": ["keyup", "keydown"]},
19          "charValue": {"type": "integer", "description": "Unicode value of the key."},
20          "keyCode": {"type": "integer", "description": "Virtual key code, which is independent of the keyboard layout or modifier state."},
21          "keyName": {"type": "string", "description": "Name of the key, which is independent of modifier state."},
22          "modifiers": {"type": "integer", "optional": true, "description": "Flag for modifiers that are active. None = 0, Shift = 2, Control = 4, Alt = 8."}
23        }
24      }
25    ],
26    "functions": [
27      {
28        "name": "insertText",
29        "type": "function",
30        "description": "Inserts text into the currently focused text field.",
31        "parameters": [
32          { "name": "text",
33            "type": "string",
34            "description": "The text that will be inserted."
35          },
36          { "type": "function",
37            "name": "callback",
38            "optional": true,
39            "description": "Called when the insertion is completed.",
40            "parameters": []
41          }
42        ]
43      },
44      {
45        "name": "moveCursor",
46        "type": "function",
47        "description": "Move cursor on the current focused textfield by swipe.",
48        "parameters": [
49          { "name": "swipe_direction",
50            "type": "integer",
51            "discription": "The direction of the cursor movement."
52          },
53          { "name": "modifier_flags",
54            "type": "integer",
55            "description": "Bitmask representing the state of the system modifier keys."
56          },
57          { "type": "function",
58            "name": "callback",
59            "optional": true,
60            "decription": "called when the swipe movement is completed.",
61            "parameters": []
62          }
63        ]
64      },
65      {
66        "name": "sendKeyEvent",
67        "type": "function",
68        "description": "Sends a fabricated key event to the focused input field.",
69        "parameters": [
70          { "name": "keyEvent",
71            "$ref": "VirtualKeyboardEvent",
72            "description": ""
73          },
74          { "name": "callback",
75            "type": "function",
76            "optional": true,
77            "description": "Called after processing the event.",
78            "parameters": []
79          }
80        ]
81      },
82      {
83        "name": "hideKeyboard",
84        "type": "function",
85        "description": "Hides the virtual keyboard.",
86        "parameters": [
87          { "type": "function",
88            "name": "callback",
89            "optional": true,
90            "description": "Called when the keyboard is hidden.",
91            "parameters": []
92          }
93        ]
94      },
95      {
96        "name": "lockKeyboard",
97        "type": "function",
98        "description": "Sets the lock state of the virtual keyboard. A locked keyboard remains visible even after a text area loses input focus.",
99        "parameters": [
100          {
101            "type": "boolean",
102            "name": "lock"
103          }
104        ]
105      },
106      {
107        "name": "keyboardLoaded",
108        "type": "function",
109        "description": "Inform the system that the keyboard has loaded.",
110        "parameters": [
111          { "type": "function",
112            "name": "callback",
113            "optional": true,
114            "description": "Called when load acknowledgement is complete.",
115            "parameters": []
116          }
117        ]
118      },
119      {
120        "name": "getKeyboardConfig",
121        "type": "function",
122        "description": "Gets the virtual keyboard configuration.",
123        "parameters": [
124          {
125            "type": "function",
126            "name": "callback",
127            "optional": true,
128            "description": "Called when querying virtual keyboard configuration is complete.",
129            "parameters": [
130              {
131                "type": "object",
132                "name": "config",
133                "properties": {
134                  "layout": {
135                    "type": "string",
136                    "minLength": 1,
137                    "description": "Virtual keyboard layout string."
138                  },
139                  "a11ymode": {
140                    "type": "boolean",
141                    "description": "True if accessbility virtual keyboard is enabled."
142                  },
143                  "experimental": {
144                    "type": "boolean",
145                    "description": "True if experimental features are enabled."
146                  }
147                }
148              }
149            ]
150          }
151        ]
152      },
153      {
154        "name": "openSettings",
155        "type": "function",
156        "description": "Opens chrome://settings/languages page.",
157        "parameters": [
158        ]
159      }
160    ],
161    "events": [
162      {
163        "name": "onTextInputBoxFocused",
164        "type": "function",
165        "description": "This event is sent when focus enters a text input box.",
166        "parameters": [
167          {
168            "type": "object",
169            "name": "context",
170            "description": "Describes the text input box that has acquired focus. Note only the type of text input box is passed. This API is intended to be used by non-ime virtual keyboard only. Normal ime virtual keyboard should use chrome.input.ime.onFocus to get the more detailed InputContext.",
171            "properties": {
172              "type": {
173                "type": "string",
174                "description": "The value of type attribute of the focused text input box.",
175                "enum": ["text", "number", "password", "date", "url", "tel", "email"]
176              }
177            }
178          }
179        ]
180      }
181    ]
182  }
183]
184