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

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

Issue 10801003: Propagate DPI information to web-app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed typo. Created 8 years, 5 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 that wraps low-level details of interacting with the client plugin. 7 * Class that wraps low-level details of interacting with the client plugin.
8 * 8 *
9 * This abstracts a <embed> element and controls the plugin which does 9 * This abstracts a <embed> element and controls the plugin which does
10 * the actual remoting work. It also handles differences between 10 * the actual remoting work. It also handles differences between
11 * client plugins versions when it is necessary. 11 * client plugins versions when it is necessary.
12 */ 12 */
13 13
14 'use strict'; 14 'use strict';
15 15
16 /** @suppress {duplicate} */ 16 /** @suppress {duplicate} */
17 var remoting = remoting || {}; 17 var remoting = remoting || {};
18 18
19 /** 19 /**
20 * @param {remoting.ViewerPlugin} plugin The plugin embed element. 20 * @param {remoting.ViewerPlugin} plugin The plugin embed element.
21 * @constructor 21 * @constructor
22 * @implements {remoting.ClientPlugin} 22 * @implements {remoting.ClientPlugin}
23 */ 23 */
24 remoting.ClientPluginAsync = function(plugin) { 24 remoting.ClientPluginAsync = function(plugin) {
25 this.plugin = plugin; 25 this.plugin = plugin;
26 26
27 this.desktopWidth = 0; 27 this.desktopWidth = 0;
28 this.desktopHeight = 0; 28 this.desktopHeight = 0;
29 this.desktopDpiX = 0;
30 this.desktopDpiY = 0;
29 31
30 /** @param {string} iq The Iq stanza received from the host. */ 32 /** @param {string} iq The Iq stanza received from the host. */
31 this.onOutgoingIqHandler = function (iq) {}; 33 this.onOutgoingIqHandler = function (iq) {};
32 /** @param {string} message Log message. */ 34 /** @param {string} message Log message. */
33 this.onDebugMessageHandler = function (message) {}; 35 this.onDebugMessageHandler = function (message) {};
34 /** 36 /**
35 * @param {number} state The connection state. 37 * @param {number} state The connection state.
36 * @param {number} error The error code, if any. 38 * @param {number} error The error code, if any.
37 */ 39 */
38 this.onConnectionStatusUpdateHandler = function(state, error) {}; 40 this.onConnectionStatusUpdateHandler = function(state, error) {};
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 157
156 this.onConnectionStatusUpdateHandler(state, error); 158 this.onConnectionStatusUpdateHandler(state, error);
157 } else if (message.method == 'onDesktopSize') { 159 } else if (message.method == 'onDesktopSize') {
158 if (typeof message.data['width'] != 'number' || 160 if (typeof message.data['width'] != 'number' ||
159 typeof message.data['height'] != 'number') { 161 typeof message.data['height'] != 'number') {
160 console.error('Received invalid onDesktopSize message: ' + messageStr); 162 console.error('Received invalid onDesktopSize message: ' + messageStr);
161 return; 163 return;
162 } 164 }
163 this.desktopWidth = /** @type {number} */ message.data['width']; 165 this.desktopWidth = /** @type {number} */ message.data['width'];
164 this.desktopHeight = /** @type {number} */ message.data['height']; 166 this.desktopHeight = /** @type {number} */ message.data['height'];
167 this.desktopDpiX = (typeof message.data['x_dpi'] == 'number') ?
168 /** @type {number} */ (message.data['x_dpi']) : 0;
Wez 2012/07/19 01:00:42 nit: Treat missing DPI as 96 DPI for consistency w
Jamie 2012/07/19 23:00:06 That was left-over debugging code. Fixed here and
169 this.desktopDpiY = (typeof message.data['y_dpi'] == 'number') ?
170 /** @type {number} */ (message.data['y_dpi']) : 0;
165 this.onDesktopSizeUpdateHandler(); 171 this.onDesktopSizeUpdateHandler();
166 } else if (message.method == 'onPerfStats') { 172 } else if (message.method == 'onPerfStats') {
167 if (typeof message.data['videoBandwidth'] != 'number' || 173 if (typeof message.data['videoBandwidth'] != 'number' ||
168 typeof message.data['videoFrameRate'] != 'number' || 174 typeof message.data['videoFrameRate'] != 'number' ||
169 typeof message.data['captureLatency'] != 'number' || 175 typeof message.data['captureLatency'] != 'number' ||
170 typeof message.data['encodeLatency'] != 'number' || 176 typeof message.data['encodeLatency'] != 'number' ||
171 typeof message.data['decodeLatency'] != 'number' || 177 typeof message.data['decodeLatency'] != 'number' ||
172 typeof message.data['renderLatency'] != 'number' || 178 typeof message.data['renderLatency'] != 'number' ||
173 typeof message.data['roundtripLatency'] != 'number') { 179 typeof message.data['roundtripLatency'] != 'number') {
174 console.error('Received incorrect onPerfStats message: ' + messageStr); 180 console.error('Received incorrect onPerfStats message: ' + messageStr);
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 this.plugin.width = width; 402 this.plugin.width = width;
397 this.plugin.height = height; 403 this.plugin.height = height;
398 // Center the plugin just underneath the "Connnecting..." dialog. 404 // Center the plugin just underneath the "Connnecting..." dialog.
399 var parentNode = this.plugin.parentNode; 405 var parentNode = this.plugin.parentNode;
400 var dialog = document.getElementById('client-dialog'); 406 var dialog = document.getElementById('client-dialog');
401 var dialogRect = dialog.getBoundingClientRect(); 407 var dialogRect = dialog.getBoundingClientRect();
402 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; 408 parentNode.style.top = (dialogRect.bottom + 16) + 'px';
403 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; 409 parentNode.style.left = (window.innerWidth - width) / 2 + 'px';
404 } 410 }
405 }; 411 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698