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) {};
56 chrome.extension = {};
59 chrome.extension.Port = function() {};
61 /** @type {chrome.Event} */
62 chrome.extension.Port.prototype.onMessage;
64 /** @type {chrome.Event} */
65 chrome.extension.Port.prototype.onDisconnect;
68 * @param {Object} message
70 chrome.extension.Port.prototype.postMessage = function(message) {};
75 chrome.extension.sendMessage = function(message) {}
77 /** @type {chrome.Event} */
78 chrome.extension.onMessage;
85 * @param {string} messageName
86 * @param {(string|Array.<string>)=} opt_args
89 chrome.i18n.getMessage = function(messageName, opt_args) {};
95 /** @type {chrome.Storage} */
98 /** @type {chrome.Storage} */
102 chrome.Storage = function() {};
105 * @param {string|Array.<string>|Object.<string>} items
106 * @param {function(Object.<string>):void} callback
109 chrome.Storage.prototype.get = function(items, callback) {};
112 * @param {Object.<string>} items
113 * @param {function():void=} opt_callback
116 chrome.Storage.prototype.set = function(items, opt_callback) {};
119 * @param {string|Array.<string>} items
120 * @param {function():void=} opt_callback
123 chrome.Storage.prototype.remove = function(items, opt_callback) {};
126 * @param {function():void=} opt_callback
129 chrome.Storage.prototype.clear = function(opt_callback) {};
134 * src/chrome/common/extensions/api/context_menus.json
136 chrome.contextMenus = {};
137 /** @type {ChromeEvent} */
138 chrome.contextMenus.onClicked;
140 * @param {!Object} createProperties
141 * @param {function()=} opt_callback
143 chrome.contextMenus.create = function(createProperties, opt_callback) {};
145 * @param {string|number} id
146 * @param {!Object} updateProperties
147 * @param {function()=} opt_callback
149 chrome.contextMenus.update = function(id, updateProperties, opt_callback) {};
151 * @param {string|number} menuItemId
152 * @param {function()=} opt_callback
154 chrome.contextMenus.remove = function(menuItemId, opt_callback) {};
156 * @param {function()=} opt_callback
158 chrome.contextMenus.removeAll = function(opt_callback) {};
161 function OnClickData() {}
162 /** @type {string|number} */
163 OnClickData.prototype.menuItemId;
164 /** @type {string|number} */
165 OnClickData.prototype.parentMenuItemId;
166 /** @type {string} */
167 OnClickData.prototype.mediaType;
168 /** @type {string} */
169 OnClickData.prototype.linkUrl;
170 /** @type {string} */
171 OnClickData.prototype.srcUrl;
172 /** @type {string} */
173 OnClickData.prototype.pageUrl;
174 /** @type {string} */
175 OnClickData.prototype.frameUrl;
176 /** @type {string} */
177 OnClickData.prototype.selectionText;
178 /** @type {boolean} */
179 OnClickData.prototype.editable;
180 /** @type {boolean} */
181 OnClickData.prototype.wasChecked;
182 /** @type {boolean} */
183 OnClickData.prototype.checked;
186 /** @type {Object} */
189 * @param {Object.<string>} parameters
190 * @param {function(string):void} callback
192 getAuthToken: function(parameters, callback) {},
194 * @param {Object.<string>} parameters
195 * @param {function(string):void} callback
197 launchWebAuthFlow: function(parameters, callback) {}
200 // TODO(garykac): Combine chrome.Event and ChromeEvent
202 function ChromeEvent() {}
203 /** @param {Function} callback */
204 ChromeEvent.prototype.addListener = function(callback) {};
205 /** @param {Function} callback */
206 ChromeEvent.prototype.removeListener = function(callback) {};
207 /** @param {Function} callback */
208 ChromeEvent.prototype.hasListener = function(callback) {};
209 /** @param {Function} callback */
210 ChromeEvent.prototype.hasListeners = function(callback) {};
213 chrome.Event = function() {};
215 /** @param {function():void} callback */
216 chrome.Event.prototype.addListener = function(callback) {};
218 /** @param {function():void} callback */
219 chrome.Event.prototype.removeListener = function(callback) {};
222 /** @type {Object} */
223 chrome.permissions = {
225 * @param {Object.<string>} permissions
226 * @param {function(boolean):void} callback
228 contains: function(permissions, callback) {},
230 * @param {Object.<string>} permissions
231 * @param {function(boolean):void} callback
233 request: function(permissions, callback) {}
237 /** @type {Object} */
240 /** @param {function(chrome.Tab):void} callback */
241 chrome.tabs.getCurrent = function(callback) {}
244 chrome.Tab = function() {
245 /** @type {boolean} */
247 /** @type {number} */
252 /** @type {Object} */
255 /** @param {number} id
256 * @param {Object?} getInfo
257 * @param {function(chrome.Window):void} callback */
258 chrome.windows.get = function(id, getInfo, callback) {}
261 chrome.Window = function() {
262 /** @type {string} */
264 /** @type {string} */
269 var AppWindow = function() {
270 /** @type {Window} */
271 this.contentWindow = null;
272 /** @type {chrome.Event} */
273 this.onRestored = null;
276 AppWindow.prototype.close = function() {};
277 AppWindow.prototype.drawAttention = function() {};
278 AppWindow.prototype.minimize = function() {};
281 * @param {{rects: Array.<ClientRect>}} rects
283 AppWindow.prototype.setShape = function(rects) {};
286 * @param {{rects: Array.<ClientRect>}} rects
288 AppWindow.prototype.setInputRegion = function(rects) {};
291 var LaunchData = function() {
292 /** @type {string} */
294 /** @type {Array.<{type: string, entry: FileEntry}>} */
299 function ClientRect() {
300 /** @type {number} */
302 /** @type {number} */
304 /** @type {number} */
306 /** @type {number} */
308 /** @type {number} */
310 /** @type {number} */