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 * Class handling user-facing aspects of the client session. | 7 * Class handling user-facing aspects of the client session. |
8 */ | 8 */ |
9 | 9 |
10 'use strict'; | 10 'use strict'; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 img.style.left = event.x + 'px'; | 101 img.style.left = event.x + 'px'; |
102 }; | 102 }; |
103 | 103 |
104 /** @type {number?} @private */ | 104 /** @type {number?} @private */ |
105 this.bumpScrollTimer_ = null; | 105 this.bumpScrollTimer_ = null; |
106 | 106 |
107 // Bump-scroll test variables. Override to use a fake value for the width | 107 // Bump-scroll test variables. Override to use a fake value for the width |
108 // and height of the client plugin so that bump-scrolling can be tested | 108 // and height of the client plugin so that bump-scrolling can be tested |
109 // without relying on the actual size of the host desktop. | 109 // without relying on the actual size of the host desktop. |
110 /** @type {number} @private */ | 110 /** @type {number} @private */ |
111 this.pluginWidthForBumpScrollTesting = 0; | 111 this.pluginWidthForBumpScrollTesting_ = 0; |
112 /** @type {number} @private */ | 112 /** @type {number} @private */ |
113 this.pluginHeightForBumpScrollTesting = 0; | 113 this.pluginHeightForBumpScrollTesting_ = 0; |
114 | 114 |
115 /** @type {remoting.VideoFrameRecorder} @private */ | 115 /** @type {remoting.VideoFrameRecorder} @private */ |
116 this.videoFrameRecorder_ = null; | 116 this.videoFrameRecorder_ = null; |
117 }; | 117 }; |
118 | 118 |
119 base.extend(remoting.DesktopConnectedView, base.EventSourceImpl); | 119 base.extend(remoting.DesktopConnectedView, base.EventSourceImpl); |
120 | 120 |
121 /** @enum {string} */ | 121 /** @enum {string} */ |
122 remoting.DesktopConnectedView.Events = { | 122 remoting.DesktopConnectedView.Events = { |
123 bumpScrollStarted: 'bumpScrollStarted', | 123 bumpScrollStarted: 'bumpScrollStarted', |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 * borders used by the latter. | 181 * borders used by the latter. |
182 * TODO: make private | 182 * TODO: make private |
183 */ | 183 */ |
184 remoting.DesktopConnectedView.prototype.getClientArea_ = function() { | 184 remoting.DesktopConnectedView.prototype.getClientArea_ = function() { |
185 return remoting.windowFrame ? | 185 return remoting.windowFrame ? |
186 remoting.windowFrame.getClientArea() : | 186 remoting.windowFrame.getClientArea() : |
187 { 'width': window.innerWidth, 'height': window.innerHeight }; | 187 { 'width': window.innerWidth, 'height': window.innerHeight }; |
188 }; | 188 }; |
189 | 189 |
190 /** | 190 /** |
| 191 * @param {number} width |
| 192 * @param {number} height |
| 193 */ |
| 194 remoting.DesktopConnectedView.prototype.setPluginSizeForBumpScrollTesting = |
| 195 function(width, height) { |
| 196 this.pluginWidthForBumpScrollTesting_ = width; |
| 197 this.pluginHeightForBumpScrollTesting_ = height; |
| 198 } |
| 199 |
| 200 /** |
191 * Notifies the host of the client's current dimensions and DPI. | 201 * Notifies the host of the client's current dimensions and DPI. |
192 * Also takes into account per-host scaling factor, if configured. | 202 * Also takes into account per-host scaling factor, if configured. |
193 * TODO: private | 203 * TODO: private |
194 */ | 204 */ |
195 remoting.DesktopConnectedView.prototype.notifyClientResolution_ = function() { | 205 remoting.DesktopConnectedView.prototype.notifyClientResolution_ = function() { |
196 var clientArea = this.getClientArea_(); | 206 var clientArea = this.getClientArea_(); |
197 this.plugin_.notifyClientResolution(clientArea.width * this.desktopScale_, | 207 this.plugin_.notifyClientResolution(clientArea.width * this.desktopScale_, |
198 clientArea.height * this.desktopScale_, | 208 clientArea.height * this.desktopScale_, |
199 window.devicePixelRatio); | 209 window.devicePixelRatio); |
200 }; | 210 }; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
711 stop.stop = (result == 0 || result == minMargin); | 721 stop.stop = (result == 0 || result == minMargin); |
712 return result + 'px'; | 722 return result + 'px'; |
713 }; | 723 }; |
714 | 724 |
715 var plugin = this.plugin_.element(); | 725 var plugin = this.plugin_.element(); |
716 var style = this.container_.style; | 726 var style = this.container_.style; |
717 | 727 |
718 var stopX = { stop: false }; | 728 var stopX = { stop: false }; |
719 var clientArea = this.getClientArea_(); | 729 var clientArea = this.getClientArea_(); |
720 style.marginLeft = adjustMargin(style.marginLeft, dx, clientArea.width, | 730 style.marginLeft = adjustMargin(style.marginLeft, dx, clientArea.width, |
721 this.pluginWidthForBumpScrollTesting || plugin.clientWidth, stopX); | 731 this.pluginWidthForBumpScrollTesting_ || plugin.clientWidth, stopX); |
722 | 732 |
723 var stopY = { stop: false }; | 733 var stopY = { stop: false }; |
724 style.marginTop = adjustMargin( | 734 style.marginTop = adjustMargin( |
725 style.marginTop, dy, clientArea.height, | 735 style.marginTop, dy, clientArea.height, |
726 this.pluginHeightForBumpScrollTesting || plugin.clientHeight, stopY); | 736 this.pluginHeightForBumpScrollTesting_ || plugin.clientHeight, stopY); |
727 return stopX.stop && stopY.stop; | 737 return stopX.stop && stopY.stop; |
728 }; | 738 }; |
729 | 739 |
730 /** | 740 /** |
731 * Refreshes the plugin's dimensions, taking into account the sizes of the | 741 * Refreshes the plugin's dimensions, taking into account the sizes of the |
732 * remote desktop and client window, and the current scale-to-fit setting. | 742 * remote desktop and client window, and the current scale-to-fit setting. |
733 * | 743 * |
734 * @return {void} Nothing. | 744 * @return {void} Nothing. |
735 */ | 745 */ |
736 remoting.DesktopConnectedView.prototype.updateDimensions = function() { | 746 remoting.DesktopConnectedView.prototype.updateDimensions = function() { |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 * @param {Object} message The parsed extension message data. | 1098 * @param {Object} message The parsed extension message data. |
1089 * @return {boolean} True if the message was recognized, false otherwise. | 1099 * @return {boolean} True if the message was recognized, false otherwise. |
1090 */ | 1100 */ |
1091 remoting.DesktopConnectedView.prototype.handleExtensionMessage = | 1101 remoting.DesktopConnectedView.prototype.handleExtensionMessage = |
1092 function(type, message) { | 1102 function(type, message) { |
1093 if (this.videoFrameRecorder_) { | 1103 if (this.videoFrameRecorder_) { |
1094 return this.videoFrameRecorder_.handleMessage(type, message); | 1104 return this.videoFrameRecorder_.handleMessage(type, message); |
1095 } | 1105 } |
1096 return false; | 1106 return false; |
1097 }; | 1107 }; |
OLD | NEW |