• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 * @fileoverview Externs for the braille IME.
7 * @externs
8 */
9
10/**
11 * @const
12 */
13chrome.input = {};
14
15/** @const */
16chrome.input.ime = {};
17
18/**
19 * @constructor
20 */
21function ChromeInputImeOnKeyEventEvent() {}
22
23/**
24 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback
25 * @param {Array.<string>=} opt_extraInfoSpec
26 */
27ChromeInputImeOnKeyEventEvent.prototype.addListener =
28    function(callback, opt_extraInfoSpec) {};
29
30/**
31 * @param {!Object.<string,(string|number)>} parameters An object with
32 *     'contextID' (number) and 'text' (string) keys.
33 * @param {function(boolean): void=} opt_callback Callback function.
34 */
35chrome.input.ime.commitText = function(parameters, opt_callback) {};
36
37/**
38 * @param {!Object.<string,(string|number)>} parameters An object with
39 *     'contextID' (number) and 'text' (string) keys.
40 * @param {function(boolean): void=} opt_callback Callback function.
41 */
42chrome.input.ime.deleteSurroundingText = function(parameters, opt_callback) {};
43
44/**
45 * @param {string} requestId
46 * @param {boolean} response
47 */
48chrome.input.ime.keyEventHandled = function(requestId, response) {};
49
50/**
51 * @param {{engineID: string, items: Array.<chrome.input.ime.MenuItem>}}
52 *     parameters
53 * @param {function()=} opt_callback
54 */
55chrome.input.ime.setMenuItems = function(parameters, opt_callback) {};
56
57/** @type {!ChromeEvent} */
58chrome.input.ime.onActivate;
59
60/** @type {!ChromeEvent} */
61chrome.input.ime.onBlur;
62
63/** @type {!ChromeEvent} */
64chrome.input.ime.onDeactivated;
65
66/** @type {!ChromeEvent} */
67chrome.input.ime.onFocus;
68
69/** @type {!ChromeEvent} */
70chrome.input.ime.onInputContextUpdate;
71
72/** @type {!ChromeInputImeOnKeyEventEvent} */
73chrome.input.ime.onKeyEvent;
74
75/** @type {!ChromeEvent} */
76chrome.input.ime.onMenuItemActivated;
77
78/** @type {!ChromeEvent} */
79chrome.input.ime.onReset;
80
81/**
82 * @const
83 */
84chrome.runtime = {};
85
86/** @type {!Object|undefined} */
87chrome.runtime.lastError = {};
88
89/**
90 * @param {string|!Object.<string>=} opt_extensionIdOrConnectInfo Either the
91 *     extensionId to connect to, in which case connectInfo params can be
92 *     passed in the next optional argument, or the connectInfo params.
93 * @param {!Object.<string>=} opt_connectInfo The connectInfo object,
94 *     if arg1 was the extensionId to connect to.
95 * @return {!Port} New port.
96 */
97chrome.runtime.connect = function(
98    opt_extensionIdOrConnectInfo, opt_connectInfo) {};
99
100/**
101 * @constructor
102 */
103function Port() {}
104
105/** @type {ChromeEvent} */
106Port.prototype.onDisconnect;
107
108/** @type {ChromeEvent} */
109Port.prototype.onMessage;
110
111/**
112 * @param {Object.<string>} obj Message object.
113 */
114Port.prototype.postMessage = function(obj) {};
115
116/**
117 * Note: as of 2012-04-12, this function is no longer documented on
118 * the public web pages, but there are still existing usages.
119 */
120Port.prototype.disconnect = function() {};
121
122/**
123 * @constructor
124 */
125function ChromeEvent() {}
126
127/** @param {Function} callback */
128ChromeEvent.prototype.addListener = function(callback) {};
129
130/**
131 * @constructor
132 */
133function ChromeKeyboardEvent() {}
134
135/** @type {string} */
136ChromeKeyboardEvent.prototype.type;
137
138/** @type {string} */
139ChromeKeyboardEvent.prototype.code;
140
141/** @type {boolean} */
142ChromeKeyboardEvent.prototype.altKey;
143
144/** @type {boolean} */
145ChromeKeyboardEvent.prototype.ctrlKey;
146
147/** @type {boolean} */
148ChromeKeyboardEvent.prototype.shiftKey;
149
150/** @type {boolean} */
151ChromeKeyboardEvent.prototype.capsLock;
152
153/** @type {string} */
154ChromeKeyboardEvent.prototype.requestId;
155
156/**
157 * @constructor
158 */
159function InputContext() {}
160
161/** @type {number} */
162InputContext.prototype.contextID;
163
164/** @type {string} */
165InputContext.prototype.type;
166
167/**
168 * @typedef {{
169 *     id: string,
170 *     label: (string|undefined),
171 *     style: string,
172 *     visible: (boolean|undefined),
173 *     checked: (boolean|undefined),
174 *     enabled: (boolean|undefined)
175 * }}
176 */
177chrome.input.ime.MenuItem;
178
179/**
180 * @type {Object}
181 */
182var localStorage;
183