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

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

Issue 15685008: Show a 'remember me' checkbox in the web-app when connecting to a host that supports pairing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved PIN dialog layout. Created 7 years, 7 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
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 /** 43 /**
44 * @param {string} tokenUrl Token-request URL, received from the host. 44 * @param {string} tokenUrl Token-request URL, received from the host.
45 * @param {string} hostPublicKey Public key for the host. 45 * @param {string} hostPublicKey Public key for the host.
46 * @param {string} scope OAuth scope to request the token for. 46 * @param {string} scope OAuth scope to request the token for.
47 */ 47 */
48 this.fetchThirdPartyTokenHandler = function( 48 this.fetchThirdPartyTokenHandler = function(
49 tokenUrl, hostPublicKey, scope) {}; 49 tokenUrl, hostPublicKey, scope) {};
50 this.onDesktopSizeUpdateHandler = function () {}; 50 this.onDesktopSizeUpdateHandler = function () {};
51 /** @param {!Array.<string>} capabilities The negotiated capabilities. */ 51 /** @param {!Array.<string>} capabilities The negotiated capabilities. */
52 this.onSetCapabilitiesHandler = function (capabilities) {}; 52 this.onSetCapabilitiesHandler = function (capabilities) {};
53 this.fetchPinHandler = function () {}; 53 this.fetchPinHandler = function (supportsPairing) {};
54 54
55 /** @type {number} */ 55 /** @type {number} */
56 this.pluginApiVersion_ = -1; 56 this.pluginApiVersion_ = -1;
57 /** @type {Array.<string>} */ 57 /** @type {Array.<string>} */
58 this.pluginApiFeatures_ = []; 58 this.pluginApiFeatures_ = [];
59 /** @type {number} */ 59 /** @type {number} */
60 this.pluginApiMinVersion_ = -1; 60 this.pluginApiMinVersion_ = -1;
61 /** @type {!Array.<string>} */ 61 /** @type {!Array.<string>} */
62 this.capabilities_ = []; 62 this.capabilities_ = [];
63 /** @type {boolean} */ 63 /** @type {boolean} */
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 remoting.clientSession.onFirstFrameReceived(); 256 remoting.clientSession.onFirstFrameReceived();
257 } 257 }
258 } else if (message.method == 'onConnectionReady') { 258 } else if (message.method == 'onConnectionReady') {
259 if (typeof message.data['ready'] != 'boolean') { 259 if (typeof message.data['ready'] != 'boolean') {
260 console.error('Received incorrect onConnectionReady message.'); 260 console.error('Received incorrect onConnectionReady message.');
261 return; 261 return;
262 } 262 }
263 var ready = /** @type {boolean} */ message.data['ready']; 263 var ready = /** @type {boolean} */ message.data['ready'];
264 this.onConnectionReadyHandler(ready); 264 this.onConnectionReadyHandler(ready);
265 } else if (message.method == 'fetchPin') { 265 } else if (message.method == 'fetchPin') {
266 this.fetchPinHandler(); 266 var pairingSupported =
267 /** @type {boolean} */ message.data['pairingSupported'];
268 if (pairingSupported !== undefined &&
rmsousa 2013/05/23 00:14:59 Nit: I think it's clearer to explicitly test for '
Jamie 2013/05/23 01:10:08 Done.
269 typeof pairingSupported != 'boolean') {
270 console.error('Received incorrect fetchPin message.');
271 return;
272 }
273 this.fetchPinHandler(pairingSupported);
267 } else if (message.method == 'setCapabilities') { 274 } else if (message.method == 'setCapabilities') {
268 if (typeof message.data['capabilities'] != 'string') { 275 if (typeof message.data['capabilities'] != 'string') {
269 console.error('Received incorrect setCapabilities message.'); 276 console.error('Received incorrect setCapabilities message.');
270 return; 277 return;
271 } 278 }
272 279
273 /** @type {!Array.<string>} */ 280 /** @type {!Array.<string>} */
274 var capabilities = tokenize(message.data['capabilities']); 281 var capabilities = tokenize(message.data['capabilities']);
275 this.onSetCapabilitiesHandler(capabilities); 282 this.onSetCapabilitiesHandler(capabilities);
276 } else if (message.method == 'fetchThirdPartyToken') { 283 } else if (message.method == 'fetchThirdPartyToken') {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 this.plugin.width = width; 574 this.plugin.width = width;
568 this.plugin.height = height; 575 this.plugin.height = height;
569 // Center the plugin just underneath the "Connnecting..." dialog. 576 // Center the plugin just underneath the "Connnecting..." dialog.
570 var parentNode = this.plugin.parentNode; 577 var parentNode = this.plugin.parentNode;
571 var dialog = document.getElementById('client-dialog'); 578 var dialog = document.getElementById('client-dialog');
572 var dialogRect = dialog.getBoundingClientRect(); 579 var dialogRect = dialog.getBoundingClientRect();
573 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; 580 parentNode.style.top = (dialogRect.bottom + 16) + 'px';
574 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; 581 parentNode.style.left = (window.innerWidth - width) / 2 + 'px';
575 } 582 }
576 }; 583 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698