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

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

Issue 12207099: Update web-app client to use plugin notifyDeviceResolution API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | remoting/webapp/client_session.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 remoting.ClientPluginAsync.prototype.sendClipboardItem = 378 remoting.ClientPluginAsync.prototype.sendClipboardItem =
379 function(mimeType, item) { 379 function(mimeType, item) {
380 if (!this.hasFeature(remoting.ClientPlugin.Feature.SEND_CLIPBOARD_ITEM)) 380 if (!this.hasFeature(remoting.ClientPlugin.Feature.SEND_CLIPBOARD_ITEM))
381 return; 381 return;
382 this.plugin.postMessage(JSON.stringify( 382 this.plugin.postMessage(JSON.stringify(
383 { method: 'sendClipboardItem', 383 { method: 'sendClipboardItem',
384 data: { mimeType: mimeType, item: item }})); 384 data: { mimeType: mimeType, item: item }}));
385 }; 385 };
386 386
387 /** 387 /**
388 * Notifies the host that the client has the specified dimensions. 388 * Notifies the host that the client has the specified size and pixel density.
389 * 389 *
390 * @param {number} width The available client width. 390 * @param {number} width The available client width in DIPs.
391 * @param {number} height The available client height. 391 * @param {number} height The available client height in DIPs.
392 * @param {number} device_scale The number of device pixels per DIP.
Jamie 2013/02/11 20:32:02 Does this depend on the version of the plugin? For
Wez 2013/02/11 23:05:33 See below - if the plugin doesn't support notifyCl
392 */ 393 */
393 remoting.ClientPluginAsync.prototype.notifyClientDimensions = 394 remoting.ClientPluginAsync.prototype.notifyClientResolution =
394 function(width, height) { 395 function(width, height, device_scale) {
395 if (!this.hasFeature(remoting.ClientPlugin.Feature.NOTIFY_CLIENT_DIMENSIONS)) 396 if (this.hasFeature(remoting.ClientPlugin.Feature.NOTIFY_CLIENT_RESOLUTION)) {
396 return; 397 var dpi = device_scale * 96;
397 this.plugin.postMessage(JSON.stringify( 398 this.plugin.postMessage(JSON.stringify(
398 { method: 'notifyClientDimensions', 399 { method: 'notifyClientResolution',
399 data: { width: width, height: height }})); 400 data: { width: width * device_scale,
401 height: height * device_scale,
402 x_dpi: dpi, y_dpi: dpi }}));
403 } else if (this.hasFeature(
404 remoting.ClientPlugin.Feature.NOTIFY_CLIENT_DIMENSIONS)) {
405 this.plugin.postMessage(JSON.stringify(
406 { method: 'notifyClientDimensions',
407 data: { width: width, height: height }}));
408 }
400 }; 409 };
401 410
402 /** 411 /**
403 * Requests that the host pause or resume sending video updates. 412 * Requests that the host pause or resume sending video updates.
404 * 413 *
405 * @param {boolean} pause True to suspend video updates, false otherwise. 414 * @param {boolean} pause True to suspend video updates, false otherwise.
406 */ 415 */
407 remoting.ClientPluginAsync.prototype.pauseVideo = 416 remoting.ClientPluginAsync.prototype.pauseVideo =
408 function(pause) { 417 function(pause) {
409 if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO)) 418 if (!this.hasFeature(remoting.ClientPlugin.Feature.PAUSE_VIDEO))
(...skipping 28 matching lines...) Expand all
438 this.plugin.width = width; 447 this.plugin.width = width;
439 this.plugin.height = height; 448 this.plugin.height = height;
440 // Center the plugin just underneath the "Connnecting..." dialog. 449 // Center the plugin just underneath the "Connnecting..." dialog.
441 var parentNode = this.plugin.parentNode; 450 var parentNode = this.plugin.parentNode;
442 var dialog = document.getElementById('client-dialog'); 451 var dialog = document.getElementById('client-dialog');
443 var dialogRect = dialog.getBoundingClientRect(); 452 var dialogRect = dialog.getBoundingClientRect();
444 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; 453 parentNode.style.top = (dialogRect.bottom + 16) + 'px';
445 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; 454 parentNode.style.left = (window.innerWidth - width) / 2 + 'px';
446 } 455 }
447 }; 456 };
OLDNEW
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | remoting/webapp/client_session.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698