ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / remoting / webapp / js_proto / chrome_proto.js
blob6ecead26b4dec6bcf2389fe20ed2268ac3571b8b
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 {Object} */
10 chrome.app = {};
12 /** @type {Object} */
13 chrome.app.runtime = {
14 /** @type {chrome.Event} */
15 onLaunched: null
19 /** @type {Object} */
20 chrome.app.window = {
21 /**
22 * @param {string} name
23 * @param {Object} parameters
24 * @param {function(AppWindow)=} opt_callback
26 create: function(name, parameters, opt_callback) {},
27 /**
28 * @return {AppWindow}
30 current: function() {},
31 /**
32 * @param {string} id
33 * @return {AppWindow}
35 get: function(id) {},
36 /**
37 * @return {Array<AppWindow>}
39 getAll: function() {}
43 /** @type {Object} */
44 chrome.runtime = {
45 /** @type {Object} */
46 lastError: {
47 /** @type {string} */
48 message: ''
50 /** @type {string} */
51 id: '',
52 /** @return {{name: string, version: string, app: {background: Object}}} */
53 getManifest: function() {},
54 /** @param {function(Window):void} callback */
55 getBackgroundPage: function(callback) {},
56 /** @type {chrome.Event} */
57 onSuspend: null,
58 /** @type {chrome.Event} */
59 onSuspendCanceled: null,
60 /** @type {chrome.Event} */
61 onConnect: null,
62 /** @type {chrome.Event} */
63 onConnectExternal: null,
64 /** @type {chrome.Event} */
65 onMessage: null,
66 /** @type {chrome.Event} */
67 onMessageExternal: null
70 /**
71 * @type {?function(string):chrome.runtime.Port}
73 chrome.runtime.connectNative = function(name) {};
75 /**
76 * @param {{ name: string}} config
77 * @return {chrome.runtime.Port}
79 chrome.runtime.connect = function(config) {};
81 /**
82 * @param {string?} extensionId
83 * @param {*} message
84 * @param {Object=} opt_options
85 * @param {function(*)=} opt_callback
87 chrome.runtime.sendMessage = function(
88 extensionId, message, opt_options, opt_callback) {};
90 /** @constructor */
91 chrome.runtime.MessageSender = function(){
92 /** @type {chrome.Tab} */
93 this.tab = null;
94 /** @type {string} */
95 this.id = '';
96 /** @type {string} */
97 this.url = '';
100 /** @constructor */
101 chrome.runtime.Port = function() {
102 this.onMessage = new chrome.Event();
103 this.onDisconnect = new chrome.Event();
105 /** @type {string} */
106 this.name = '';
108 /** @type {chrome.runtime.MessageSender} */
109 this.sender = null;
112 /** @type {chrome.Event} */
113 chrome.runtime.Port.prototype.onMessage = null;
115 /** @type {chrome.Event} */
116 chrome.runtime.Port.prototype.onDisconnect = null;
118 chrome.runtime.Port.prototype.disconnect = function() {};
121 * @param {Object} message
123 chrome.runtime.Port.prototype.postMessage = function(message) {};
126 /** @type {Object} */
127 chrome.extension = {};
130 * @param {*} message
131 * @param {function(*)=} opt_callback
133 chrome.extension.sendMessage = function(message, opt_callback) {};
135 /** @type {chrome.Event} */
136 chrome.extension.onMessage;
139 /** @type {Object} */
140 chrome.i18n = {};
143 * @param {string} messageName
144 * @param {(string|Array<string>)=} opt_args
145 * @return {string}
147 chrome.i18n.getMessage = function(messageName, opt_args) {};
150 * @return {string}
152 chrome.i18n.getUILanguage = function() {};
155 /** @type {Object} */
156 chrome.storage = {};
158 /** @type {chrome.Storage} */
159 chrome.storage.local;
161 /** @type {chrome.Storage} */
162 chrome.storage.sync;
164 /** @constructor */
165 chrome.Storage = function() {};
168 * @param {string|Array<string>|Object<string>} items
169 * @param {function(Object<string>):void} callback
170 * @return {void}
172 chrome.Storage.prototype.get = function(items, callback) {};
175 * @param {Object<string>} items
176 * @param {function():void=} opt_callback
177 * @return {void}
179 chrome.Storage.prototype.set = function(items, opt_callback) {};
182 * @param {string|Array<string>} items
183 * @param {function():void=} opt_callback
184 * @return {void}
186 chrome.Storage.prototype.remove = function(items, opt_callback) {};
189 * @param {function():void=} opt_callback
190 * @return {void}
192 chrome.Storage.prototype.clear = function(opt_callback) {};
196 * @type {Object}
197 * src/chrome/common/extensions/api/context_menus.json
199 chrome.contextMenus = {};
200 /** @type {chrome.Event} */
201 chrome.contextMenus.onClicked;
203 * @param {!Object} createProperties
204 * @param {function()=} opt_callback
206 chrome.contextMenus.create = function(createProperties, opt_callback) {};
208 * @param {string|number} id
209 * @param {!Object} updateProperties
210 * @param {function()=} opt_callback
212 chrome.contextMenus.update = function(id, updateProperties, opt_callback) {};
214 * @param {string|number} menuItemId
215 * @param {function()=} opt_callback
217 chrome.contextMenus.remove = function(menuItemId, opt_callback) {};
219 * @param {function()=} opt_callback
221 chrome.contextMenus.removeAll = function(opt_callback) {};
223 /** @constructor */
224 function OnClickData() {};
225 /** @type {string|number} */
226 OnClickData.prototype.menuItemId;
227 /** @type {string|number} */
228 OnClickData.prototype.parentMenuItemId;
229 /** @type {string} */
230 OnClickData.prototype.mediaType;
231 /** @type {string} */
232 OnClickData.prototype.linkUrl;
233 /** @type {string} */
234 OnClickData.prototype.srcUrl;
235 /** @type {string} */
236 OnClickData.prototype.pageUrl;
237 /** @type {string} */
238 OnClickData.prototype.frameUrl;
239 /** @type {string} */
240 OnClickData.prototype.selectionText;
241 /** @type {boolean} */
242 OnClickData.prototype.editable;
243 /** @type {boolean} */
244 OnClickData.prototype.wasChecked;
245 /** @type {boolean} */
246 OnClickData.prototype.checked;
249 /** @type {Object} */
250 chrome.fileSystem = {
252 * @param {Object<string>?} options
253 * @param {function(Entry, Array<FileEntry>):void} callback
255 chooseEntry: function(options, callback) {},
257 * @param {Entry} entry
258 * @param {function(string):void} callback
260 getDisplayPath: function(entry, callback) {}
263 /** @param {function(FileWriter):void} callback */
264 Entry.prototype.createWriter = function(callback) {};
266 /** @type {Object} */
267 chrome.identity = {
269 * @param {Object<string>} parameters
270 * @param {function(string):void} callback
272 getAuthToken: function(parameters, callback) {},
274 * @param {Object<string>} parameters
275 * @param {function():void} callback
277 removeCachedAuthToken: function(parameters, callback) {},
279 * @param {Object<string>} parameters
280 * @param {function(string):void} callback
282 launchWebAuthFlow: function(parameters, callback) {}
286 /** @type {Object} */
287 chrome.permissions = {
289 * @param {Object<string>} permissions
290 * @param {function(boolean):void} callback
292 contains: function(permissions, callback) {},
294 * @param {Object<string>} permissions
295 * @param {function(boolean):void} callback
297 request: function(permissions, callback) {}
301 /** @type {Object} */
302 chrome.tabs = {};
304 /** @param {function(chrome.Tab):void} callback */
305 chrome.tabs.getCurrent = function(callback) {};
308 * @param {Object?} options
309 * @param {function(chrome.Tab)=} opt_callback
311 chrome.tabs.create = function(options, opt_callback) {};
314 * @param {string} id
315 * @param {function(chrome.Tab)} callback
317 chrome.tabs.get = function(id, callback) {};
320 * @param {string} id
321 * @param {function(*=):void=} opt_callback
323 chrome.tabs.remove = function(id, opt_callback) {};
326 /** @constructor */
327 chrome.Tab = function() {
328 /** @type {boolean} */
329 this.pinned = false;
330 /** @type {number} */
331 this.windowId = 0;
332 /** @type {string} */
333 this.id = '';
337 /** @type {Object} */
338 chrome.windows = {};
340 /** @param {number} id
341 * @param {Object?} getInfo
342 * @param {function(chrome.Window):void} callback */
343 chrome.windows.get = function(id, getInfo, callback) {};
345 /** @constructor */
346 chrome.Window = function() {
347 /** @type {string} */
348 this.state = '';
349 /** @type {string} */
350 this.type = '';
353 /** @constructor */
354 var AppWindow = function() {
355 /** @type {Window} */
356 this.contentWindow = null;
357 /** @type {chrome.Event} */
358 this.onClosed = null;
359 /** @type {chrome.Event} */
360 this.onRestored = null;
361 /** @type {chrome.Event} */
362 this.onMaximized = null;
363 /** @type {chrome.Event} */
364 this.onMinimized = null;
365 /** @type {chrome.Event} */
366 this.onFullscreened = null;
367 /** @type {string} */
368 this.id = '';
369 /** @type {Bounds} */
370 this.outerBounds = null;
371 /** @type {Bounds} */
372 this.innerBounds = null;
375 AppWindow.prototype.close = function() {};
376 AppWindow.prototype.drawAttention = function() {};
377 AppWindow.prototype.focus = function() {};
378 AppWindow.prototype.maximize = function() {};
379 AppWindow.prototype.minimize = function() {};
381 * @param {number} left
382 * @param {number} top
384 AppWindow.prototype.moveTo = function(left, top) {};
386 * @param {number} width
387 * @param {number} height
389 AppWindow.prototype.resizeTo = function(width, height) {};
391 AppWindow.prototype.restore = function() {};
392 AppWindow.prototype.show = function() {};
393 /** @return {boolean} */
394 AppWindow.prototype.isMinimized = function() {};
395 AppWindow.prototype.fullscreen = function() {};
396 /** @return {boolean} */
397 AppWindow.prototype.isFullscreen = function() {};
398 /** @return {boolean} */
399 AppWindow.prototype.isMaximized = function() {};
402 * @param {{rects: Array<ClientRect>}} rects
404 AppWindow.prototype.setShape = function(rects) {};
407 * @param {{rects: Array<ClientRect>}} rects
409 AppWindow.prototype.setInputRegion = function(rects) {};
411 /** @constructor */
412 var LaunchData = function() {
413 /** @type {string} */
414 this.id = '';
415 /** @type {Array<{type: string, entry: FileEntry}>} */
416 this.items = [];
419 /** @constructor */
420 function Bounds() {
421 /** @type {number} */
422 this.left = 0;
423 /** @type {number} */
424 this.top = 0;
425 /** @type {number} */
426 this.width = 0;
427 /** @type {number} */
428 this.height = 0;
431 /** @type {Object} */
432 chrome.sockets = {};
434 /** @type {Object} */
435 chrome.sockets.tcp = {};
437 /** @constructor */
438 chrome.sockets.tcp.CreateInfo = function() {
439 /** @type {number} */
440 this.socketId = 0;
444 * @param {Object} properties
445 * @param {function(chrome.sockets.tcp.CreateInfo):void} callback
447 chrome.sockets.tcp.create = function(properties, callback) {};
450 /** @constructor */
451 chrome.sockets.tcp.ConnectInfo = function() {
452 /** @type {number} */
453 this.result = 0;
457 * @param {number} socketId
458 * @param {string} peerAddress
459 * @param {number} peerPort
460 * @param {function(chrome.sockets.tcp.ConnectInfo):void} callback
462 chrome.sockets.tcp.connect =
463 function(socketId, peerAddress, peerPort, callback) {};
466 /** @constructor */
467 chrome.sockets.tcp.SendInfo = function() {
468 /** @type {number} */
469 this.resultCode = 0;
471 /** @type {number} */
472 this.bytesSent = 0;
476 * @param {number} socketId
477 * @param {ArrayBuffer} data
478 * @param {function(chrome.sockets.tcp.SendInfo):void} callback
480 chrome.sockets.tcp.send = function(socketId, data, callback) {};
484 * @param {number} socketId
486 chrome.sockets.tcp.close = function(socketId) {};
489 * @param {number} socketId
490 * @param {Object} options
491 * @param {function(number):void} callback
493 chrome.sockets.tcp.secure = function(socketId, options, callback) {};
495 /** @constructor */
496 chrome.sockets.tcp.ReceiveInfo = function() {
497 /** @type {number} */
498 this.socketId = 0;
500 /** @type {ArrayBuffer} */
501 this.data = null;
504 /** @type {chrome.Event} */
505 chrome.sockets.tcp.onReceive = null;
507 /** @constructor */
508 chrome.sockets.tcp.ReceiveErrorInfo = function() {
509 /** @type {number} */
510 this.socketId = 0;
512 /** @type {number} */
513 this.resultCode = 0;
516 /** @type {chrome.Event} */
517 chrome.sockets.tcp.onReceiveError = null;
519 /** @type {Object} */
520 chrome.socket = {};
522 /** @constructor */
523 chrome.socket.CreateInfo = function() {
524 /** @type {number} */
525 this.socketId = 0;
529 * @param {string} socketType
530 * @param {Object} options
531 * @param {function(chrome.socket.CreateInfo):void} callback
533 chrome.socket.create = function(socketType, options, callback) {};
536 * @param {number} socketId
537 * @param {string} hostname
538 * @param {number} port
539 * @param {function(number):void} callback
541 chrome.socket.connect =
542 function(socketId, hostname, port, callback) {};
544 /** @constructor */
545 chrome.socket.WriteInfo = function() {
546 /** @type {number} */
547 this.bytesWritten = 0;
551 * @param {number} socketId
552 * @param {ArrayBuffer} data
553 * @param {function(chrome.socket.WriteInfo):void} callback
555 chrome.socket.write = function(socketId, data, callback) {};
557 /** @constructor */
558 chrome.socket.ReadInfo = function() {
559 /** @type {number} */
560 this.resultCode = 0;
562 /** @type {ArrayBuffer} */
563 this.data = null;
567 * @param {number} socketId
568 * @param {function(chrome.socket.ReadInfo):void} callback
570 chrome.socket.read = function(socketId, callback) {};
573 * @param {number} socketId
575 chrome.socket.destroy = function(socketId) {};
578 * @param {number} socketId
579 * @param {Object} options
580 * @param {function(number):void} callback
582 chrome.socket.secure = function(socketId, options, callback) {};