Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview | 6 * @fileoverview |
| 7 * Class handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
| 8 * | 8 * |
| 9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
| 10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 remoting.ClientPlugin.Feature.HIGH_QUALITY_SCALING)); | 296 remoting.ClientPlugin.Feature.HIGH_QUALITY_SCALING)); |
| 297 | 297 |
| 298 /** @param {string} msg The IQ stanza to send. */ | 298 /** @param {string} msg The IQ stanza to send. */ |
| 299 this.plugin.onOutgoingIqHandler = this.sendIq_.bind(this); | 299 this.plugin.onOutgoingIqHandler = this.sendIq_.bind(this); |
| 300 /** @param {string} msg The message to log. */ | 300 /** @param {string} msg The message to log. */ |
| 301 this.plugin.onDebugMessageHandler = function(msg) { | 301 this.plugin.onDebugMessageHandler = function(msg) { |
| 302 console.log('plugin: ' + msg); | 302 console.log('plugin: ' + msg); |
| 303 }; | 303 }; |
| 304 | 304 |
| 305 this.plugin.onConnectionStatusUpdateHandler = | 305 this.plugin.onConnectionStatusUpdateHandler = |
| 306 this.connectionStatusUpdateCallback.bind(this); | 306 this.onConnectionStatusUpdate_.bind(this); |
| 307 this.plugin.onConnectionInactiveHandler = | |
| 308 this.onConnectionInactive_.bind(this); | |
| 307 this.plugin.onDesktopSizeUpdateHandler = | 309 this.plugin.onDesktopSizeUpdateHandler = |
| 308 this.onDesktopSizeChanged_.bind(this); | 310 this.onDesktopSizeChanged_.bind(this); |
| 309 | 311 |
| 310 this.connectPluginToWcs_(oauth2AccessToken); | 312 this.connectPluginToWcs_(oauth2AccessToken); |
| 311 }; | 313 }; |
| 312 | 314 |
| 313 /** | 315 /** |
| 314 * Deletes the <embed> element from the container, without sending a | 316 * Deletes the <embed> element from the container, without sending a |
| 315 * session_terminate request. This is to be called when the session was | 317 * session_terminate request. This is to be called when the session was |
| 316 * disconnected by the Host. | 318 * disconnected by the Host. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 this.plugin.connect(this.hostJid, this.hostPublicKey, this.clientJid, | 475 this.plugin.connect(this.hostJid, this.hostPublicKey, this.clientJid, |
| 474 this.sharedSecret, this.authenticationMethods, | 476 this.sharedSecret, this.authenticationMethods, |
| 475 this.authenticationTag); | 477 this.authenticationTag); |
| 476 }; | 478 }; |
| 477 | 479 |
| 478 /** | 480 /** |
| 479 * Callback that the plugin invokes to indicate that the connection | 481 * Callback that the plugin invokes to indicate that the connection |
| 480 * status has changed. | 482 * status has changed. |
| 481 * | 483 * |
| 482 * @param {number} status The plugin's status. | 484 * @param {number} status The plugin's status. |
| 483 * @param {number} error The plugin's error state, if any. | 485 * @param {number} error The plugin's error state, if any. |
|
Jamie
2012/07/12 01:46:42
Add @private if this is a private method, or remov
Sergey Ulanov
2012/07/13 20:42:50
Done.
| |
| 484 */ | 486 */ |
| 485 remoting.ClientSession.prototype.connectionStatusUpdateCallback = | 487 remoting.ClientSession.prototype.onConnectionStatusUpdate_ = |
| 486 function(status, error) { | 488 function(status, error) { |
| 487 if (status == remoting.ClientSession.State.CONNECTED) { | 489 if (status == remoting.ClientSession.State.CONNECTED) { |
| 488 this.onDesktopSizeChanged_(); | 490 this.onDesktopSizeChanged_(); |
| 489 } else if (status == remoting.ClientSession.State.FAILED) { | 491 } else if (status == remoting.ClientSession.State.FAILED) { |
| 490 this.error = /** @type {remoting.ClientSession.ConnectionError} */ (error); | 492 this.error = /** @type {remoting.ClientSession.ConnectionError} */ (error); |
| 491 } | 493 } |
| 492 this.setState_(/** @type {remoting.ClientSession.State} */ (status)); | 494 this.setState_(/** @type {remoting.ClientSession.State} */ (status)); |
| 493 }; | 495 }; |
| 494 | 496 |
| 495 /** | 497 /** |
| 498 * Callback that the plugin invokes to indicate when the connection is | |
| 499 * inactive. | |
| 500 * | |
| 501 * @param {boolean} inactive True if the connection is inactive. | |
|
Jamie
2012/07/12 01:46:42
Add @private or remove the underscore.
Sergey Ulanov
2012/07/13 20:42:50
Done.
| |
| 502 */ | |
| 503 remoting.ClientSession.prototype.onConnectionInactive_ = | |
| 504 function(inactive) { | |
| 505 if (inactive) { | |
| 506 this.plugin.element().classList.add("session-client-inactive"); | |
| 507 } else { | |
| 508 this.plugin.element().classList.remove("session-client-inactive"); | |
| 509 } | |
| 510 } | |
| 511 | |
| 512 /** | |
| 496 * @private | 513 * @private |
| 497 * @param {remoting.ClientSession.State} newState The new state for the session. | 514 * @param {remoting.ClientSession.State} newState The new state for the session. |
| 498 * @return {void} Nothing. | 515 * @return {void} Nothing. |
| 499 */ | 516 */ |
| 500 remoting.ClientSession.prototype.setState_ = function(newState) { | 517 remoting.ClientSession.prototype.setState_ = function(newState) { |
| 501 var oldState = this.state; | 518 var oldState = this.state; |
| 502 this.state = newState; | 519 this.state = newState; |
| 503 if (this.onStateChange) { | 520 if (this.onStateChange) { |
| 504 this.onStateChange(oldState, newState); | 521 this.onStateChange(oldState, newState); |
| 505 } | 522 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 770 var lateAdjustment = 1 + (now - expected) / timeout; | 787 var lateAdjustment = 1 + (now - expected) / timeout; |
| 771 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { | 788 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { |
| 772 that.bumpScrollTimer_ = window.setTimeout( | 789 that.bumpScrollTimer_ = window.setTimeout( |
| 773 function() { repeatScroll(now + timeout); }, | 790 function() { repeatScroll(now + timeout); }, |
| 774 timeout); | 791 timeout); |
| 775 } | 792 } |
| 776 }; | 793 }; |
| 777 repeatScroll(new Date().getTime()); | 794 repeatScroll(new Date().getTime()); |
| 778 } | 795 } |
| 779 }; | 796 }; |
| OLD | NEW |