1// Copyright 2014 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": "accessibilityPrivate",
8    "compiler_options": {
9      "implemented_in": "chrome/browser/accessibility/accessibility_extension_api.h"
10    },
11    "description": "none",
12    "types": [
13      {
14        "id": "AlertInfo",
15        "type": "object",
16        "description": "Information about an alert",
17        "properties": {
18          "message": {
19            "type": "string",
20            "description": "The message the alert is showing."
21          }
22        }
23      },
24      {
25        "id": "ScreenRect",
26        "type": "object",
27        "description": "Bounding rectangle in global screen coordinates.",
28        "properties": {
29          "left": {"type": "integer", "description": "Left coordinate in global screen coordinates."},
30          "top": {"type": "integer", "description": "Top coordinate in global screen coordinates."},
31          "width": {"type": "integer", "description": "Width in pixels."},
32          "height": {"type": "integer", "description": "Height in pixels."}
33        }
34      },
35      {
36        "id": "Gesture",
37        "type": "string",
38        "enum": [ "click", "swipeLeft1", "swipeUp1", "swipeRight1", "swipeDown1", "swipeLeft2", "swipeUp2", "swipeRight2", "swipeDown2", "swipeLeft3", "swipeUp3", "swipeRight3", "swipeDown3", "swipeLeft4", "swipeUp4", "swipeRight4", "swipeDown4", "tap2", "tap3", "tap4", "touchExplore" ],
39        "description": "Accessibility gestures fired by the touch exploration controller."
40      },
41      {
42        "id": "SwitchAccessCommand",
43        "type": "string",
44        "enum": [ "select", "next", "previous" ],
45        "description": "Commands that can be triggered by switch activation."
46      },
47      {
48        "id": "SwitchAccessBubble",
49        "type": "string",
50        "enum": [ "backButton", "menu" ],
51        "description": "Different Switch Access bubbles that can be shown or hidden."
52      },
53      {
54        "id": "PointScanPoint",
55        "type": "object",
56        "properties": {
57          "x": {
58            "type": "number",
59            "description": "X coordinate of the selected point in DIPs."
60          },
61          "y": {
62            "type": "number",
63            "description": "Y coordinate of the selected point in DIPs."
64          }
65        }
66      },
67      {
68        "id": "SwitchAccessMenuAction",
69        "type": "string",
70        "enum": [ "copy", "cut", "decrement", "dictation", "endTextSelection", "increment", "jumpToBeginningOfText", "jumpToEndOfText", "keyboard", "moveBackwardOneCharOfText", "moveBackwardOneWordOfText", "moveCursor", "moveDownOneLineOfText", "moveForwardOneCharOfText", "moveForwardOneWordOfText", "moveUpOneLineOfText", "paste", "pointScan", "scrollDown", "scrollLeft", "scrollRight", "scrollUp", "select", "settings", "startTextSelection" ],
71        "description": "Available actions to be shown in the Switch Access menu. Must be kept in sync with the strings in ash/system/accessibility/switch_access_menu_view.cc"
72      },
73      {
74        "id": "SyntheticKeyboardEventType",
75        "type": "string",
76        "description": "The event to send",
77        "enum": ["keyup", "keydown"]
78      },
79      {
80        "id": "SyntheticKeyboardModifiers",
81        "type": "object",
82        "properties": {
83          "ctrl": {
84            "type": "boolean",
85            "description": "Control modifier.",
86            "optional": true
87          },
88          "alt": {
89            "type": "boolean",
90            "description": "alt modifier.",
91            "optional": true
92          },
93          "search": {
94            "type": "boolean",
95            "description": "search modifier.",
96            "optional": true
97          },
98          "shift": {
99            "type": "boolean",
100            "description": "shift modifier.",
101            "optional": true
102          }
103        }
104      },
105      {
106        "id": "SyntheticKeyboardEvent",
107        "type": "object",
108        "properties": {
109          "type": {"$ref": "SyntheticKeyboardEventType"},
110          "keyCode": {"type": "integer", "description": "Virtual key code, which is independent of the keyboard layout or modifier state."},
111          "modifiers": {
112            "$ref": "SyntheticKeyboardModifiers",
113            "optional": true,
114            "description": "Contains all active modifiers."
115          }
116        }
117      },
118      {
119        "id": "SyntheticMouseEventType",
120        "type": "string",
121        "description": "The type of event to send",
122        "enum": ["press", "release", "drag", "move", "enter", "exit"]
123      },
124      {
125        "id": "SyntheticMouseEventButton",
126        "type": "string",
127        "description": "The button to send event on",
128        "enum": ["left", "middle", "right", "back", "foward"]
129      },
130      {
131        "id": "SyntheticMouseEvent",
132        "type": "object",
133        "properties": {
134          "type": {"$ref": "SyntheticMouseEventType"},
135          "x": {"type": "integer", "description": "X coordinate for mouse event in global screen coordinates"},
136          "y": {"type": "integer", "description": "Y coordinate for mouse event in global screen coordinates"},
137          "touchAccessibility": {
138            "type": "boolean",
139            "description": "True if the touch accessibility flag should be set.",
140            "optional": true
141          },
142          "mouseButton": {
143            "$ref": "SyntheticMouseEventButton",
144            "description": "The default mouse button is set to left if mouseButton is not specified.",
145            "optional": true
146          }
147        }
148      },
149      {
150        "id": "SelectToSpeakState",
151        "type": "string",
152        "description": "The state of the Select-to-Speak extension",
153        "enum": ["selecting", "speaking", "inactive"]
154      },
155      {
156        "id": "FocusType",
157        "type": "string",
158        "description": "The type of visual appearance for the focus ring.",
159        "enum": ["glow", "solid", "dashed"]
160      },
161      {
162        "id": "FocusRingInfo",
163        "type": "object",
164        "properties": {
165          "rects": {
166            "type": "array",
167            "items": { "$ref": "ScreenRect" },
168            "description": "Array of rectangles to draw the accessibility focus ring around."
169          },
170          "type": {
171            "$ref": "FocusType",
172            "description": "The FocusType for the ring."
173          },
174          "color": {
175            "type": "string",
176            "description": "A RGB hex-value color string (e.g. #3F8213) that describes the primary color of the focus ring."
177          },
178          "secondaryColor": {
179            "type": "string",
180            "description": "A RGB hex-value color string (e.g. #3F82E4) that describes the secondary color of the focus ring, if there is one.",
181            "optional": true
182          },
183          "backgroundColor": {
184            "type": "string",
185            "description": "A RGB hex-value color string (e.g. #803F82E4) that describes the color drawn outside of the focus ring and over the rest of the display.",
186            "optional": true
187          },
188          "id": {
189            "type": "string",
190            "description": "An identifier for this focus ring, unique within the extension.",
191            "optional": true
192          }
193        }
194      },
195      {
196        "id": "AcceleratorAction",
197        "type": "string",
198        "enum": [ "focusPreviousPane", "focusNextPane" ],
199        "description": "A subset of accelerator actions used by accessibility."
200      },
201      {
202        "id": "AccessibilityFeature",
203        "type": "string",
204        "enum": [ "selectToSpeakNavigationControl" ],
205        "description": "Subset of accessibility features."
206      }
207    ],
208    "functions": [
209      {
210        "name": "getDisplayNameForLocale",
211        "type": "function",
212        "nocompile": true,
213        "description": "Called to translate localeCodeToTranslate into human-readable string in the locale specified by displayLocaleCode",
214        "parameters": [
215          {
216            "name": "localeCodeToTranslate",
217            "type": "string"
218          },
219          {
220            "name": "displayLocaleCode",
221            "type": "string"
222          }
223        ],
224        "returns": {
225          "type": "string",
226          "description": "The human-readable locale string in the provided locale."
227        },
228        "platforms": ["chromeos"]
229      },
230      {
231        "name": "getBatteryDescription",
232        "type": "function",
233        "description": "Called to request battery status from Chrome OS system.",
234        "parameters": [
235          {
236            "name": "callback",
237            "type": "function",
238            "description": "Returns battery description as a string.",
239            "parameters": [
240              {
241                "name": "batteryDescription",
242                "type": "string"
243              }
244            ]
245          }
246        ],
247        "platforms": ["chromeos"]
248      },
249      {
250        "name": "setNativeAccessibilityEnabled",
251        "type": "function",
252        "description": "Enables or disables native accessibility support. Once disabled, it is up to the calling extension to provide accessibility for web contents.",
253        "parameters": [
254          {
255            "type": "boolean",
256            "name": "enabled",
257            "description": "True if native accessibility support should be enabled."
258          }
259        ]
260      },
261      {
262        "name": "setFocusRings",
263        "type": "function",
264        "description": "Sets the given accessibility focus rings for this extension.",
265        "parameters": [
266          {
267            "name": "focusRings",
268            "type": "array",
269            "items": { "$ref": "FocusRingInfo" },
270            "description": "Array of focus rings to draw."
271          }
272        ]
273      },
274      {
275        "name": "setHighlights",
276        "type": "function",
277        "description": "Sets the bounds of the accessibility highlight.",
278        "parameters": [
279          {
280            "name": "rects",
281            "type": "array",
282            "items": { "$ref": "ScreenRect" },
283            "description": "Array of rectangles to draw the highlight around."
284          },
285          {
286            "name": "color",
287            "type": "string",
288            "description": "CSS-style hex color string beginning with # like #FF9982 or #EEE."
289          }
290        ]
291      },
292      {
293        "name": "setKeyboardListener",
294        "type": "function",
295        "description": "Sets the calling extension as a listener of all keyboard events optionally allowing the calling extension to capture/swallow the key event via DOM apis. Returns false via callback when unable to set the listener.",
296        "parameters": [
297          {
298            "type": "boolean",
299            "name": "enabled",
300            "description": "True if the caller wants to listen to key events; false to stop listening to events. Note that there is only ever one extension listening to key events."
301          },
302          {
303            "type": "boolean",
304
305            "name": "capture",
306            "description": "True if key events should be swallowed natively and not propagated if preventDefault() gets called by the extension's background page."
307          }
308        ]
309      },
310      {
311        "name": "darkenScreen",
312        "type": "function",
313        "description": "Darkens or undarkens the screen.",
314        "parameters": [
315          {
316            "type": "boolean",
317            "name": "enabled",
318            "description": "True to darken screen; false to undarken screen."
319          }
320        ]
321      },
322      {
323        "name": "forwardKeyEventsToSwitchAccess",
324        "type": "function",
325        "description": "When enabled, forwards key events to the Switch Access extension",
326        "parameters": [
327          {
328            "name": "shouldForward",
329            "type": "boolean"
330          }
331        ],
332        "platforms": ["chromeos"]
333      },
334      {
335        "name": "updateSwitchAccessBubble",
336        "type": "function",
337        "description": "Shows the Switch Access menu next to the specified rectangle and with the given actions",
338        "parameters": [
339          {
340            "name": "bubble",
341            "$ref": "SwitchAccessBubble",
342            "description": "Which bubble to show/hide"
343          },
344          {
345            "name": "show",
346            "type": "boolean",
347            "description": "True if the bubble should be shown, false otherwise"
348          },
349          {
350            "name": "anchor",
351            "$ref": "ScreenRect",
352            "description": "A rectangle indicating the bounds of the object the menu should be displayed next to.",
353            "optional": true
354          },
355          {
356            "name": "actions",
357            "type": "array",
358            "items": { "$ref": "SwitchAccessMenuAction" },
359            "description": "The actions to be shown in the menu.",
360            "optional": true
361          }
362        ],
363        "platforms": ["chromeos"]
364      },
365      {
366        "name": "activatePointScan",
367        "type": "function",
368        "description": "Activates point scanning in Switch Access.",
369        "parameters": [],
370        "platforms": ["chromeos"]
371      },
372      {
373        "name": "setNativeChromeVoxArcSupportForCurrentApp",
374        "type": "function",
375        "description": "Sets current ARC app to use native ARC support.",
376        "parameters": [
377          {
378            "name": "enabled",
379            "type": "boolean",
380            "description": "True for ChromeVox (native), false for TalkBack."
381          }
382        ],
383        "platforms": ["chromeos"]
384      },
385      {
386        "name": "sendSyntheticKeyEvent",
387        "type": "function",
388        "description": "Sends a fabricated key event.",
389        "parameters": [
390          {
391            "name": "keyEvent",
392            "$ref": "SyntheticKeyboardEvent",
393            "description": "The event to send."
394          }
395        ],
396        "platforms": ["chromeos"]
397      },
398      {
399        "name": "enableChromeVoxMouseEvents",
400        "type": "function",
401        "description": "Enables or disables mouse events in ChromeVox.",
402        "parameters": [
403          {
404            "name": "enabled",
405            "type": "boolean",
406            "description": "True if ChromeVox should receive mouse events."
407          }
408        ],
409        "platforms": ["chromeos"]
410      },
411      {
412        "name": "sendSyntheticMouseEvent",
413        "type": "function",
414        "description": "Sends a fabricated mouse event.",
415        "parameters": [
416          {
417            "name": "mouseEvent",
418            "$ref": "SyntheticMouseEvent",
419            "description": "The event to send."
420          }
421        ],
422        "platforms": ["chromeos"]
423      },
424      {
425        "name": "setSelectToSpeakState",
426        "type": "function",
427        "description": "Called by the Select-to-Speak extension when Select-to-Speak has changed states, between selecting with the mouse, speaking, and inactive.",
428        "parameters": [
429          {
430            "name": "state",
431            "$ref": "SelectToSpeakState"
432          }
433        ],
434        "platforms": ["chromeos"]
435      },
436      {
437        "name": "handleScrollableBoundsForPointFound",
438        "type": "function",
439        "description": "Called by the Accessibility Common extension when onScrollableBoundsForPointRequested has found a scrolling container. |rect| will be the bounds of the nearest scrollable ancestor of the node at the point requested using onScrollableBoundsForPointRequested.",
440        "parameters": [
441          {
442            "name": "rect",
443            "$ref": "ScreenRect"
444          }
445        ],
446        "platforms": ["chromeos"]
447      },
448      {
449        "name": "moveMagnifierToRect",
450        "type": "function",
451        "description": "Called by the Accessibility Common extension to move |rect| within the magnifier viewport (e.g. when focus has changed). If |rect| is already completely within the viewport, magnifier doesn't move. If any edge of |rect| is outside the viewport (e.g. if rect is larger than or extends partially beyond the viewport), magnifier will center the overflowing dimensions of the viewport on center of |rect| (e.g. center viewport vertically if |rect| extends beyond bottom of screen).",
452        "parameters": [
453          {
454            "name": "rect",
455            "$ref": "ScreenRect",
456            "description": "Rect to ensure visible in the magnified viewport."
457          }
458        ],
459        "platforms": ["chromeos"]
460      },
461      {
462        "name": "toggleDictation",
463        "type": "function",
464        "description": "Toggles dictation between active and inactive states.",
465        "parameters": [],
466        "platforms": ["chromeos"]
467      },
468      {
469        "name": "setVirtualKeyboardVisible",
470        "type": "function",
471        "description": "Shows or hides the virtual keyboard.",
472        "parameters": [
473          {
474            "name": "isVisible",
475            "type": "boolean"
476          }
477        ],
478        "platforms": ["chromeos"]
479      },
480      {
481        "name": "openSettingsSubpage",
482        "type": "function",
483        "description": "Opens a specified settings subpage. To open a page with url chrome://settings/manageAccessibility/tts, pass in the substring 'manageAccessibility/tts'.",
484        "parameters": [
485          {
486            "name": "subpage",
487            "type": "string"
488          }
489        ],
490        "platforms": ["chromeos"]
491      },
492      {
493        "name": "performAcceleratorAction",
494        "type": "function",
495        "description": "Performs an accelerator action.",
496        "parameters": [
497          {
498            "name": "acceleratorAction",
499            "$ref": "AcceleratorAction"
500          }
501        ],
502        "platforms": ["chromeos"]
503      },
504      {
505        "name": "isFeatureEnabled",
506        "type": "function",
507        "description": "Checks to see if an accessibility feature is enabled.",
508        "parameters": [
509          {
510            "name": "feature",
511            "$ref": "AccessibilityFeature"
512          },
513          {
514            "name": "callback",
515            "type": "function",
516            "description": "Returns whether feature is enabled.",
517            "parameters": [
518              {
519                "name": "featureEnabled",
520                "type": "boolean"
521              }
522            ]
523          }
524        ],
525        "platforms": ["chromeos"]
526      },
527      {
528        "name": "updateSelectToSpeakPanel",
529        "type": "function",
530        "description": "Updates properties of the Select-to-speak panel.",
531        "parameters": [
532          {
533            "name": "show",
534            "type": "boolean",
535            "description": "True to show panel, false to hide it"
536          },
537          {
538            "name": "anchor",
539            "$ref": "ScreenRect",
540            "description": "A rectangle indicating the bounds of the object the panel should be displayed next to.",
541            "optional": true
542          },
543          {
544            "name": "isPaused",
545            "type": "boolean",
546            "description": "True if Select-to-speak playback is paused.",
547            "optional": true
548          }
549        ],
550        "platforms": ["chromeos"]
551      }
552    ],
553    "events": [
554      {
555        "name": "onIntroduceChromeVox",
556        "type": "function",
557        "description": "Fired whenever ChromeVox should output introduction."
558      },
559      {
560        "name": "onAccessibilityGesture",
561        "type": "function",
562        "description": "Fired when an accessibility gesture is detected by the touch exploration controller.",
563        "parameters": [
564          {
565            "name": "gesture",
566            "$ref": "Gesture"
567          },
568          {
569            "name": "x",
570            "type": "integer"
571          },
572          {
573            "name": "y",
574            "type": "integer"
575          }
576        ]
577      },
578      {
579        "name": "onTwoFingerTouchStart",
580        "type": "function",
581        "description": "Fired when we first detect two fingers are held down, which can be used to toggle spoken feedback on some touch-only devices.",
582        "parameters": []
583      },
584      {
585        "name": "onTwoFingerTouchStop",
586        "type": "function",
587        "description": "Fired when the user is no longer holding down two fingers (including releasing one, holding down three, or moving them).",
588        "parameters": []
589      },
590      {
591        "name": "onSelectToSpeakStateChangeRequested",
592        "type": "function",
593        "description": "Fired when Chrome OS wants to change the Select-to-Speak state, between selecting with the mouse, speaking, and inactive.",
594        "parameters": [],
595        "platforms": ["chromeos"]
596      },
597      {
598        "name": "onSwitchAccessCommand",
599        "type": "function",
600        "description": "Fired when Chrome OS has received a key event corresponding to a Switch Access command.",
601        "parameters": [
602          {
603            "name": "command",
604            "$ref": "SwitchAccessCommand"
605          }
606        ],
607        "platforms": ["chromeos"]
608      },
609      {
610        "name": "onPointScanSet",
611        "type": "function",
612        "description": "Fired when Chrome OS has received the final point of point scanning.",
613        "parameters": [
614          {
615            "name": "point",
616            "$ref": "PointScanPoint"
617          }
618        ],
619        "platforms": ["chromeos"]
620      },
621      {
622        "name": "onAnnounceForAccessibility",
623        "type": "function",
624        "description": "Fired when an internal component within accessibility wants to force speech output for an accessibility extension. Do not use without approval from accessibility owners.",
625        "parameters": [
626          {
627            "name": "announceText",
628            "type": "array",
629            "items": { "type": "string" },
630            "description": "Text to be announced."
631          }
632        ],
633        "platforms": ["chromeos"]
634      },
635      {
636        "name": "onScrollableBoundsForPointRequested",
637        "type": "function",
638        "description": "Fired when an internal component within accessibility wants to find the nearest scrolling container at a given screen coordinate. Used in Automatic Clicks.",
639        "parameters": [
640          {
641            "name": "x",
642            "type": "number",
643            "description": "X screen coordinate of the point."
644          },
645          {
646            "name": "y",
647            "type": "number",
648            "description": "Y screen coordinate of the point."
649          }
650        ],
651        "platforms": ["chromeos"]
652      },
653      {
654        "name": "onMagnifierBoundsChanged",
655        "type": "function",
656        "description": "Fired when Chrome OS magnifier bounds are updated.",
657        "parameters": [
658          {
659            "name": "magnifierBounds",
660            "$ref": "ScreenRect",
661            "description": "Updated bounds of magnifier viewport."
662          }
663        ],
664        "platforms": ["chromeos"]
665      },
666      {
667        "name": "onCustomSpokenFeedbackToggled",
668        "type": "function",
669        "description": "Fired when a custom spoken feedback on the active window gets enabled or disabled. Called from ARC++ accessibility.",
670        "parameters": [
671          {
672            "name": "enabled",
673            "type": "boolean",
674            "description": "True if the active window implements custom spoken feedback features."
675          }
676        ],
677        "platforms": ["chromeos"]
678      }
679    ]
680  }
681]
682