Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: remoting/webapp/client_session.js

Issue 9331003: Improving the decoder pipeline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 * This abstracts a <embed> element and controls the plugin which does the 9 * This abstracts a <embed> element and controls the plugin which does the
10 * actual remoting work. There should be no UI code inside this class. It 10 * actual remoting work. There should be no UI code inside this class. It
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 * 428 *
429 * @return {void} Nothing. 429 * @return {void} Nothing.
430 */ 430 */
431 remoting.ClientSession.prototype.updateDimensions = function() { 431 remoting.ClientSession.prototype.updateDimensions = function() {
432 if (this.plugin.desktopWidth == 0 || 432 if (this.plugin.desktopWidth == 0 ||
433 this.plugin.desktopHeight == 0) 433 this.plugin.desktopHeight == 0)
434 return; 434 return;
435 435
436 var windowWidth = window.innerWidth; 436 var windowWidth = window.innerWidth;
437 var windowHeight = window.innerHeight; 437 var windowHeight = window.innerHeight;
438 var scale = 1.0; 438
439 // Estimate browser scale factor in order to be able to translate logical
440 // pixels on the page into physical pixels on the screen. Scale factor can
441 // be roughly estimated as a ratio between outerWidht and innerWidth of
442 // the document view. The result is not precise because outerWidth can
443 // include pixels allocated for toolbars, window borders and such.
444 var viewInnerWidth = document.defaultView.innerWidth;
445 var viewOuterWidth = document.defaultView.outerWidth;
446 var scale = Math.round(100.0 * viewInnerWidth / viewOuterWidth) / 100.0;
Wez 2012/02/07 01:56:31 This looks like a change from a different CL, so I
439 447
440 if (this.getScaleToFit()) { 448 if (this.getScaleToFit()) {
441 var scaleFitHeight = 1.0 * windowHeight / this.plugin.desktopHeight; 449 var scaledHeight = 1.0 * windowHeight / (scale * this.plugin.desktopHeight);
442 var scaleFitWidth = 1.0 * windowWidth / this.plugin.desktopWidth; 450 var scaledWidth = 1.0 * windowWidth / (scale * this.plugin.desktopWidth);
443 scale = Math.min(1.0, scaleFitHeight, scaleFitWidth); 451 scale = Math.min(1.0, scaledHeight, scaledWidth, scale);
444 } 452 }
445 453
446 // Resize the plugin if necessary. 454 // Resize the plugin if necessary.
447 this.plugin.width = this.plugin.desktopWidth * scale; 455 this.plugin.width = this.plugin.desktopWidth * scale;
448 this.plugin.height = this.plugin.desktopHeight * scale; 456 this.plugin.height = this.plugin.desktopHeight * scale;
449 457
450 // Position the container. 458 // Position the container.
451 // TODO(wez): We should take into account scrollbars when positioning. 459 // TODO(wez): We should take into account scrollbars when positioning.
452 var parentNode = this.plugin.parentNode; 460 var parentNode = this.plugin.parentNode;
453 if (this.plugin.width < windowWidth) 461 if (this.plugin.width < windowWidth)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 }; 499 };
492 500
493 /** 501 /**
494 * Logs statistics. 502 * Logs statistics.
495 * 503 *
496 * @param {Object.<string, number>} stats 504 * @param {Object.<string, number>} stats
497 */ 505 */
498 remoting.ClientSession.prototype.logStatistics = function(stats) { 506 remoting.ClientSession.prototype.logStatistics = function(stats) {
499 this.logToServer.logStatistics(stats, this.mode); 507 this.logToServer.logStatistics(stats, this.mode);
500 }; 508 };
OLDNEW
« remoting/protocol/content_description.cc ('K') | « remoting/protocol/content_description.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698