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.
9 /** @type {HTMLElement} */
10 Document.prototype.activeElement;
12 /** @type {Array.<HTMLElement>} */
13 Document.prototype.all;
15 /** @type {boolean} */
16 Document.prototype.hidden;
18 /** @type {function(string): void} */
19 Document.prototype.execCommand = function(command) {};
21 /** @return {void} Nothing. */
22 Document.prototype.webkitCancelFullScreen = function() {};
24 /** @type {boolean} */
25 Document.prototype.webkitIsFullScreen;
27 /** @type {boolean} */
28 Document.prototype.webkitHidden;
31 Element.ALLOW_KEYBOARD_INPUT;
33 /** @param {number} flags
34 /** @return {void} Nothing. */
35 Element.prototype.webkitRequestFullScreen = function(flags) {};
37 /** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */
38 Window.prototype.crypto;
41 @extends {HTMLElement} */
42 var HTMLEmbedElement = function() { };
45 HTMLEmbedElement.prototype.height;
48 HTMLEmbedElement.prototype.width;
51 HTMLIFrameElement.prototype.contentWindow;
54 var MutationRecord = function() {};
57 MutationRecord.prototype.attributeName;
59 /** @type {Element} */
60 MutationRecord.prototype.target;
63 MutationRecord.prototype.type;
66 @param {function(Array.<MutationRecord>):void} callback */
67 var MutationObserver = function(callback) {};
69 /** @param {Element} element
70 @param {Object} options */
71 MutationObserver.prototype.observe = function(element, options) {};
76 /** @type {chrome.Storage} */
79 /** @type {chrome.Storage} */
83 chrome.Storage = function() {};
86 * @param {string|Array.<string>|Object.<string>} items
87 * @param {function(Object.<string>):void} callback
90 chrome.Storage.prototype.get = function(items, callback) {};
93 * @param {Object.<string>} items
94 * @param {function():void=} opt_callback
97 chrome.Storage.prototype.set = function(items, opt_callback) {};
100 * @param {string|Array.<string>} items
101 * @param {function():void=} opt_callback
104 chrome.Storage.prototype.remove = function(items, opt_callback) {};
107 * @param {function():void=} opt_callback
110 chrome.Storage.prototype.clear = function(opt_callback) {};
112 /** @type {Object} */
113 chrome.app.runtime = {
114 /** @type {chrome.Event} */
118 /** @type {Object} */
119 chrome.app.window = {
121 * @param {string} name
122 * @param {Object} parameters
124 create: function(name, parameters) {}
129 * @see http://code.google.com/chrome/extensions/dev/contextMenus.html
131 chrome.contextMenus = {
132 /** @type {chrome.Event} */
134 /** @param {Object} createParams */
135 create: function(createParams) {}
138 /** @type {Object} */
141 * @param {Object.<string>} parameters
142 * @param {function(string):void} callback
144 getAuthToken: function(parameters, callback) {},
146 * @param {Object.<string>} parameters
147 * @param {function(string):void} callback
149 launchWebAuthFlow: function(parameters, callback) {}
153 chrome.Event = function() {};
155 /** @param {function():void} callback */
156 chrome.Event.prototype.addListener = function(callback) {};
158 /** @param {function():void} callback */
159 chrome.Event.prototype.removeListener = function(callback) {};
162 chrome.extension.Port = function() {};
164 /** @type {chrome.Event} */
165 chrome.extension.Port.prototype.onMessage;
167 /** @type {chrome.Event} */
168 chrome.extension.Port.prototype.onDisconnect;
171 * @param {Object} message
173 chrome.extension.Port.prototype.postMessage = function(message) {};
175 /** @type {Object} */
177 /** @type {Object} */
179 /** @type {string} */
182 /** @return {{version: string, app: {background: Object}}} */
183 getManifest: function() {}
187 * @type {?function(string):chrome.extension.Port}
189 chrome.runtime.connectNative = function(name) {};
191 /** @type {Object} */
194 /** @param {function(chrome.Tab):void} callback */
195 chrome.tabs.getCurrent = function(callback) {}
198 chrome.Tab = function() {
199 /** @type {boolean} */
201 /** @type {number} */
205 /** @type {Object} */
208 /** @param {number} id
209 * @param {Object?} getInfo
210 * @param {function(chrome.Window):void} callback */
211 chrome.windows.get = function(id, getInfo, callback) {}
214 chrome.Window = function() {
215 /** @type {string} */
217 /** @type {string} */
224 chrome.extension.sendMessage = function(message) {}
226 /** @type {chrome.Event} */
227 chrome.extension.onMessage;
229 /** @type {Object} */
230 chrome.permissions = {
232 * @param {Object.<string>} permissions
233 * @param {function(boolean):void} callback
235 contains: function(permissions, callback) {},
237 * @param {Object.<string>} permissions
238 * @param {function(boolean):void} callback
240 request: function(permissions, callback) {}