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 * 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'; |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 * | 281 * |
282 * @return {void} Nothing. | 282 * @return {void} Nothing. |
283 */ | 283 */ |
284 function startSession_() { | 284 function startSession_() { |
285 remoting.debug.log('Starting session...'); | 285 remoting.debug.log('Starting session...'); |
286 var accessCode = document.getElementById('access-code-entry'); | 286 var accessCode = document.getElementById('access-code-entry'); |
287 accessCode.value = ''; // The code has been validated and won't work again. | 287 accessCode.value = ''; // The code has been validated and won't work again. |
288 remoting.clientSession = | 288 remoting.clientSession = |
289 new remoting.ClientSession( | 289 new remoting.ClientSession( |
290 remoting.hostJid, remoting.hostPublicKey, | 290 remoting.hostJid, remoting.hostPublicKey, |
291 remoting.accessCode, "v1_token", "", | 291 remoting.accessCode, 'v1_token', '', |
292 /** @type {string} */ (remoting.oauth2.getCachedEmail()), | 292 /** @type {string} */ (remoting.oauth2.getCachedEmail()), |
293 remoting.ClientSession.Mode.IT2ME, | 293 remoting.ClientSession.Mode.IT2ME, |
294 onClientStateChange_); | 294 onClientStateChange_); |
295 /** @param {string} token The auth token. */ | 295 /** @param {string} token The auth token. */ |
296 var createPluginAndConnect = function(token) { | 296 var createPluginAndConnect = function(token) { |
297 remoting.clientSession.createPluginAndConnect( | 297 remoting.clientSession.createPluginAndConnect( |
298 document.getElementById('session-mode'), | 298 document.getElementById('session-mode'), |
299 token); | 299 token); |
300 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); | 300 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); |
301 }; | 301 }; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 * work even if they reregister with Talk and get a different Jid. | 414 * work even if they reregister with Talk and get a different Jid. |
415 * @return {void} Nothing. | 415 * @return {void} Nothing. |
416 */ | 416 */ |
417 remoting.connectMe2Me = function(hostId, retryIfOffline) { | 417 remoting.connectMe2Me = function(hostId, retryIfOffline) { |
418 remoting.currentConnectionType = remoting.ConnectionType.Me2Me; | 418 remoting.currentConnectionType = remoting.ConnectionType.Me2Me; |
419 remoting.hostId = hostId; | 419 remoting.hostId = hostId; |
420 remoting.retryIfOffline = retryIfOffline; | 420 remoting.retryIfOffline = retryIfOffline; |
421 | 421 |
422 // TODO(sergeyu): Ask pin only when it is necessary: crbug.com/111290 . | 422 // TODO(sergeyu): Ask pin only when it is necessary: crbug.com/111290 . |
423 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); | 423 remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); |
424 } | 424 }; |
425 | 425 |
426 /** | 426 /** |
427 * Start a connection to the specified host, using the cached details | 427 * Start a connection to the specified host, using the cached details |
428 * and the PIN entered by the user. | 428 * and the PIN entered by the user. |
429 * | 429 * |
430 * @return {void} Nothing. | 430 * @return {void} Nothing. |
431 */ | 431 */ |
432 remoting.connectMe2MeWithPin = function() { | 432 remoting.connectMe2MeWithPin = function() { |
433 remoting.debug.log('Connecting to host...'); | 433 remoting.debug.log('Connecting to host...'); |
434 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 434 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
(...skipping 19 matching lines...) Expand all Loading... |
454 */ | 454 */ |
455 function connectMe2MeWithAccessToken_(token) { | 455 function connectMe2MeWithAccessToken_(token) { |
456 if (token) { | 456 if (token) { |
457 /** @type {string} */ | 457 /** @type {string} */ |
458 var pin = document.getElementById('pin-entry').value; | 458 var pin = document.getElementById('pin-entry').value; |
459 document.getElementById('pin-entry').value = ''; | 459 document.getElementById('pin-entry').value = ''; |
460 | 460 |
461 remoting.clientSession = | 461 remoting.clientSession = |
462 new remoting.ClientSession( | 462 new remoting.ClientSession( |
463 remoting.hostJid, remoting.hostPublicKey, | 463 remoting.hostJid, remoting.hostPublicKey, |
464 pin, "spake2_hmac,spake2_plain", remoting.hostId, | 464 pin, 'spake2_hmac,spake2_plain', remoting.hostId, |
465 /** @type {string} */ (remoting.oauth2.getCachedEmail()), | 465 /** @type {string} */ (remoting.oauth2.getCachedEmail()), |
466 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); | 466 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); |
467 remoting.clientSession.createPluginAndConnect( | 467 remoting.clientSession.createPluginAndConnect( |
468 document.getElementById('session-mode'), | 468 document.getElementById('session-mode'), |
469 token); | 469 token); |
470 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); | 470 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); |
471 } else { | 471 } else { |
472 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); | 472 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); |
473 } | 473 } |
474 } | 474 } |
OLD | NEW |