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 */ 13 chrome.input = {}; 14 15 /** @const */ 16 chrome.input.ime = {}; 17 18 /** 19 * @constructor 20 */ 21 function ChromeInputImeOnKeyEventEvent() {} 22 23 /** 24 * @param {function(string, !ChromeKeyboardEvent): (boolean|undefined)} callback 25 * @param {Array.<string>=} opt_extraInfoSpec 26 */ 27 ChromeInputImeOnKeyEventEvent.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 */ 35 chrome.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 */ 42 chrome.input.ime.deleteSurroundingText = function(parameters, opt_callback) {}; 43 44 /** 45 * @param {string} requestId 46 * @param {boolean} response 47 */ 48 chrome.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 */ 55 chrome.input.ime.setMenuItems = function(parameters, opt_callback) {}; 56 57 /** @type {!ChromeEvent} */ 58 chrome.input.ime.onActivate; 59 60 /** @type {!ChromeEvent} */ 61 chrome.input.ime.onBlur; 62 63 /** @type {!ChromeEvent} */ 64 chrome.input.ime.onDeactivated; 65 66 /** @type {!ChromeEvent} */ 67 chrome.input.ime.onFocus; 68 69 /** @type {!ChromeEvent} */ 70 chrome.input.ime.onInputContextUpdate; 71 72 /** @type {!ChromeInputImeOnKeyEventEvent} */ 73 chrome.input.ime.onKeyEvent; 74 75 /** @type {!ChromeEvent} */ 76 chrome.input.ime.onMenuItemActivated; 77 78 /** @type {!ChromeEvent} */ 79 chrome.input.ime.onReset; 80 81 /** 82 * @const 83 */ 84 chrome.runtime = {}; 85 86 /** @type {!Object|undefined} */ 87 chrome.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 */ 97 chrome.runtime.connect = function( 98 opt_extensionIdOrConnectInfo, opt_connectInfo) {}; 99 100 /** 101 * @constructor 102 */ 103 function Port() {} 104 105 /** @type {ChromeEvent} */ 106 Port.prototype.onDisconnect; 107 108 /** @type {ChromeEvent} */ 109 Port.prototype.onMessage; 110 111 /** 112 * @param {Object.<string>} obj Message object. 113 */ 114 Port.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 */ 120 Port.prototype.disconnect = function() {}; 121 122 /** 123 * @constructor 124 */ 125 function ChromeEvent() {} 126 127 /** @param {Function} callback */ 128 ChromeEvent.prototype.addListener = function(callback) {}; 129 130 /** 131 * @constructor 132 */ 133 function ChromeKeyboardEvent() {} 134 135 /** @type {string} */ 136 ChromeKeyboardEvent.prototype.type; 137 138 /** @type {string} */ 139 ChromeKeyboardEvent.prototype.code; 140 141 /** @type {boolean} */ 142 ChromeKeyboardEvent.prototype.altKey; 143 144 /** @type {boolean} */ 145 ChromeKeyboardEvent.prototype.ctrlKey; 146 147 /** @type {boolean} */ 148 ChromeKeyboardEvent.prototype.shiftKey; 149 150 /** @type {boolean} */ 151 ChromeKeyboardEvent.prototype.capsLock; 152 153 /** @type {string} */ 154 ChromeKeyboardEvent.prototype.requestId; 155 156 /** 157 * @constructor 158 */ 159 function InputContext() {} 160 161 /** @type {number} */ 162 InputContext.prototype.contextID; 163 164 /** @type {string} */ 165 InputContext.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 */ 177 chrome.input.ime.MenuItem; 178 179 /** 180 * @type {Object} 181 */ 182 var localStorage; 183