| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 /** | 238 /** |
| 239 * Set of capabilities for which hasCapability_() can be used to test. | 239 * Set of capabilities for which hasCapability_() can be used to test. |
| 240 * | 240 * |
| 241 * @enum {string} | 241 * @enum {string} |
| 242 */ | 242 */ |
| 243 remoting.ClientSession.Capability = { | 243 remoting.ClientSession.Capability = { |
| 244 // When enabled this capability causes the client to send its screen | 244 // When enabled this capability causes the client to send its screen |
| 245 // resolution to the host once connection has been established. See | 245 // resolution to the host once connection has been established. See |
| 246 // this.plugin.notifyClientResolution(). | 246 // this.plugin.notifyClientResolution(). |
| 247 SEND_INITIAL_RESOLUTION: 'sendInitialResolution' | 247 SEND_INITIAL_RESOLUTION: 'sendInitialResolution', |
| 248 RATE_LIMIT_RESIZE_REQUESTS: 'rateLimitResizeRequests' |
| 248 }; | 249 }; |
| 249 | 250 |
| 250 /** | 251 /** |
| 251 * The set of capabilities negotiated between the client and host. | 252 * The set of capabilities negotiated between the client and host. |
| 252 * @type {Array.<string>} | 253 * @type {Array.<string>} |
| 253 * @private | 254 * @private |
| 254 */ | 255 */ |
| 255 remoting.ClientSession.prototype.capabilities_ = null; | 256 remoting.ClientSession.prototype.capabilities_ = null; |
| 256 | 257 |
| 257 /** | 258 /** |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 this.updateDimensions(); | 874 this.updateDimensions(); |
| 874 | 875 |
| 875 if (this.notifyClientResolutionTimer_) { | 876 if (this.notifyClientResolutionTimer_) { |
| 876 window.clearTimeout(this.notifyClientResolutionTimer_); | 877 window.clearTimeout(this.notifyClientResolutionTimer_); |
| 877 this.notifyClientResolutionTimer_ = null; | 878 this.notifyClientResolutionTimer_ = null; |
| 878 } | 879 } |
| 879 | 880 |
| 880 // Defer notifying the host of the change until the window stops resizing, to | 881 // Defer notifying the host of the change until the window stops resizing, to |
| 881 // avoid overloading the control channel with notifications. | 882 // avoid overloading the control channel with notifications. |
| 882 if (this.resizeToClient_) { | 883 if (this.resizeToClient_) { |
| 884 var kResizeRateLimitMs = 1000; |
| 885 if (this.hasCapability_( |
| 886 remoting.ClientSession.Capability.RATE_LIMIT_RESIZE_REQUESTS)) { |
| 887 kResizeRateLimitMs = 250; |
| 888 } |
| 883 this.notifyClientResolutionTimer_ = window.setTimeout( | 889 this.notifyClientResolutionTimer_ = window.setTimeout( |
| 884 this.plugin.notifyClientResolution.bind(this.plugin, | 890 this.plugin.notifyClientResolution.bind(this.plugin, |
| 885 window.innerWidth, | 891 window.innerWidth, |
| 886 window.innerHeight, | 892 window.innerHeight, |
| 887 window.devicePixelRatio), | 893 window.devicePixelRatio), |
| 888 1000); | 894 kResizeRateLimitMs); |
| 889 } | 895 } |
| 890 | 896 |
| 891 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize | 897 // If bump-scrolling is enabled, adjust the plugin margins to fully utilize |
| 892 // the new window area. | 898 // the new window area. |
| 893 this.scroll_(0, 0); | 899 this.scroll_(0, 0); |
| 894 }; | 900 }; |
| 895 | 901 |
| 896 /** | 902 /** |
| 897 * Requests that the host pause or resume video updates. | 903 * Requests that the host pause or resume video updates. |
| 898 * | 904 * |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 var lateAdjustment = 1 + (now - expected) / timeout; | 1210 var lateAdjustment = 1 + (now - expected) / timeout; |
| 1205 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { | 1211 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { |
| 1206 that.bumpScrollTimer_ = window.setTimeout( | 1212 that.bumpScrollTimer_ = window.setTimeout( |
| 1207 function() { repeatScroll(now + timeout); }, | 1213 function() { repeatScroll(now + timeout); }, |
| 1208 timeout); | 1214 timeout); |
| 1209 } | 1215 } |
| 1210 }; | 1216 }; |
| 1211 repeatScroll(new Date().getTime()); | 1217 repeatScroll(new Date().getTime()); |
| 1212 } | 1218 } |
| 1213 }; | 1219 }; |
| OLD | NEW |