| 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 handling creation and teardown of a remoting client session. | 7 * Class handling creation and teardown of a remoting client session. |
| 8 * | 8 * |
| 9 * The ClientSession class controls lifetime of the client plugin | 9 * The ClientSession class controls lifetime of the client plugin |
| 10 * object and provides the plugin with the functionality it needs to | 10 * object and provides the plugin with the functionality it needs to |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 /** @suppress {duplicate} */ | 22 /** @suppress {duplicate} */ |
| 23 var remoting = remoting || {}; | 23 var remoting = remoting || {}; |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * @param {string} hostJid The jid of the host to connect to. | 26 * @param {string} hostJid The jid of the host to connect to. |
| 27 * @param {string} clientJid The jid of the WCS client. | 27 * @param {string} clientJid The jid of the WCS client. |
| 28 * @param {string} hostPublicKey The base64 encoded version of the host's | 28 * @param {string} hostPublicKey The base64 encoded version of the host's |
| 29 * public key. | 29 * public key. |
| 30 * @param {string} accessCode The IT2Me access code. Blank for Me2Me. | 30 * @param {string} accessCode The IT2Me access code. Blank for Me2Me. |
| 31 * @param {function(function(string): void): void} fetchPin Called by Me2Me | 31 * @param {function(function(string): void, boolean): void} fetchPin |
| 32 * connections when a PIN needs to be obtained interactively. | 32 * Called by Me2Me connections when a PIN needs to be obtained |
| 33 * interactively. |
| 33 * @param {function(string, string, string, | 34 * @param {function(string, string, string, |
| 34 * function(string, string): void): void} | 35 * function(string, string): void): void} |
| 35 * fetchThirdPartyToken Called by Me2Me connections when a third party | 36 * fetchThirdPartyToken Called by Me2Me connections when a third party |
| 36 * authentication token must be obtained. | 37 * authentication token must be obtained. |
| 37 * @param {string} authenticationMethods Comma-separated list of | 38 * @param {string} authenticationMethods Comma-separated list of |
| 38 * authentication methods the client should attempt to use. | 39 * authentication methods the client should attempt to use. |
| 39 * @param {string} hostId The host identifier for Me2Me, or empty for IT2Me. | 40 * @param {string} hostId The host identifier for Me2Me, or empty for IT2Me. |
| 40 * Mixed into authentication hashes for some authentication methods. | 41 * Mixed into authentication hashes for some authentication methods. |
| 41 * @param {remoting.ClientSession.Mode} mode The mode of this connection. | 42 * @param {remoting.ClientSession.Mode} mode The mode of this connection. |
| 42 * @param {string} hostDisplayName The name of the host for display purposes. | 43 * @param {string} hostDisplayName The name of the host for display purposes. |
| (...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 738 }; | 739 }; |
| 739 plugin.fetchThirdPartyTokenHandler = fetchThirdPartyToken; | 740 plugin.fetchThirdPartyTokenHandler = fetchThirdPartyToken; |
| 740 } | 741 } |
| 741 if (this.accessCode_) { | 742 if (this.accessCode_) { |
| 742 // Shared secret was already supplied before connecting (It2Me case). | 743 // Shared secret was already supplied before connecting (It2Me case). |
| 743 this.connectToHost_(this.accessCode_); | 744 this.connectToHost_(this.accessCode_); |
| 744 } else if (plugin.hasFeature( | 745 } else if (plugin.hasFeature( |
| 745 remoting.ClientPlugin.Feature.ASYNC_PIN)) { | 746 remoting.ClientPlugin.Feature.ASYNC_PIN)) { |
| 746 // Plugin supports asynchronously asking for the PIN. | 747 // Plugin supports asynchronously asking for the PIN. |
| 747 plugin.useAsyncPinDialog(); | 748 plugin.useAsyncPinDialog(); |
| 748 var fetchPin = function() { | 749 /** @param {boolean} pairingSupported */ |
| 749 that.fetchPin_(plugin.onPinFetched.bind(plugin)); | 750 var fetchPin = function(pairingSupported) { |
| 751 that.fetchPin_(plugin.onPinFetched.bind(plugin), pairingSupported); |
| 750 }; | 752 }; |
| 751 plugin.fetchPinHandler = fetchPin; | 753 plugin.fetchPinHandler = fetchPin; |
| 752 this.connectToHost_(''); | 754 this.connectToHost_(''); |
| 753 } else { | 755 } else { |
| 754 // Plugin doesn't support asynchronously asking for the PIN, ask now. | 756 // Clients that don't support asking for a PIN asynchronously also don't |
| 755 this.fetchPin_(this.connectToHost_.bind(this)); | 757 // support pairing, so request the PIN now without offering to remember it. |
| 758 this.fetchPin_(this.connectToHost_.bind(this), false); |
| 756 } | 759 } |
| 757 }; | 760 }; |
| 758 | 761 |
| 759 /** | 762 /** |
| 760 * Connects to the host. | 763 * Connects to the host. |
| 761 * | 764 * |
| 762 * @param {string} sharedSecret Shared secret for SPAKE negotiation. | 765 * @param {string} sharedSecret Shared secret for SPAKE negotiation. |
| 763 * @return {void} Nothing. | 766 * @return {void} Nothing. |
| 764 * @private | 767 * @private |
| 765 */ | 768 */ |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1201 var lateAdjustment = 1 + (now - expected) / timeout; | 1204 var lateAdjustment = 1 + (now - expected) / timeout; |
| 1202 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { | 1205 if (!that.scroll_(lateAdjustment * dx, lateAdjustment * dy)) { |
| 1203 that.bumpScrollTimer_ = window.setTimeout( | 1206 that.bumpScrollTimer_ = window.setTimeout( |
| 1204 function() { repeatScroll(now + timeout); }, | 1207 function() { repeatScroll(now + timeout); }, |
| 1205 timeout); | 1208 timeout); |
| 1206 } | 1209 } |
| 1207 }; | 1210 }; |
| 1208 repeatScroll(new Date().getTime()); | 1211 repeatScroll(new Date().getTime()); |
| 1209 } | 1212 } |
| 1210 }; | 1213 }; |
| OLD | NEW |