Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: remoting/webapp/client_screen.js

Issue 10207028: Fixed callWithToken error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | remoting/webapp/host_controller.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 console.log('Starting session...'); 307 console.log('Starting session...');
308 var accessCode = document.getElementById('access-code-entry'); 308 var accessCode = document.getElementById('access-code-entry');
309 accessCode.value = ''; // The code has been validated and won't work again. 309 accessCode.value = ''; // The code has been validated and won't work again.
310 remoting.clientSession = 310 remoting.clientSession =
311 new remoting.ClientSession( 311 new remoting.ClientSession(
312 remoting.hostJid, remoting.hostPublicKey, 312 remoting.hostJid, remoting.hostPublicKey,
313 remoting.accessCode, 'v1_token', '', 313 remoting.accessCode, 'v1_token', '',
314 /** @type {string} */ (remoting.oauth2.getCachedEmail()), 314 /** @type {string} */ (remoting.oauth2.getCachedEmail()),
315 remoting.ClientSession.Mode.IT2ME, 315 remoting.ClientSession.Mode.IT2ME,
316 onClientStateChange_); 316 onClientStateChange_);
317 /** @param {string} token The auth token. */ 317 /** @param {string?} token The auth token. */
318 var createPluginAndConnect = function(token) { 318 var createPluginAndConnect = function(token) {
319 remoting.clientSession.createPluginAndConnect( 319 if (token) {
320 document.getElementById('session-mode'), 320 remoting.clientSession.createPluginAndConnect(
321 token); 321 document.getElementById('session-mode'),
322 token);
323 } else {
324 showConnectError_(remoting.Error.AUTHENTICATION_FAILED);
325 }
322 }; 326 };
323 remoting.oauth2.callWithToken(createPluginAndConnect); 327 remoting.oauth2.callWithToken(createPluginAndConnect);
324 } 328 }
325 329
326 /** 330 /**
327 * Show a client-side error message. 331 * Show a client-side error message.
328 * 332 *
329 * @param {remoting.Error} errorTag The error to be localized and 333 * @param {remoting.Error} errorTag The error to be localized and
330 * displayed. 334 * displayed.
331 * @return {void} Nothing. 335 * @return {void} Nothing.
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 pin, 'spake2_hmac,spake2_plain', remoting.hostId, 528 pin, 'spake2_hmac,spake2_plain', remoting.hostId,
525 /** @type {string} */ (remoting.oauth2.getCachedEmail()), 529 /** @type {string} */ (remoting.oauth2.getCachedEmail()),
526 remoting.ClientSession.Mode.ME2ME, onClientStateChange_); 530 remoting.ClientSession.Mode.ME2ME, onClientStateChange_);
527 remoting.clientSession.createPluginAndConnect( 531 remoting.clientSession.createPluginAndConnect(
528 document.getElementById('session-mode'), 532 document.getElementById('session-mode'),
529 token); 533 token);
530 } else { 534 } else {
531 showConnectError_(remoting.Error.AUTHENTICATION_FAILED); 535 showConnectError_(remoting.Error.AUTHENTICATION_FAILED);
532 } 536 }
533 } 537 }
OLDNEW
« no previous file with comments | « no previous file | remoting/webapp/host_controller.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698