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

Side by Side Diff: remoting/webapp/host_controller.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/client_screen.js ('k') | remoting/webapp/host_list.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 'use strict'; 5 'use strict';
6 6
7 /** @suppress {duplicate} */ 7 /** @suppress {duplicate} */
8 var remoting = remoting || {}; 8 var remoting = remoting || {};
9 9
10 /** @constructor */ 10 /** @constructor */
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 /** @param {XMLHttpRequest} xhr */ 196 /** @param {XMLHttpRequest} xhr */
197 function (xhr) { onRegistered(privateKey, xhr); }, 197 function (xhr) { onRegistered(privateKey, xhr); },
198 JSON.stringify(newHostDetails), 198 JSON.stringify(newHostDetails),
199 headers); 199 headers);
200 }; 200 };
201 201
202 /** @param {string} privateKey 202 /** @param {string} privateKey
203 * @param {string} publicKey */ 203 * @param {string} publicKey */
204 function onKeyGenerated(privateKey, publicKey) { 204 function onKeyGenerated(privateKey, publicKey) {
205 remoting.oauth2.callWithToken( 205 remoting.oauth2.callWithToken(
206 /** @param {string} oauthToken */ 206 /** @param {string?} oauthToken */
207 function(oauthToken) { 207 function(oauthToken) {
208 doRegisterHost(privateKey, publicKey, oauthToken); 208 if (oauthToken) {
209 doRegisterHost(privateKey, publicKey, oauthToken);
210 } else {
211 // TODO(jamiewalch): Have a more specific error code here?
212 callback(remoting.HostController.AsyncResult.FAILED);
213 }
209 }); 214 });
210 }; 215 };
211 216
212 this.plugin_.generateKeyPair(onKeyGenerated); 217 this.plugin_.generateKeyPair(onKeyGenerated);
213 }; 218 };
214 219
215 /** 220 /**
216 * Stop the daemon process. 221 * Stop the daemon process.
217 * @param {function(remoting.HostController.AsyncResult):void} callback 222 * @param {function(remoting.HostController.AsyncResult):void} callback
218 * Callback to be called when finished. 223 * Callback to be called when finished.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 try { 330 try {
326 this.plugin_.getDaemonConfig(onConfig); 331 this.plugin_.getDaemonConfig(onConfig);
327 } catch (err) { 332 } catch (err) {
328 this.setHost(null); 333 this.setHost(null);
329 onDone(); 334 onDone();
330 } 335 }
331 }; 336 };
332 337
333 /** @type {remoting.HostController} */ 338 /** @type {remoting.HostController} */
334 remoting.hostController = null; 339 remoting.hostController = null;
OLDNEW
« no previous file with comments | « remoting/webapp/client_screen.js ('k') | remoting/webapp/host_list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698