Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / remoting / webapp / jscompiler_hacks.js
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.
4
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.
8
9 /** @type {HTMLElement} */
10 Document.prototype.activeElement;
11
12 /** @type {Array.<HTMLElement>} */
13 Document.prototype.all;
14
15 /** @type {boolean} */
16 Document.prototype.hidden;
17
18 /** @type {function(string): void} */
19 Document.prototype.execCommand = function(command) {};
20
21 /** @return {void} Nothing. */
22 Document.prototype.webkitCancelFullScreen = function() {};
23
24 /** @type {boolean} */
25 Document.prototype.webkitIsFullScreen;
26
27 /** @type {boolean} */
28 Document.prototype.webkitHidden;
29
30 /** @type {number} */
31 Element.ALLOW_KEYBOARD_INPUT;
32
33 /** @param {number} flags
34 /** @return {void} Nothing. */
35 Element.prototype.webkitRequestFullScreen = function(flags) {};
36
37 /** @type {{getRandomValues: function((Uint16Array|Uint8Array)):void}} */
38 Window.prototype.crypto;
39
40 /** @constructor
41     @extends {HTMLElement} */
42 var HTMLEmbedElement = function() { };
43
44 /** @type {number} */
45 HTMLEmbedElement.prototype.height;
46
47 /** @type {number} */
48 HTMLEmbedElement.prototype.width;
49
50 /** @type {Window} */
51 HTMLIFrameElement.prototype.contentWindow;
52
53 /** @constructor */
54 var MutationRecord = function() {};
55
56 /** @type {string} */
57 MutationRecord.prototype.attributeName;
58
59 /** @type {Element} */
60 MutationRecord.prototype.target;
61
62 /** @type {string} */
63 MutationRecord.prototype.type;
64
65 /** @constructor
66     @param {function(Array.<MutationRecord>):void} callback */
67 var MutationObserver = function(callback) {};
68
69 /** @param {Element} element
70     @param {Object} options */
71 MutationObserver.prototype.observe = function(element, options) {};
72
73 /** @type {Object} */
74 chrome.storage = {};
75
76 /** @type {chrome.Storage} */
77 chrome.storage.local;
78
79 /** @type {chrome.Storage} */
80 chrome.storage.sync;
81
82 /** @constructor */
83 chrome.Storage = function() {};
84
85 /**
86  * @param {string|Array.<string>|Object.<string>} items
87  * @param {function(Object.<string>):void} callback
88  * @return {void}
89  */
90 chrome.Storage.prototype.get = function(items, callback) {};
91
92 /**
93  * @param {Object.<string>} items
94  * @param {function():void=} opt_callback
95  * @return {void}
96  */
97 chrome.Storage.prototype.set = function(items, opt_callback) {};
98
99 /**
100  * @param {string|Array.<string>} items
101  * @param {function():void=} opt_callback
102  * @return {void}
103  */
104 chrome.Storage.prototype.remove = function(items, opt_callback) {};
105
106 /**
107  * @param {function():void=} opt_callback
108  * @return {void}
109  */
110 chrome.Storage.prototype.clear = function(opt_callback) {};
111
112 /** @type {Object} */
113 chrome.app.runtime = {
114   /** @type {chrome.Event} */
115   onLaunched: null
116 };
117
118 /** @type {Object} */
119 chrome.app.window = {
120   /**
121    * @param {string} name
122    * @param {Object} parameters
123    */
124   create: function(name, parameters) {}
125 };
126
127 /**
128  * @type {Object}
129  * @see http://code.google.com/chrome/extensions/dev/contextMenus.html
130  */
131 chrome.contextMenus = {
132   /** @type {chrome.Event} */
133   onClicked: null,
134   /** @param {Object} createParams */
135   create: function(createParams) {}
136 };
137
138 /** @type {Object} */
139 chrome.identity = {
140   /**
141    * @param {Object.<string>} parameters
142    * @param {function(string):void} callback
143    */
144   getAuthToken: function(parameters, callback) {},
145   /**
146    * @param {Object.<string>} parameters
147    * @param {function(string):void} callback
148    */
149   launchWebAuthFlow: function(parameters, callback) {}
150 };
151
152 /** @constructor */
153 chrome.Event = function() {};
154
155 /** @param {function():void} callback */
156 chrome.Event.prototype.addListener = function(callback) {};
157
158 /** @param {function():void} callback */
159 chrome.Event.prototype.removeListener = function(callback) {};
160
161 /** @constructor */
162 chrome.extension.Port = function() {};
163
164 /** @type {chrome.Event} */
165 chrome.extension.Port.prototype.onMessage;
166
167 /** @type {chrome.Event} */
168 chrome.extension.Port.prototype.onDisconnect;
169
170 /**
171  * @param {Object} message
172  */
173 chrome.extension.Port.prototype.postMessage = function(message) {};
174
175 /** @type {Object} */
176 chrome.runtime = {
177   /** @type {Object} */
178   lastError: {
179     /** @type {string} */
180     message: ''
181   },
182   /** @return {{version: string, app: {background: Object}}} */
183   getManifest: function() {}
184 };
185
186 /**
187  * @type {?function(string):chrome.extension.Port}
188  */
189 chrome.runtime.connectNative = function(name) {};
190
191 /** @type {Object} */
192 chrome.tabs;
193
194 /** @param {function(chrome.Tab):void} callback */
195 chrome.tabs.getCurrent = function(callback) {}
196
197 /** @constructor */
198 chrome.Tab = function() {
199   /** @type {boolean} */
200   this.pinned = false;
201   /** @type {number} */
202   this.windowId = 0;
203 };
204
205 /** @type {Object} */
206 chrome.windows;
207
208 /** @param {number} id
209  *  @param {Object?} getInfo
210  *  @param {function(chrome.Window):void} callback */
211 chrome.windows.get = function(id, getInfo, callback) {}
212
213 /** @constructor */
214 chrome.Window = function() {
215   /** @type {string} */
216   this.state = '';
217   /** @type {string} */
218   this.type = '';
219 };
220
221 /**
222  * @param {*} message
223  */
224 chrome.extension.sendMessage = function(message) {}
225
226 /** @type {chrome.Event} */
227 chrome.extension.onMessage;
228
229 /** @type {Object} */
230 chrome.permissions = {
231   /**
232    * @param {Object.<string>} permissions
233    * @param {function(boolean):void} callback
234    */
235   contains: function(permissions, callback) {},
236 /**
237  * @param {Object.<string>} permissions
238  * @param {function(boolean):void} callback
239  */
240   request: function(permissions, callback) {}
241 };