| 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * Set of capabilities for which hasCapability_() can be used to test. | 249 * Set of capabilities for which hasCapability_() can be used to test. |
| 250 * | 250 * |
| 251 * @enum {string} | 251 * @enum {string} |
| 252 */ | 252 */ |
| 253 remoting.ClientSession.Capability = { | 253 remoting.ClientSession.Capability = { |
| 254 // When enabled this capability causes the client to send its screen | 254 // When enabled this capability causes the client to send its screen |
| 255 // resolution to the host once connection has been established. See | 255 // resolution to the host once connection has been established. See |
| 256 // this.plugin.notifyClientResolution(). | 256 // this.plugin.notifyClientResolution(). |
| 257 SEND_INITIAL_RESOLUTION: 'sendInitialResolution' | 257 SEND_INITIAL_RESOLUTION: 'sendInitialResolution', |
| 258 RATE_LIMIT_RESIZE_REQUESTS: 'rateLimitResizeRequests' |
| 258 }; | 259 }; |
| 259 | 260 |
| 260 /** | 261 /** |
| 261 * The set of capabilities negotiated between the client and host. | 262 * The set of capabilities negotiated between the client and host. |
| 262 * @type {Array.<string>} | 263 * @type {Array.<string>} |
| 263 * @private | 264 * @private |
| 264 */ | 265 */ |
| 265 remoting.ClientSession.prototype.capabilities_ = null; | 266 remoting.ClientSession.prototype.capabilities_ = null; |
| 266 | 267 |
| 267 /** | 268 /** |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 this.updateDimensions(); | 884 this.updateDimensions(); |
| 884 | 885 |
| 885 if (this.notifyClientResolutionTimer_) { | 886 if (this.notifyClientResolutionTimer_) { |
| 886 window.clearTimeout(this.notifyClientResolutionTimer_); | 887 window.clearTimeout(this.notifyClientResolutionTimer_); |
| 887 this.notifyClientResolutionTimer_ = null; | 888 this.notifyClientResolutionTimer_ = null; |
| 888 } | 889 } |
| 889 | 890 |
| 890 // Defer notifying the host of the change until the window stops resizing, to | 891 // Defer notifying the host of the change until the window stops resizing, to |
| 891 // avoid overloading the control channel with notifications. | 892 // avoid overloading the control channel with notifications. |
| 892 if (this.resizeToClient_) { | 893 if (this.resizeToClient_) { |
| 894 var kResizeRateLimitMs = 1000; |
| 895 if (this.hasCapability_( |
| 896 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS)) { |
| 897 kResizeRateLimitMs = 250; |
| 898 } |
| 893 this.notifyClientResolutionTimer_ = window.setTimeout( | 899 this.notifyClientResolutionTimer_ = window.setTimeout( |
| 894 this.plugin.notifyClientResolution.bind(this.plugin, | 900 this.plugin.notifyClientResolution.bind(this.plugin, |
| 895 window.innerWidth, | 901 window.innerWidth, |
| 896 window.innerHeight, | 902 window.innerHeight, |
| 897 window.devicePixelRatio), | 903 window.devicePixelRatio), |
| 898 1000); | 904 kResizeRateLimitMs); |
| 899 } | 905 } |
| 900 | 906 |
| 901 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize | 907 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize |
| 902 // the new window area. | 908 // the new window area. |
| 903 this.scroll_(0, 0); | 909 this.scroll_(0, 0); |
| 904 }; | 910 }; |
| 905 | 911 |
| 906 /** | 912 /** |
| 907 * Requests that the host pause or resume video updates. | 913 * Requests that the host pause or resume video updates. |
| 908 * | 914 * |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 var lateAdjustment = 1 + (now - expected) / timeout; | 1233 var lateAdjustment = 1 + (now - expected) / timeout; |
| 1228 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { | 1234 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { |
| 1229 that.bumpScrollTimer_ = window.setTimeout( | 1235 that.bumpScrollTimer_ = window.setTimeout( |
| 1230 function() { repeatScroll(now + timeout); }, | 1236 function() { repeatScroll(now + timeout); }, |
| 1231 timeout); | 1237 timeout); |
| 1232 } | 1238 } |
| 1233 }; | 1239 }; |
| 1234 repeatScroll(new Date().getTime()); | 1240 repeatScroll(new Date().getTime()); |
| 1235 } | 1241 } |
| 1236 }; | 1242 }; |
| OLD | NEW |