| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 * Functions related to the 'client screen' for Chromoting. | 7 * Functions related to the 'client screen' for Chromoting. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| 11 | 11 |
| 12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
| 13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * Initiate an IT2Me connection. | 16 * Initiate an IT2Me connection. |
| 17 */ | 17 */ |
| 18 remoting.connectIT2Me = function() { | 18 remoting.connectIT2Me = function() { |
| 19 var connector = remoting.app.getSessionConnector(); | 19 var connector = remoting.app.getSessionConnector(); |
| 20 var accessCode = document.getElementById('access-code-entry').value; | 20 var accessCode = document.getElementById('access-code-entry').value; |
| 21 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 21 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
| 22 connector.connectIT2Me(accessCode); | 22 remoting.It2MeConnectFlow.start(connector, accessCode). |
| 23 catch(function(reason){ |
| 24 var errorDiv = document.getElementById('connect-error-message'); |
| 25 l10n.localizeElementFromTag(errorDiv, /** @type {string} */ (reason)); |
| 26 remoting.setMode(remoting.AppMode.CLIENT_CONNECT_FAILED_IT2ME); |
| 27 }); |
| 23 }; | 28 }; |
| 24 | 29 |
| 25 /** | 30 /** |
| 26 * Entry-point for Me2Me connections, handling showing of the host-upgrade nag | 31 * Entry-point for Me2Me connections, handling showing of the host-upgrade nag |
| 27 * dialog if necessary. | 32 * dialog if necessary. |
| 28 * | 33 * |
| 29 * @param {string} hostId The unique id of the host. | 34 * @param {string} hostId The unique id of the host. |
| 30 * @return {void} Nothing. | 35 * @return {void} Nothing. |
| 31 */ | 36 */ |
| 32 remoting.connectMe2Me = function(hostId) { | 37 remoting.connectMe2Me = function(hostId) { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 if (pairingInfo) { | 159 if (pairingInfo) { |
| 155 clientId = /** @type {string} */ (pairingInfo['clientId']); | 160 clientId = /** @type {string} */ (pairingInfo['clientId']); |
| 156 sharedSecret = /** @type {string} */ (pairingInfo['sharedSecret']); | 161 sharedSecret = /** @type {string} */ (pairingInfo['sharedSecret']); |
| 157 } | 162 } |
| 158 connector.connectMe2Me(host, requestPin, fetchThirdPartyToken, | 163 connector.connectMe2Me(host, requestPin, fetchThirdPartyToken, |
| 159 clientId, sharedSecret); | 164 clientId, sharedSecret); |
| 160 } | 165 } |
| 161 | 166 |
| 162 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved); | 167 remoting.HostSettings.load(host.hostId, connectMe2MeHostSettingsRetrieved); |
| 163 }; | 168 }; |
| OLD | NEW |