| 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 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 * authentication hashes. | 417 * authentication hashes. |
| 418 * @param {string} clientPairingId For paired Me2Me connections, the | 418 * @param {string} clientPairingId For paired Me2Me connections, the |
| 419 * pairing id for this client, as issued by the host. | 419 * pairing id for this client, as issued by the host. |
| 420 * @param {string} clientPairedSecret For paired Me2Me connections, the | 420 * @param {string} clientPairedSecret For paired Me2Me connections, the |
| 421 * paired secret for this client, as issued by the host. | 421 * paired secret for this client, as issued by the host. |
| 422 */ | 422 */ |
| 423 remoting.ClientPlugin.prototype.connect = function( | 423 remoting.ClientPlugin.prototype.connect = function( |
| 424 hostJid, hostPublicKey, localJid, sharedSecret, | 424 hostJid, hostPublicKey, localJid, sharedSecret, |
| 425 authenticationMethods, authenticationTag, | 425 authenticationMethods, authenticationTag, |
| 426 clientPairingId, clientPairedSecret) { | 426 clientPairingId, clientPairedSecret) { |
| 427 var keyFilter = ''; |
| 428 if (navigator.platform.indexOf('Mac') == -1) { |
| 429 keyFilter = 'mac'; |
| 430 } else if (navigator.userAgent.match(/\bCrOS\b/)) { |
| 431 keyFilter = 'cros'; |
| 432 } |
| 427 this.plugin.postMessage(JSON.stringify( | 433 this.plugin.postMessage(JSON.stringify( |
| 428 { method: 'connect', data: { | 434 { method: 'connect', data: { |
| 429 hostJid: hostJid, | 435 hostJid: hostJid, |
| 430 hostPublicKey: hostPublicKey, | 436 hostPublicKey: hostPublicKey, |
| 431 localJid: localJid, | 437 localJid: localJid, |
| 432 sharedSecret: sharedSecret, | 438 sharedSecret: sharedSecret, |
| 433 authenticationMethods: authenticationMethods, | 439 authenticationMethods: authenticationMethods, |
| 434 authenticationTag: authenticationTag, | 440 authenticationTag: authenticationTag, |
| 435 capabilities: this.capabilities_.join(" "), | 441 capabilities: this.capabilities_.join(" "), |
| 436 clientPairingId: clientPairingId, | 442 clientPairingId: clientPairingId, |
| 437 clientPairedSecret: clientPairedSecret | 443 clientPairedSecret: clientPairedSecret, |
| 444 keyFilter: keyFilter |
| 438 } | 445 } |
| 439 })); | 446 })); |
| 440 }; | 447 }; |
| 441 | 448 |
| 442 /** | 449 /** |
| 443 * Release all currently pressed keys. | 450 * Release all currently pressed keys. |
| 444 */ | 451 */ |
| 445 remoting.ClientPlugin.prototype.releaseAllKeys = function() { | 452 remoting.ClientPlugin.prototype.releaseAllKeys = function() { |
| 446 this.plugin.postMessage(JSON.stringify( | 453 this.plugin.postMessage(JSON.stringify( |
| 447 { method: 'releaseAllKeys', data: {} })); | 454 { method: 'releaseAllKeys', data: {} })); |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 663 this.plugin.style.width = width + 'px'; | 670 this.plugin.style.width = width + 'px'; |
| 664 this.plugin.style.height = height + 'px'; | 671 this.plugin.style.height = height + 'px'; |
| 665 // Center the plugin just underneath the "Connnecting..." dialog. | 672 // Center the plugin just underneath the "Connnecting..." dialog. |
| 666 var parentNode = this.plugin.parentNode; | 673 var parentNode = this.plugin.parentNode; |
| 667 var dialog = document.getElementById('client-dialog'); | 674 var dialog = document.getElementById('client-dialog'); |
| 668 var dialogRect = dialog.getBoundingClientRect(); | 675 var dialogRect = dialog.getBoundingClientRect(); |
| 669 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; | 676 parentNode.style.top = (dialogRect.bottom + 16) + 'px'; |
| 670 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; | 677 parentNode.style.left = (window.innerWidth - width) / 2 + 'px'; |
| 671 } | 678 } |
| 672 }; | 679 }; |
| OLD | NEW |