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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(jamiewalch): Reinstate the PIN screen once it's supported. | 422 // TODO(jamiewalch): Reinstate the PIN screen once it's supported. |
423 // remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); | 423 // remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); |
424 remoting.connectMe2MeWithPin(); | 424 remoting.connectMe2MeWithPin(); |
425 } | 425 }; |
426 | 426 |
427 /** | 427 /** |
428 * Start a connection to the specified host, using the cached details | 428 * Start a connection to the specified host, using the cached details |
429 * and the PIN entered by the user. | 429 * and the PIN entered by the user. |
430 * | 430 * |
431 * @return {void} Nothing. | 431 * @return {void} Nothing. |
432 */ | 432 */ |
433 remoting.connectMe2MeWithPin = function() { | 433 remoting.connectMe2MeWithPin = function() { |
434 remoting.debug.log('Connecting to host...'); | 434 remoting.debug.log('Connecting to host...'); |
435 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); | 435 remoting.setMode(remoting.AppMode.CLIENT_CONNECTING); |
(...skipping 19 matching lines...) Expand all Loading... |
455 */ | 455 */ |
456 function connectMe2MeWithAccessToken_(token) { | 456 function connectMe2MeWithAccessToken_(token) { |
457 if (token) { | 457 if (token) { |
458 /** @type {string} */ | 458 /** @type {string} */ |
459 var pin = document.getElementById('pin-entry').value; | 459 var pin = document.getElementById('pin-entry').value; |
460 document.getElementById('pin-entry').value = ''; | 460 document.getElementById('pin-entry').value = ''; |
461 | 461 |
462 remoting.clientSession = | 462 remoting.clientSession = |
463 new remoting.ClientSession( | 463 new remoting.ClientSession( |
464 remoting.hostJid, remoting.hostPublicKey, | 464 remoting.hostJid, remoting.hostPublicKey, |
465 pin, "v1_token", remoting.hostId, | 465 pin, 'v1_token', remoting.hostId, |
466 /** @type {string} */ (remoting.oauth2.getCachedEmail()), | 466 /** @type {string} */ (remoting.oauth2.getCachedEmail()), |
467 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); | 467 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); |
468 remoting.clientSession.createPluginAndConnect( | 468 remoting.clientSession.createPluginAndConnect( |
469 document.getElementById('session-mode'), | 469 document.getElementById('session-mode'), |
470 token); | 470 token); |
471 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); | 471 remoting.setScaleToFit(remoting.clientSession.getScaleToFit()); |
472 } else { | 472 } else { |
473 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); | 473 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); |
474 } | 474 } |
475 } | 475 } |
OLD | NEW |