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

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: 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
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 callback(remoting.HostController.AsyncResult.FAILED);
Jamie 2012/04/25 01:20:48 We could probably use a more specific error code h
simonmorris 2012/04/25 16:59:41 Maybe a TODO to add a more specific error code?
Jamie 2012/04/25 17:29:09 Done.
212 }
209 }); 213 });
210 }; 214 };
211 215
212 this.plugin_.generateKeyPair(onKeyGenerated); 216 this.plugin_.generateKeyPair(onKeyGenerated);
213 }; 217 };
214 218
215 /** 219 /**
216 * Stop the daemon process. 220 * Stop the daemon process.
217 * @param {function(remoting.HostController.AsyncResult):void} callback 221 * @param {function(remoting.HostController.AsyncResult):void} callback
218 * Callback to be called when finished. 222 * Callback to be called when finished.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 try { 329 try {
326 this.plugin_.getDaemonConfig(onConfig); 330 this.plugin_.getDaemonConfig(onConfig);
327 } catch (err) { 331 } catch (err) {
328 this.setHost(null); 332 this.setHost(null);
329 onDone(); 333 onDone();
330 } 334 }
331 }; 335 };
332 336
333 /** @type {remoting.HostController} */ 337 /** @type {remoting.HostController} */
334 remoting.hostController = null; 338 remoting.hostController = null;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698