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 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1324 * @param {number} dx The amount by which to scroll horizontally. Positive to | 1324 * @param {number} dx The amount by which to scroll horizontally. Positive to |
1325 * scroll right; negative to scroll left. | 1325 * scroll right; negative to scroll left. |
1326 * @param {number} dy The amount by which to scroll vertically. Positive to | 1326 * @param {number} dy The amount by which to scroll vertically. Positive to |
1327 * scroll down; negative to scroll up. | 1327 * scroll down; negative to scroll up. |
1328 * @return {boolean} True if the requested scroll had no effect because both | 1328 * @return {boolean} True if the requested scroll had no effect because both |
1329 * vertical and horizontal edges of the screen have been reached. | 1329 * vertical and horizontal edges of the screen have been reached. |
1330 * @private | 1330 * @private |
1331 */ | 1331 */ |
1332 remoting.ClientSession.prototype.scroll_ = function(dx, dy) { | 1332 remoting.ClientSession.prototype.scroll_ = function(dx, dy) { |
1333 var plugin = this.plugin_.element(); | 1333 var plugin = this.plugin_.element(); |
1334 var style = plugin.style; | 1334 var style = this.container_.style; |
Sergey Ulanov
2014/09/10 22:07:42
nit: move these below where they are used.
| |
1335 | 1335 |
1336 /** | 1336 /** |
1337 * Helper function for x- and y-scrolling | 1337 * Helper function for x- and y-scrolling |
1338 * @param {number|string} curr The current margin, eg. "10px". | 1338 * @param {number|string} curr The current margin, eg. "10px". |
1339 * @param {number} delta The requested scroll amount. | 1339 * @param {number} delta The requested scroll amount. |
1340 * @param {number} windowBound The size of the window, in pixels. | 1340 * @param {number} windowBound The size of the window, in pixels. |
1341 * @param {number} pluginBound The size of the plugin, in pixels. | 1341 * @param {number} pluginBound The size of the plugin, in pixels. |
1342 * @param {{stop: boolean}} stop Reference parameter used to indicate when | 1342 * @param {{stop: boolean}} stop Reference parameter used to indicate when |
1343 * the scroll has reached one of the edges and can be stopped in that | 1343 * the scroll has reached one of the edges and can be stopped in that |
1344 * direction. | 1344 * direction. |
(...skipping 14 matching lines...) Expand all Loading... | |
1359 | 1359 |
1360 var stopY = { stop: false }; | 1360 var stopY = { stop: false }; |
1361 style.marginTop = adjustMargin( | 1361 style.marginTop = adjustMargin( |
1362 style.marginTop, dy, clientArea.height, | 1362 style.marginTop, dy, clientArea.height, |
1363 this.pluginHeightForBumpScrollTesting || plugin.clientHeight, stopY); | 1363 this.pluginHeightForBumpScrollTesting || plugin.clientHeight, stopY); |
1364 return stopX.stop && stopY.stop; | 1364 return stopX.stop && stopY.stop; |
1365 }; | 1365 }; |
1366 | 1366 |
1367 remoting.ClientSession.prototype.resetScroll_ = function() { | 1367 remoting.ClientSession.prototype.resetScroll_ = function() { |
1368 if (this.plugin_) { | 1368 if (this.plugin_) { |
1369 var plugin = this.plugin_.element(); | 1369 var plugin = this.plugin_.element(); |
Sergey Ulanov
2014/09/10 22:07:42
This line can be removed now and also the if() abo
| |
1370 plugin.style.marginTop = '0px'; | 1370 this.container_.style.marginTop = '0px'; |
1371 plugin.style.marginLeft = '0px'; | 1371 this.container_.style.marginLeft = '0px'; |
1372 } | 1372 } |
1373 }; | 1373 }; |
1374 | 1374 |
1375 /** | 1375 /** |
1376 * Enable or disable bump-scrolling. When disabling bump scrolling, also reset | 1376 * Enable or disable bump-scrolling. When disabling bump scrolling, also reset |
1377 * the scroll offsets to (0, 0). | 1377 * the scroll offsets to (0, 0). |
1378 * @private | 1378 * @private |
1379 * @param {boolean} enable True to enable bump-scrolling, false to disable it. | 1379 * @param {boolean} enable True to enable bump-scrolling, false to disable it. |
1380 */ | 1380 */ |
1381 remoting.ClientSession.prototype.enableBumpScroll_ = function(enable) { | 1381 remoting.ClientSession.prototype.enableBumpScroll_ = function(enable) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1525 this.mouseCursorOverlay_.style.marginLeft = '-' + hotspotX + 'px'; | 1525 this.mouseCursorOverlay_.style.marginLeft = '-' + hotspotX + 'px'; |
1526 this.mouseCursorOverlay_.style.marginTop = '-' + hotspotY + 'px'; | 1526 this.mouseCursorOverlay_.style.marginTop = '-' + hotspotY + 'px'; |
1527 this.mouseCursorOverlay_.src = url; | 1527 this.mouseCursorOverlay_.src = url; |
1528 } | 1528 } |
1529 }; | 1529 }; |
1530 | 1530 |
1531 /** | 1531 /** |
1532 * @return {{top: number, left:number}} The top-left corner of the plugin. | 1532 * @return {{top: number, left:number}} The top-left corner of the plugin. |
1533 */ | 1533 */ |
1534 remoting.ClientSession.prototype.getPluginPositionForTesting = function() { | 1534 remoting.ClientSession.prototype.getPluginPositionForTesting = function() { |
1535 var plugin = this.plugin_.element(); | 1535 var style = this.container_.style; |
1536 var style = plugin.style; | |
1537 return { | 1536 return { |
1538 top: parseFloat(style.marginTop), | 1537 top: parseFloat(style.marginTop), |
1539 left: parseFloat(style.marginLeft) | 1538 left: parseFloat(style.marginLeft) |
1540 }; | 1539 }; |
1541 }; | 1540 }; |
1542 | 1541 |
1543 /** | 1542 /** |
1544 * Send a Cast extension message to the host. | 1543 * Send a Cast extension message to the host. |
1545 * @param {Object} data The cast message data. | 1544 * @param {Object} data The cast message data. |
1546 */ | 1545 */ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1613 * @param {string} data Contents of the extension message. | 1612 * @param {string} data Contents of the extension message. |
1614 * @return {boolean} True if the message was recognized, false otherwise. | 1613 * @return {boolean} True if the message was recognized, false otherwise. |
1615 */ | 1614 */ |
1616 remoting.ClientSession.prototype.handleExtensionMessage = | 1615 remoting.ClientSession.prototype.handleExtensionMessage = |
1617 function(type, data) { | 1616 function(type, data) { |
1618 if (this.videoFrameRecorder_) { | 1617 if (this.videoFrameRecorder_) { |
1619 return this.videoFrameRecorder_.handleMessage(type, data); | 1618 return this.videoFrameRecorder_.handleMessage(type, data); |
1620 } | 1619 } |
1621 return false; | 1620 return false; |
1622 } | 1621 } |
OLD | NEW |