| 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 * Implements a basic UX control for a connected app remoting session. | 7 * Implements a basic UX control for a connected app remoting session. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** @suppress {duplicate} */ | 10 /** @suppress {duplicate} */ |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 this.keyboardLayoutsMenu_.setExtensionMessageSender(base.doNothing); | 104 this.keyboardLayoutsMenu_.setExtensionMessageSender(base.doNothing); |
| 105 base.dispose(this.disposables_); | 105 base.dispose(this.disposables_); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 /** | 108 /** |
| 109 * Resize the host to the dimensions of the current window. | 109 * Resize the host to the dimensions of the current window. |
| 110 * @private | 110 * @private |
| 111 */ | 111 */ |
| 112 remoting.AppConnectedView.prototype.resizeHostToClientArea_ = function() { | 112 remoting.AppConnectedView.prototype.resizeHostToClientArea_ = function() { |
| 113 var hostDesktop = this.plugin_.hostDesktop(); | 113 var hostDesktop = this.plugin_.hostDesktop(); |
| 114 var desktopScale = this.host_.options.desktopScale; | 114 var desktopScale = this.host_.options.getDesktopScale(); |
| 115 hostDesktop.resize(window.innerWidth * desktopScale, | 115 hostDesktop.resize(window.innerWidth * desktopScale, |
| 116 window.innerHeight * desktopScale, | 116 window.innerHeight * desktopScale, |
| 117 window.devicePixelRatio); | 117 window.devicePixelRatio); |
| 118 }; | 118 }; |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Adjust the size of the plugin according to the dimensions of the hostDesktop. | 121 * Adjust the size of the plugin according to the dimensions of the hostDesktop. |
| 122 * | 122 * |
| 123 * @param {{width:number, height:number, xDpi:number, yDpi:number}} hostDesktop | 123 * @param {{width:number, height:number, xDpi:number, yDpi:number}} hostDesktop |
| 124 * @private | 124 * @private |
| 125 */ | 125 */ |
| 126 remoting.AppConnectedView.prototype.onDesktopSizeChanged_ = | 126 remoting.AppConnectedView.prototype.onDesktopSizeChanged_ = |
| 127 function(hostDesktop) { | 127 function(hostDesktop) { |
| 128 // The first desktop size change indicates that we can close the loading | 128 // The first desktop size change indicates that we can close the loading |
| 129 // window. | 129 // window. |
| 130 remoting.LoadingWindow.close(); | 130 remoting.LoadingWindow.close(); |
| 131 | 131 |
| 132 var hostSize = { width: hostDesktop.width, height: hostDesktop.height }; | 132 var hostSize = { width: hostDesktop.width, height: hostDesktop.height }; |
| 133 var hostDpi = { x: hostDesktop.xDpi, y: hostDesktop.yDpi }; | 133 var hostDpi = { x: hostDesktop.xDpi, y: hostDesktop.yDpi }; |
| 134 var clientArea = { width: window.innerWidth, height: window.innerHeight }; | 134 var clientArea = { width: window.innerWidth, height: window.innerHeight }; |
| 135 var newSize = remoting.Viewport.choosePluginSize( | 135 var newSize = remoting.Viewport.choosePluginSize( |
| 136 clientArea, window.devicePixelRatio, | 136 clientArea, window.devicePixelRatio, |
| 137 hostSize, hostDpi, this.host_.options.desktopScale, | 137 hostSize, hostDpi, this.host_.options.getDesktopScale(), |
| 138 true /* fullscreen */ , true /* shrinkToFit */ ); | 138 true /* fullscreen */ , true /* shrinkToFit */ ); |
| 139 | 139 |
| 140 this.plugin_.element().style.width = newSize.width + 'px'; | 140 this.plugin_.element().style.width = newSize.width + 'px'; |
| 141 this.plugin_.element().style.height = newSize.height + 'px'; | 141 this.plugin_.element().style.height = newSize.height + 'px'; |
| 142 }; | 142 }; |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * @return {Array<string>} | 145 * @return {Array<string>} |
| 146 * @override {remoting.ProtocolExtension} | 146 * @override {remoting.ProtocolExtension} |
| 147 */ | 147 */ |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { | 268 }).catch(remoting.Error.handler(function(/** remoting.Error */ error) { |
| 269 console.log('Failed to refresh access token: ' + error.toString()); | 269 console.log('Failed to refresh access token: ' + error.toString()); |
| 270 })); | 270 })); |
| 271 }; | 271 }; |
| 272 | 272 |
| 273 // The access token last received from getNewToken. Saved to ensure that we | 273 // The access token last received from getNewToken. Saved to ensure that we |
| 274 // get a fresh token each time. | 274 // get a fresh token each time. |
| 275 var previousToken_ = ''; | 275 var previousToken_ = ''; |
| 276 | 276 |
| 277 })(); | 277 })(); |
| OLD | NEW |