diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-23 05:37:08 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-23 05:37:08 +0000 |
commit | c8978566fa97625fa58026cc8219b1c6e001e35b (patch) | |
tree | ba3706f2ac3a81b602a344440b35c6b1869ca701 /remoting/webapp/wcs_sandbox_container.js | |
parent | e669bd4e3c5278471db78d63e7d087e64c2e2a32 (diff) | |
download | chromium_src-c8978566fa97625fa58026cc8219b1c6e001e35b.zip chromium_src-c8978566fa97625fa58026cc8219b1c6e001e35b.tar.gz chromium_src-c8978566fa97625fa58026cc8219b1c6e001e35b.tar.bz2 |
Cleanups in remoting.ClientSession
1. remoting.Error is used now to return errors from remoting.ClientSession.
2. Hid ClientSession members that were previously exposed.
3. Reordered parameters in the constructor
Review URL: https://chromiumcodereview.appspot.com/22926019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/wcs_sandbox_container.js')
-rw-r--r-- | remoting/webapp/wcs_sandbox_container.js | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/remoting/webapp/wcs_sandbox_container.js b/remoting/webapp/wcs_sandbox_container.js index 6eaac66..04260a7 100644 --- a/remoting/webapp/wcs_sandbox_container.js +++ b/remoting/webapp/wcs_sandbox_container.js @@ -20,14 +20,19 @@ var remoting = remoting || {}; * @constructor */ remoting.WcsSandboxContainer = function(sandbox) { + /** @private */ this.sandbox_ = sandbox; - /** @type {?function(string):void} */ + /** @type {?function(string):void} + * @private */ this.onLocalJid_ = null; - /** @type {?function(remoting.Error):void} */ - this.onError_ = null; - /** @type {?function(string):void} */ + /** @type {function(remoting.Error):void} + * @private */ + this.onError_ = function(error) {}; + /** @type {?function(string):void} + * @private */ this.onIq_ = null; - /** @type {Object.<number, XMLHttpRequest>} */ + /** @type {Object.<number, XMLHttpRequest>} + * @private */ this.pendingXhrs_ = {}; window.addEventListener('message', this.onMessage_.bind(this), false); @@ -52,7 +57,7 @@ remoting.WcsSandboxContainer.prototype.setOnLocalJid = function(onLocalJid) { }; /** - * @param {?function(remoting.Error):void} onError Callback invoked if the WCS + * @param {function(remoting.Error):void} onError Callback invoked if the WCS * code cannot be loaded. * @return {void} Nothing. */ @@ -103,14 +108,13 @@ remoting.WcsSandboxContainer.prototype.onMessage_ = function(event) { case 'onLocalJid': /** @type {string} */ - var clientJid = event.data['clientJid']; - if (clientJid === undefined) { - console.error('onReady: missing client JID'); + var localJid = event.data['localJid']; + if (localJid === undefined) { + console.error('onReady: missing localJid'); break; } - if (this.onLocalJid_) { - this.onLocalJid_(clientJid); - } + if (this.onLocalJid_) + this.onLocalJid_(localJid); break; case 'onError': @@ -250,4 +254,4 @@ remoting.WcsSandboxContainer.prototype.onReadyStateChange_ = function(id) { } /** @type {remoting.WcsSandboxContainer} */ -remoting.wcsSandbox = null;
\ No newline at end of file +remoting.wcsSandbox = null; |