Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / remoting / webapp / js_proto / chrome_proto.js
index 7210df5..7dbc965 100644 (file)
@@ -9,6 +9,14 @@
 /** @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 = {};
@@ -31,7 +39,12 @@ chrome.app.window = {
   /**
    * @return {AppWindow}
    */
-  current: function() {}
+  current: function() {},
+  /**
+   * @param {string} id
+   * @param {function()=} opt_callback
+   */
+  get: function(id, opt_callback) {}
 };
 
 
@@ -42,32 +55,80 @@ chrome.runtime = {
     /** @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
@@ -88,6 +149,11 @@ chrome.i18n = {};
  */
 chrome.i18n.getMessage = function(messageName, opt_args) {};
 
+/**
+ * @return {string}
+ */
+chrome.i18n.getUILanguage = function() {};
+
 
 /** @type {Object} */
 chrome.storage = {};
@@ -134,7 +200,7 @@ chrome.Storage.prototype.clear = function(opt_callback) {};
  * src/chrome/common/extensions/api/context_menus.json
  */
 chrome.contextMenus = {};
-/** @type {ChromeEvent} */
+/** @type {chrome.Event} */
 chrome.contextMenus.onClicked;
 /**
  * @param {!Object} createProperties
@@ -184,6 +250,20 @@ OnClickData.prototype.checked;
 
 
 /** @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
@@ -192,32 +272,16 @@ chrome.identity = {
   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 = {
@@ -235,10 +299,29 @@ 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() {
@@ -246,16 +329,18 @@ 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() {
@@ -270,12 +355,35 @@ var AppWindow = 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
@@ -296,6 +404,18 @@ var LaunchData = function() {
 };
 
 /** @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;
@@ -310,3 +430,278 @@ function ClientRect() {
   /** @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) {};