| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * Provides view port management utilities below for a desktop remoting session. | 7 * Provides view port management utilities below for a desktop remoting session. |
| 8 * - Enabling bump scrolling | 8 * - Enabling bump scrolling |
| 9 * - Resizing the viewport to fit the host desktop | 9 * - Resizing the viewport to fit the host desktop |
| 10 * - Resizing the host desktop to fit the client viewport. | 10 * - Resizing the host desktop to fit the client viewport. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * @param {HTMLElement} rootElement The outer element with id=scroller that we | 21 * @param {HTMLElement} rootElement The outer element with id=scroller that we |
| 22 * are showing scrollbars on. | 22 * are showing scrollbars on. |
| 23 * @param {remoting.HostDesktop} hostDesktop | 23 * @param {remoting.HostDesktop} hostDesktop |
| 24 * @param {remoting.HostOptions} hostOptions | 24 * @param {remoting.HostOptions} hostOptions |
| 25 * @param {!remoting.SessionLogger} logger | 25 * @param {!remoting.SessionLogger} logger |
| 26 * | 26 * |
| 27 * @constructor | 27 * @constructor |
| 28 * @implements {base.Disposable} | 28 * @implements {base.Disposable} |
| 29 */ | 29 */ |
| 30 remoting.DesktopViewport = function(rootElement, hostDesktop, hostOptions, | 30 remoting.DesktopViewport = function(rootElement, hostDesktop, hostOptions, |
| 31 logger) { | 31 logger, sendInitialResolution) { |
| 32 /** @private */ | 32 /** @private */ |
| 33 this.rootElement_ = rootElement; | 33 this.rootElement_ = rootElement; |
| 34 /** @private */ | 34 /** @private */ |
| 35 // TODO(kelvinp): Query the container by class name instead of id. | 35 // TODO(kelvinp): Query the container by class name instead of id. |
| 36 this.pluginContainer_ = rootElement.querySelector('#client-container'); | 36 this.pluginContainer_ = rootElement.querySelector('#client-container'); |
| 37 /** @private */ | 37 /** @private */ |
| 38 this.pluginElement_ = rootElement.querySelector('embed'); | 38 this.pluginElement_ = rootElement.querySelector('embed'); |
| 39 /** @private */ | 39 /** @private */ |
| 40 this.hostDesktop_ = hostDesktop; | 40 this.hostDesktop_ = hostDesktop; |
| 41 /** @private */ | 41 /** @private */ |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 /** @private {!remoting.SessionLogger} */ | 54 /** @private {!remoting.SessionLogger} */ |
| 55 this.logger_ = logger; | 55 this.logger_ = logger; |
| 56 /** @private {number?} */ | 56 /** @private {number?} */ |
| 57 this.loggingTimer_ = null; | 57 this.loggingTimer_ = null; |
| 58 | 58 |
| 59 this.eventHooks_ = new base.Disposables( | 59 this.eventHooks_ = new base.Disposables( |
| 60 new base.EventHook( | 60 new base.EventHook( |
| 61 this.hostDesktop_, remoting.HostDesktop.Events.sizeChanged, | 61 this.hostDesktop_, remoting.HostDesktop.Events.sizeChanged, |
| 62 this.onDesktopSizeChanged_.bind(this))); | 62 this.onDesktopSizeChanged_.bind(this))); |
| 63 | 63 |
| 64 if (this.hostOptions_.getResizeToClient()) { | 64 if (this.hostOptions_.getResizeToClient() || sendInitialResolution) { |
| 65 this.resizeHostDesktop_(); | 65 this.resizeHostDesktop_(); |
| 66 } else { | 66 } else { |
| 67 this.onDesktopSizeChanged_(); | 67 this.onDesktopSizeChanged_(); |
| 68 } | 68 } |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 remoting.DesktopViewport.prototype.dispose = function() { | 71 remoting.DesktopViewport.prototype.dispose = function() { |
| 72 base.dispose(this.eventHooks_); | 72 base.dispose(this.eventHooks_); |
| 73 this.eventHooks_ = null; | 73 this.eventHooks_ = null; |
| 74 base.dispose(this.bumpScroller_); | 74 base.dispose(this.bumpScroller_); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 this.loggingTimer_ = window.setTimeout( | 400 this.loggingTimer_ = window.setTimeout( |
| 401 () => { | 401 () => { |
| 402 this.logger_.logScreenResolutions(hostSize, hostDpi, clientPluginSize, | 402 this.logger_.logScreenResolutions(hostSize, hostDpi, clientPluginSize, |
| 403 clientWindowSize, clientDpi, | 403 clientWindowSize, clientDpi, |
| 404 isFullscreen); | 404 isFullscreen); |
| 405 }, | 405 }, |
| 406 kLoggingRateLimitMs); | 406 kLoggingRateLimitMs); |
| 407 }; | 407 }; |
| 408 | 408 |
| 409 }()); | 409 }()); |
| OLD | NEW |