1 // Copyright (c) 2012 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.
5 // This file contains various hacks needed to inform JSCompiler of various
6 // WebKit- and Chrome-specific properties and methods. It is used only with
7 // JSCompiler to verify the type-correctness of our code.
17 chrome.app.runtime = {
18 /** @type {chrome.Event} */
26 * @param {string} name
27 * @param {Object} parameters
28 * @param {function()=} opt_callback
30 create: function(name, parameters, opt_callback) {},
34 current: function() {}
45 /** @return {{version: string, app: {background: Object}}} */
46 getManifest: function() {}
50 * @type {?function(string):chrome.extension.Port}
52 chrome.runtime.connectNative = function(name) {};
55 * @param {string} extensionId
57 * @param {Object=} opt_options
58 * @param {function(*)=} opt_callback
60 chrome.runtime.sendMessage = function(
61 extensionId, message, opt_options, opt_callback) {};
64 chrome.extension = {};
67 chrome.extension.Port = function() {};
69 /** @type {chrome.Event} */
70 chrome.extension.Port.prototype.onMessage;
72 /** @type {chrome.Event} */
73 chrome.extension.Port.prototype.onDisconnect;
76 * @param {Object} message
78 chrome.extension.Port.prototype.postMessage = function(message) {};
83 chrome.extension.sendMessage = function(message) {}
85 /** @type {chrome.Event} */
86 chrome.extension.onMessage;
93 * @param {string} messageName
94 * @param {(string|Array.<string>)=} opt_args
97 chrome.i18n.getMessage = function(messageName, opt_args) {};
100 /** @type {Object} */
103 /** @type {chrome.Storage} */
104 chrome.storage.local;
106 /** @type {chrome.Storage} */
110 chrome.Storage = function() {};
113 * @param {string|Array.<string>|Object.<string>} items
114 * @param {function(Object.<string>):void} callback
117 chrome.Storage.prototype.get = function(items, callback) {};
120 * @param {Object.<string>} items
121 * @param {function():void=} opt_callback
124 chrome.Storage.prototype.set = function(items, opt_callback) {};
127 * @param {string|Array.<string>} items
128 * @param {function():void=} opt_callback
131 chrome.Storage.prototype.remove = function(items, opt_callback) {};
134 * @param {function():void=} opt_callback
137 chrome.Storage.prototype.clear = function(opt_callback) {};
142 * src/chrome/common/extensions/api/context_menus.json
144 chrome.contextMenus = {};
145 /** @type {ChromeEvent} */
146 chrome.contextMenus.onClicked;
148 * @param {!Object} createProperties
149 * @param {function()=} opt_callback
151 chrome.contextMenus.create = function(createProperties, opt_callback) {};
153 * @param {string|number} id
154 * @param {!Object} updateProperties
155 * @param {function()=} opt_callback
157 chrome.contextMenus.update = function(id, updateProperties, opt_callback) {};
159 * @param {string|number} menuItemId
160 * @param {function()=} opt_callback
162 chrome.contextMenus.remove = function(menuItemId, opt_callback) {};
164 * @param {function()=} opt_callback
166 chrome.contextMenus.removeAll = function(opt_callback) {};
169 function OnClickData() {}
170 /** @type {string|number} */
171 OnClickData.prototype.menuItemId;
172 /** @type {string|number} */
173 OnClickData.prototype.parentMenuItemId;
174 /** @type {string} */
175 OnClickData.prototype.mediaType;
176 /** @type {string} */
177 OnClickData.prototype.linkUrl;
178 /** @type {string} */
179 OnClickData.prototype.srcUrl;
180 /** @type {string} */
181 OnClickData.prototype.pageUrl;
182 /** @type {string} */
183 OnClickData.prototype.frameUrl;
184 /** @type {string} */
185 OnClickData.prototype.selectionText;
186 /** @type {boolean} */
187 OnClickData.prototype.editable;
188 /** @type {boolean} */
189 OnClickData.prototype.wasChecked;
190 /** @type {boolean} */
191 OnClickData.prototype.checked;
194 /** @type {Object} */
197 * @param {Object.<string>} parameters
198 * @param {function(string):void} callback
200 getAuthToken: function(parameters, callback) {},
202 * @param {Object.<string>} parameters
203 * @param {function(string):void} callback
205 launchWebAuthFlow: function(parameters, callback) {}
208 // TODO(garykac): Combine chrome.Event and ChromeEvent
210 function ChromeEvent() {}
211 /** @param {Function} callback */
212 ChromeEvent.prototype.addListener = function(callback) {};
213 /** @param {Function} callback */
214 ChromeEvent.prototype.removeListener = function(callback) {};
215 /** @param {Function} callback */
216 ChromeEvent.prototype.hasListener = function(callback) {};
217 /** @param {Function} callback */
218 ChromeEvent.prototype.hasListeners = function(callback) {};
221 chrome.Event = function() {};
223 /** @param {function():void} callback */
224 chrome.Event.prototype.addListener = function(callback) {};
226 /** @param {function():void} callback */
227 chrome.Event.prototype.removeListener = function(callback) {};
230 /** @type {Object} */
231 chrome.permissions = {
233 * @param {Object.<string>} permissions
234 * @param {function(boolean):void} callback
236 contains: function(permissions, callback) {},
238 * @param {Object.<string>} permissions
239 * @param {function(boolean):void} callback
241 request: function(permissions, callback) {}
245 /** @type {Object} */
248 /** @param {function(chrome.Tab):void} callback */
249 chrome.tabs.getCurrent = function(callback) {}
252 chrome.Tab = function() {
253 /** @type {boolean} */
255 /** @type {number} */
260 /** @type {Object} */
263 /** @param {number} id
264 * @param {Object?} getInfo
265 * @param {function(chrome.Window):void} callback */
266 chrome.windows.get = function(id, getInfo, callback) {}
269 chrome.Window = function() {
270 /** @type {string} */
272 /** @type {string} */
277 var AppWindow = function() {
278 /** @type {Window} */
279 this.contentWindow = null;
280 /** @type {chrome.Event} */
281 this.onRestored = null;
282 /** @type {chrome.Event} */
283 this.onMaximized = null;
284 /** @type {chrome.Event} */
285 this.onFullscreened = null;
288 AppWindow.prototype.close = function() {};
289 AppWindow.prototype.drawAttention = function() {};
290 AppWindow.prototype.minimize = function() {};
291 AppWindow.prototype.restore = function() {};
292 AppWindow.prototype.fullscreen = function() {};
293 /** @return {boolean} */
294 AppWindow.prototype.isFullscreen = function() {};
295 /** @return {boolean} */
296 AppWindow.prototype.isMaximized = function() {};
299 * @param {{rects: Array.<ClientRect>}} rects
301 AppWindow.prototype.setShape = function(rects) {};
304 * @param {{rects: Array.<ClientRect>}} rects
306 AppWindow.prototype.setInputRegion = function(rects) {};
309 var LaunchData = function() {
310 /** @type {string} */
312 /** @type {Array.<{type: string, entry: FileEntry}>} */
317 function ClientRect() {
318 /** @type {number} */
320 /** @type {number} */
322 /** @type {number} */
324 /** @type {number} */
326 /** @type {number} */
328 /** @type {number} */