/** @type {Object} */
var chrome = {};
+/** @constructor */
+chrome.Event = function() {};
+
+/** @param {Function} callback */
+chrome.Event.prototype.addListener = function(callback) {};
+
+/** @param {Function} callback */
+chrome.Event.prototype.removeListener = function(callback) {};
/** @type {Object} */
chrome.app = {};
/**
* @return {AppWindow}
*/
- current: function() {}
+ current: function() {},
+ /**
+ * @param {string} id
+ * @param {function()=} opt_callback
+ */
+ get: function(id, opt_callback) {}
};
/** @type {string} */
message: ''
},
- /** @return {{version: string, app: {background: Object}}} */
- getManifest: function() {}
+ /** @type {string} */
+ id: '',
+ /** @return {{name: string, version: string, app: {background: Object}}} */
+ getManifest: function() {},
+ /** @param {function(Window):void} callback */
+ getBackgroundPage: function(callback) {},
+ /** @type {chrome.Event} */
+ onSuspend: null,
+ /** @type {chrome.Event} */
+ onSuspendCanceled: null,
+ /** @type {chrome.Event} */
+ onConnect: null,
+ /** @type {chrome.Event} */
+ onConnectExternal: null,
+ /** @type {chrome.Event} */
+ onMessage: null,
+ /** @type {chrome.Event} */
+ onMessageExternal: null
};
/**
- * @type {?function(string):chrome.extension.Port}
+ * @type {?function(string):chrome.runtime.Port}
*/
chrome.runtime.connectNative = function(name) {};
+/**
+ * @param {{ name: string}} config
+ * @return {chrome.runtime.Port}
+ */
+chrome.runtime.connect = function(config) {};
-/** @type {Object} */
-chrome.extension = {};
+/**
+ * @param {string} extensionId
+ * @param {*} message
+ * @param {Object=} opt_options
+ * @param {function(*)=} opt_callback
+ */
+chrome.runtime.sendMessage = function(
+ extensionId, message, opt_options, opt_callback) {};
/** @constructor */
-chrome.extension.Port = function() {};
+chrome.runtime.MessageSender = function(){
+ /** @type {chrome.Tab} */
+ this.tab = null;
+};
+
+/** @constructor */
+chrome.runtime.Port = function() {
+ this.onMessage = new chrome.Event();
+ this.onDisconnect = new chrome.Event();
+
+ /** @type {string} */
+ this.name = '';
+
+ /** @type {chrome.runtime.MessageSender} */
+ this.sender = null;
+};
/** @type {chrome.Event} */
-chrome.extension.Port.prototype.onMessage;
+chrome.runtime.Port.prototype.onMessage = null;
/** @type {chrome.Event} */
-chrome.extension.Port.prototype.onDisconnect;
+chrome.runtime.Port.prototype.onDisconnect = null;
+
+chrome.runtime.Port.prototype.disconnect = function() {};
/**
* @param {Object} message
*/
-chrome.extension.Port.prototype.postMessage = function(message) {};
+chrome.runtime.Port.prototype.postMessage = function(message) {};
+
+
+/** @type {Object} */
+chrome.extension = {};
/**
* @param {*} message
*/
chrome.i18n.getMessage = function(messageName, opt_args) {};
+/**
+ * @return {string}
+ */
+chrome.i18n.getUILanguage = function() {};
+
/** @type {Object} */
chrome.storage = {};
* src/chrome/common/extensions/api/context_menus.json
*/
chrome.contextMenus = {};
-/** @type {ChromeEvent} */
+/** @type {chrome.Event} */
chrome.contextMenus.onClicked;
/**
* @param {!Object} createProperties
/** @type {Object} */
+chrome.fileSystem = {
+ /**
+ * @param {Object.<string>?} options
+ * @param {function(Entry, Array.<FileEntry>):void} callback
+ */
+ chooseEntry: function(options, callback) {},
+ /**
+ * @param {FileEntry} fileEntry
+ * @param {function(string):void} callback
+ */
+ getDisplayPath: function(fileEntry, callback) {}
+};
+
+/** @type {Object} */
chrome.identity = {
/**
* @param {Object.<string>} parameters
getAuthToken: function(parameters, callback) {},
/**
* @param {Object.<string>} parameters
+ * @param {function():void} callback
+ */
+ removeCachedAuthToken: function(parameters, callback) {},
+ /**
+ * @param {Object.<string>} parameters
* @param {function(string):void} callback
*/
launchWebAuthFlow: function(parameters, callback) {}
};
-// TODO(garykac): Combine chrome.Event and ChromeEvent
-/** @constructor */
-function ChromeEvent() {}
-/** @param {Function} callback */
-ChromeEvent.prototype.addListener = function(callback) {};
-/** @param {Function} callback */
-ChromeEvent.prototype.removeListener = function(callback) {};
-/** @param {Function} callback */
-ChromeEvent.prototype.hasListener = function(callback) {};
-/** @param {Function} callback */
-ChromeEvent.prototype.hasListeners = function(callback) {};
-
-/** @constructor */
-chrome.Event = function() {};
-
-/** @param {function():void} callback */
-chrome.Event.prototype.addListener = function(callback) {};
-
-/** @param {function():void} callback */
-chrome.Event.prototype.removeListener = function(callback) {};
-
/** @type {Object} */
chrome.permissions = {
/** @type {Object} */
-chrome.tabs;
+chrome.tabs = {};
/** @param {function(chrome.Tab):void} callback */
-chrome.tabs.getCurrent = function(callback) {}
+chrome.tabs.getCurrent = function(callback) {};
+
+/**
+ * @param {Object?} options
+ * @param {function(chrome.Tab)=} opt_callback
+ */
+chrome.tabs.create = function(options, opt_callback) {};
+
+/**
+ * @param {string} id
+ * @param {function(chrome.Tab)} callback
+ */
+chrome.tabs.get = function(id, callback) {};
+
+/**
+ * @param {string} id
+ * @param {function()=} opt_callback
+ */
+chrome.tabs.remove = function(id, opt_callback) {};
+
/** @constructor */
chrome.Tab = function() {
this.pinned = false;
/** @type {number} */
this.windowId = 0;
+ /** @type {string} */
+ this.id = '';
};
/** @type {Object} */
-chrome.windows;
+chrome.windows = {};
/** @param {number} id
* @param {Object?} getInfo
* @param {function(chrome.Window):void} callback */
-chrome.windows.get = function(id, getInfo, callback) {}
+chrome.windows.get = function(id, getInfo, callback) {};
/** @constructor */
chrome.Window = function() {
/** @type {Window} */
this.contentWindow = null;
/** @type {chrome.Event} */
+ this.onClosed = null;
+ /** @type {chrome.Event} */
this.onRestored = null;
+ /** @type {chrome.Event} */
+ this.onMaximized = null;
+ /** @type {chrome.Event} */
+ this.onFullscreened = null;
+ /** @type {string} */
+ this.id = '';
+ /** @type {Bounds} */
+ this.outerBounds = null;
+ /** @type {Bounds} */
+ this.innerBounds = null;
};
AppWindow.prototype.close = function() {};
AppWindow.prototype.drawAttention = function() {};
+AppWindow.prototype.focus = function() {};
+AppWindow.prototype.maximize = function() {};
AppWindow.prototype.minimize = function() {};
+AppWindow.prototype.restore = function() {};
+AppWindow.prototype.show = function() {};
+/** @return {boolean} */
+AppWindow.prototype.isMinimized = function() {};
+AppWindow.prototype.fullscreen = function() {};
+/** @return {boolean} */
+AppWindow.prototype.isFullscreen = function() {};
+/** @return {boolean} */
+AppWindow.prototype.isMaximized = function() {};
/**
* @param {{rects: Array.<ClientRect>}} rects
};
/** @constructor */
+function Bounds() {
+ /** @type {number} */
+ this.left = 0;
+ /** @type {number} */
+ this.top = 0;
+ /** @type {number} */
+ this.width = 0;
+ /** @type {number} */
+ this.height = 0;
+};
+
+/** @constructor */
function ClientRect() {
/** @type {number} */
this.width = 0;
/** @type {number} */
this.right = 0;
};
+
+/** @type {Object} */
+chrome.cast = {};
+
+/** @constructor */
+chrome.cast.AutoJoinPolicy = function() {};
+
+/** @type {chrome.cast.AutoJoinPolicy} */
+chrome.cast.AutoJoinPolicy.PAGE_SCOPED;
+
+/** @type {chrome.cast.AutoJoinPolicy} */
+chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED;
+
+/** @type {chrome.cast.AutoJoinPolicy} */
+chrome.cast.AutoJoinPolicy.TAB_AND_ORIGIN_SCOPED;
+
+/** @constructor */
+chrome.cast.DefaultActionPolicy = function() {};
+
+/** @type {chrome.cast.DefaultActionPolicy} */
+chrome.cast.DefaultActionPolicy.CAST_THIS_TAB;
+
+/** @type {chrome.cast.DefaultActionPolicy} */
+chrome.cast.DefaultActionPolicy.CREATE_SESSION;
+
+/** @constructor */
+chrome.cast.Error = function() {};
+
+/** @constructor */
+chrome.cast.ReceiverAvailability = function() {};
+
+/** @type {chrome.cast.ReceiverAvailability} */
+chrome.cast.ReceiverAvailability.AVAILABLE;
+
+/** @type {chrome.cast.ReceiverAvailability} */
+chrome.cast.ReceiverAvailability.UNAVAILABLE;
+
+/** @type {Object} */
+chrome.cast.media = {};
+
+/** @constructor */
+chrome.cast.media.Media = function() {
+ /** @type {number} */
+ this.mediaSessionId = 0;
+};
+
+/** @constructor */
+chrome.cast.Session = function() {
+ /** @type {Array.<chrome.cast.media.Media>} */
+ this.media = [];
+
+ /** @type {string} */
+ this.sessionId = '';
+};
+
+/**
+ * @param {string} namespace
+ * @param {Object} message
+ * @param {function():void} successCallback
+ * @param {function(chrome.cast.Error):void} errorCallback
+ */
+chrome.cast.Session.prototype.sendMessage =
+ function(namespace, message, successCallback, errorCallback) {};
+
+/**
+ * @param {function(chrome.cast.media.Media):void} listener
+ */
+chrome.cast.Session.prototype.addMediaListener = function(listener) {};
+
+/**
+ * @param {function(boolean):void} listener
+ */
+chrome.cast.Session.prototype.addUpdateListener = function(listener) {};
+
+/**
+ * @param {string} namespace
+ * @param {function(chrome.cast.media.Media):void} listener
+ */
+chrome.cast.Session.prototype.addMessageListener =
+ function(namespace, listener){};
+
+/**
+ * @param {function():void} successCallback
+ * @param {function(chrome.cast.Error):void} errorCallback
+ */
+chrome.cast.Session.prototype.stop =
+ function(successCallback, errorCallback) {};
+
+/**
+ * @constructor
+ * @param {string} applicationID
+ */
+chrome.cast.SessionRequest = function(applicationID) {};
+
+/**
+ * @constructor
+ * @param {chrome.cast.SessionRequest} sessionRequest
+ * @param {function(chrome.cast.Session):void} sessionListener
+ * @param {function(chrome.cast.ReceiverAvailability):void} receiverListener
+ * @param {chrome.cast.AutoJoinPolicy=} opt_autoJoinPolicy
+ * @param {chrome.cast.DefaultActionPolicy=} opt_defaultActionPolicy
+ */
+chrome.cast.ApiConfig = function(sessionRequest,
+ sessionListener,
+ receiverListener,
+ opt_autoJoinPolicy,
+ opt_defaultActionPolicy) {};
+
+/**
+ * @param {chrome.cast.ApiConfig} apiConfig
+ * @param {function():void} onInitSuccess
+ * @param {function(chrome.cast.Error):void} onInitError
+ */
+chrome.cast.initialize =
+ function(apiConfig, onInitSuccess, onInitError) {};
+
+/**
+ * @param {function(chrome.cast.Session):void} successCallback
+ * @param {function(chrome.cast.Error):void} errorCallback
+ */
+chrome.cast.requestSession =
+ function(successCallback, errorCallback) {};
+
+/** @type {Object} */
+chrome.sockets = {};
+
+/** @type {Object} */
+chrome.sockets.tcp = {};
+
+/** @constructor */
+chrome.sockets.tcp.CreateInfo = function() {
+ /** @type {number} */
+ this.socketId = 0;
+}
+
+/**
+ * @param {Object} properties
+ * @param {function(chrome.sockets.tcp.CreateInfo):void} callback
+ */
+chrome.sockets.tcp.create = function(properties, callback) {};
+
+
+/** @constructor */
+chrome.sockets.tcp.ConnectInfo = function() {
+ /** @type {number} */
+ this.result = 0;
+}
+
+/**
+ * @param {number} socketId
+ * @param {string} peerAddress
+ * @param {number} peerPort
+ * @param {function(chrome.sockets.tcp.ConnectInfo):void} callback
+ */
+chrome.sockets.tcp.connect =
+ function(socketId, peerAddress, peerPort, callback) {};
+
+
+/** @constructor */
+chrome.sockets.tcp.SendInfo = function() {
+ /** @type {number} */
+ this.resultCode = 0;
+
+ /** @type {number} */
+ this.bytesSent = 0;
+}
+
+/**
+ * @param {number} socketId
+ * @param {ArrayBuffer} data
+ * @param {function(chrome.sockets.tcp.SendInfo):void} callback
+ */
+chrome.sockets.tcp.send = function(socketId, data, callback) {};
+
+
+/**
+ * @param {number} socketId
+ */
+chrome.sockets.tcp.close = function(socketId) {};
+
+/**
+ * @param {number} socketId
+ * @param {Object} options
+ * @param {function(number):void} callback
+ */
+chrome.sockets.tcp.secure = function(socketId, options, callback) {};
+
+/** @constructor */
+chrome.sockets.tcp.ReceiveInfo = function() {
+ /** @type {number} */
+ this.socketId = 0;
+
+ /** @type {ArrayBuffer} */
+ this.data = null;
+}
+
+/** @type {chrome.Event} */
+chrome.sockets.tcp.onReceive = null;
+
+/** @constructor */
+chrome.sockets.tcp.ReceiveErrorInfo = function() {
+ /** @type {number} */
+ this.socketId = 0;
+
+ /** @type {number} */
+ this.resultCode = 0;
+}
+
+/** @type {chrome.Event} */
+chrome.sockets.tcp.onReceiveError = null;
+
+/** @type {Object} */
+chrome.socket = {};
+
+/** @constructor */
+chrome.socket.CreateInfo = function() {
+ /** @type {number} */
+ this.socketId = 0;
+}
+
+/**
+ * @param {string} socketType
+ * @param {Object} options
+ * @param {function(chrome.socket.CreateInfo):void} callback
+ */
+chrome.socket.create = function(socketType, options, callback) {};
+
+/**
+ * @param {number} socketId
+ * @param {string} hostname
+ * @param {number} port
+ * @param {function(number):void} callback
+ */
+chrome.socket.connect =
+ function(socketId, hostname, port, callback) {};
+
+/** @constructor */
+chrome.socket.WriteInfo = function() {
+ /** @type {number} */
+ this.bytesWritten = 0;
+}
+
+/**
+ * @param {number} socketId
+ * @param {ArrayBuffer} data
+ * @param {function(chrome.socket.WriteInfo):void} callback
+ */
+chrome.socket.write = function(socketId, data, callback) {};
+
+/** @constructor */
+chrome.socket.ReadInfo = function() {
+ /** @type {number} */
+ this.resultCode = 0;
+
+ /** @type {ArrayBuffer} */
+ this.data = null;
+}
+
+/**
+ * @param {number} socketId
+ * @param {function(chrome.socket.ReadInfo):void} callback
+ */
+chrome.socket.read = function(socketId, callback) {};
+
+/**
+ * @param {number} socketId
+ */
+chrome.socket.destroy = function(socketId) {};
+
+/**
+ * @param {number} socketId
+ * @param {Object} options
+ * @param {function(number):void} callback
+ */
+chrome.socket.secure = function(socketId, options, callback) {};