Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / extensions / common / api / virtual_keyboard_private.json
blob5b335fb2a55205856e4ff5452f19e1a55d10046d
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.
6   {
7     "namespace": "virtualKeyboardPrivate",
8     "compiler_options": {
9       "implemented_in": "extensions/browser/api/virtual_keyboard_private/virtual_keyboard_private_api.h"
10     },
11     "platforms": ["chromeos"],
12     "description": "none",
13     "types": [
14       {
15         "id": "VirtualKeyboardEventType",
16         "type": "string",
17         "description": "One of keyup or keydown.",
18         "enum": ["keyup", "keydown"]
19       },
20       {
21         "id": "VirtualKeyboardEvent",
22         "type": "object",
23         "properties": {
24           "type": {"$ref": "VirtualKeyboardEventType"},
25           "charValue": {"type": "integer", "description": "Unicode value of the key."},
26           "keyCode": {"type": "integer", "description": "Virtual key code, which is independent of the keyboard layout or modifier state."},
27           "keyName": {"type": "string", "description": "Name of the key, which is independent of modifier state."},
28           "modifiers": {"type": "integer", "optional": true, "description": "Flag for modifiers that are active. None = 0, Shift = 2, Control = 4, Alt = 8."}
29         }
30       },
31       {
32         "id": "KeyboardMode",
33         "type": "string",
34         "enum": [ "FULL_WIDTH", "FLOATING" ],
35         "description": "The value of the virtual keyboard mode to set to."
36       },
37       {
38         "id": "KeyboardState",
39         "type": "string",
40         "enum": [ "ENABLED", "DISABLED", "AUTO"],
41         "description": "The value of the virtual keyboard state to change to."
42       },
43       {
44         "id": "OnTextInputBoxFocusedType",
45         "type": "string",
46         "description": "The value of type attribute of the focused text input box.",
47         "enum": ["text", "number", "password", "date", "url", "tel", "email"]
48       },
49       {
50         "id": "Bounds",
51         "type": "object",
52         "properties": {
53           "left": {"type": "integer", "description": "The position of the virtual keyboard window's left edge."},
54           "top": {"type": "integer", "description": "The position of the virtual keyboard window's top edge."},
55           "width": {"type": "integer", "description": "The width of the virtual keyboard window."},
56           "height": {"type": "integer", "description": "The height of the virtual keyboard window."}
57         }
58       }
59     ],
60     "functions": [
61       {
62         "name": "insertText",
63         "type": "function",
64         "description": "Inserts text into the currently focused text field.",
65         "parameters": [
66           { "name": "text",
67             "type": "string",
68             "description": "The text that will be inserted."
69           },
70           { "type": "function",
71             "name": "callback",
72             "optional": true,
73             "description": "Called when the insertion is completed.",
74             "parameters": []
75           }
76         ]
77       },
78       {
79         "name": "sendKeyEvent",
80         "type": "function",
81         "description": "Sends a fabricated key event to the focused input field.",
82         "parameters": [
83           { "name": "keyEvent",
84             "$ref": "VirtualKeyboardEvent",
85             "description": ""
86           },
87           { "name": "callback",
88             "type": "function",
89             "optional": true,
90             "description": "Called after processing the event.",
91             "parameters": []
92           }
93         ]
94       },
95       {
96         "name": "hideKeyboard",
97         "type": "function",
98         "description": "Hides the virtual keyboard.",
99         "parameters": [
100           { "type": "function",
101             "name": "callback",
102             "optional": true,
103             "description": "Called when the keyboard is hidden.",
104             "parameters": []
105           }
106         ]
107       },
108       {
109         "name": "setHotrodKeyboard",
110         "type": "function",
111         "description": "Sets the state of the hotrod virtual keyboard. This API should only be used by hotrod.",
112         "parameters": [
113           {
114             "type": "boolean",
115             "name": "enable"
116           }
117         ]
118       },
119       {
120         "name": "lockKeyboard",
121         "type": "function",
122         "description": "Sets the lock state of the virtual keyboard. A locked keyboard remains visible even after a text area loses input focus.",
123         "parameters": [
124           {
125             "type": "boolean",
126             "name": "lock"
127           }
128         ]
129       },
130       {
131         "name": "keyboardLoaded",
132         "type": "function",
133         "description": "Inform the system that the keyboard has loaded.",
134         "parameters": [
135           { "type": "function",
136             "name": "callback",
137             "optional": true,
138             "description": "Called when load acknowledgement is complete.",
139             "parameters": []
140           }
141         ]
142       },
143       {
144         "name": "getKeyboardConfig",
145         "type": "function",
146         "description": "Gets the virtual keyboard configuration.",
147         "parameters": [
148           {
149             "type": "function",
150             "name": "callback",
151             "optional": true,
152             "description": "Called when querying virtual keyboard configuration is complete.",
153             "parameters": [
154               {
155                 "type": "object",
156                 "name": "config",
157                 "properties": {
158                   "layout": {
159                     "type": "string",
160                     "minLength": 1,
161                     "description": "Virtual keyboard layout string."
162                   },
163                   "a11ymode": {
164                     "type": "boolean",
165                     "description": "True if accessibility virtual keyboard is enabled."
166                   },
167                   "features": {
168                     "type": "array",
169                     "items": { "type": "string" },
170                     "description": "List of experimental feature flags."
171                   }
172                 }
173               }
174             ]
175           }
176         ]
177       },
178       {
179         "name": "openSettings",
180         "type": "function",
181         "description": "Opens chrome://settings/languages page.",
182         "parameters": [
183         ]
184       },
185       {
186         "name": "setMode",
187         "type": "function",
188         "description": "Sets the virtual keyboard mode.",
189         "parameters": [
190           {
191             "$ref": "KeyboardMode",
192             "name": "mode",
193             "description": "The value of the virtual keyboard mode to set to."
194           }
195         ]
196       },
197       {
198         "name": "setKeyboardState",
199         "type": "function",
200         "description": "Requests the virtual keyboard to change state.",
201         "parameters": [
202           {
203             "$ref": "KeyboardState",
204             "name": "state",
205             "description": "The value of the virtual keyboard state to change to."
206           }
207         ]
208       }
210     ],
211     "events": [
212       {
213         "name": "onTextInputBoxFocused",
214         "type": "function",
215         "description": "This event is sent when focus enters a text input box.",
216         "parameters": [
217           {
218             "type": "object",
219             "name": "context",
220             "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.",
221             "properties": {
222               "type": {
223                 "$ref": "OnTextInputBoxFocusedType",
224                 "description": "The value of type attribute of the focused text input box."
225               }
226             }
227           }
228         ]
229       },
230       {
231         "name": "onBoundsChanged",
232         "type": "function",
233         "description": "This event is sent when virtual keyboard bounds changed and overscroll/resize is enabled.",
234         "parameters": [
235           {
236             "name": "bounds",
237             "description": "The virtual keyboard bounds",
238             "$ref": "Bounds"
239           }
240         ]
241       }
242     ]
243   }