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

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

Issue 10207028: Fixed callWithToken error handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reviewer feedback. Created 8 years, 7 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 | « remoting/webapp/wcs.js ('k') | no next file » | 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 /** 6 /**
7 * @fileoverview 7 * @fileoverview
8 * A class that loads a WCS IQ client and constructs remoting.wcs as a 8 * A class that loads a WCS IQ client and constructs remoting.wcs as a
9 * wrapper for it. 9 * wrapper for it.
10 */ 10 */
(...skipping 23 matching lines...) Expand all
34 * Load WCS if necessary, then invoke the callback with an access token. 34 * Load WCS if necessary, then invoke the callback with an access token.
35 * 35 *
36 * @param {function(string?): void} onReady The callback function, called with 36 * @param {function(string?): void} onReady The callback function, called with
37 * an OAuth2 access token when WCS has been loaded, or with null on error. 37 * an OAuth2 access token when WCS has been loaded, or with null on error.
38 * @return {void} Nothing. 38 * @return {void} Nothing.
39 */ 39 */
40 remoting.WcsLoader.load = function(onReady) { 40 remoting.WcsLoader.load = function(onReady) {
41 if (!remoting.wcsLoader) { 41 if (!remoting.wcsLoader) {
42 remoting.wcsLoader = new remoting.WcsLoader(); 42 remoting.wcsLoader = new remoting.WcsLoader();
43 } 43 }
44 /** @param {string} token The OAuth2 access token. */ 44 /** @param {string?} token The OAuth2 access token. */
45 var start = function(token) { 45 var start = function(token) {
46 remoting.wcsLoader.start_(token, onReady); 46 if (token) {
47 remoting.wcsLoader.start_(token, onReady);
48 } else {
49 console.error('WcsLoader: Authentication failed.');
50 onReady(null);
51 }
47 }; 52 };
48 remoting.oauth2.callWithToken(start); 53 remoting.oauth2.callWithToken(start);
49 }; 54 };
50 55
51 /** 56 /**
52 * The URL of the GTalk gadget. 57 * The URL of the GTalk gadget.
53 * @type {string} 58 * @type {string}
54 * @private 59 * @private
55 */ 60 */
56 remoting.WcsLoader.prototype.TALK_GADGET_URL_ = 61 remoting.WcsLoader.prototype.TALK_GADGET_URL_ =
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * an OAuth2 access token when WCS has been loaded, or with null on error. 128 * an OAuth2 access token when WCS has been loaded, or with null on error.
124 * @return {void} Nothing. 129 * @return {void} Nothing.
125 * @private 130 * @private
126 */ 131 */
127 remoting.WcsLoader.prototype.constructWcs_ = function(token, onReady) { 132 remoting.WcsLoader.prototype.constructWcs_ = function(token, onReady) {
128 remoting.wcs = new remoting.Wcs( 133 remoting.wcs = new remoting.Wcs(
129 remoting.wcsLoader.wcsIqClient, 134 remoting.wcsLoader.wcsIqClient,
130 token, 135 token,
131 function() { onReady(token); }); 136 function() { onReady(token); });
132 }; 137 };
OLDNEW
« no previous file with comments | « remoting/webapp/wcs.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698