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

Side by Side Diff: remoting/webapp/crd/js/host_setup_dialog.js

Issue 937593002: Changed identity API to use promises instead of callbacks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed bad merge Created 5 years, 10 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
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/identity.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 /** 10 /**
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 /** @type {remoting.HostSetupDialog} */ 156 /** @type {remoting.HostSetupDialog} */
157 var that = this; 157 var that = this;
158 158
159 /** 159 /**
160 * @param {remoting.HostController.State} state 160 * @param {remoting.HostController.State} state
161 */ 161 */
162 var onState = function(state) { 162 var onState = function(state) {
163 // Although we don't need an access token in order to start the host, 163 // Although we don't need an access token in order to start the host,
164 // using callWithToken here ensures consistent error handling in the 164 // using callWithToken here ensures consistent error handling in the
165 // case where the refresh token is invalid. 165 // case where the refresh token is invalid.
166 remoting.identity.callWithToken( 166 remoting.identity.getToken().then(
167 that.showForStartWithToken_.bind(that, state), 167 that.showForStartWithToken_.bind(that, state),
168 remoting.showErrorMessage); 168 remoting.Error.handler(remoting.showErrorMessage));
169 }; 169 };
170 170
171 this.hostController_.getLocalHostState(onState); 171 this.hostController_.getLocalHostState(onState);
172 }; 172 };
173 173
174 /** 174 /**
175 * @param {remoting.HostController.State} state The current state of the local 175 * @param {remoting.HostController.State} state The current state of the local
176 * host. 176 * host.
177 * @param {string} token The OAuth2 token. 177 * @param {string} token The OAuth2 token.
178 * @private 178 * @private
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 var c = pin.charAt(i); 562 var c = pin.charAt(i);
563 if ((c < '0') || (c > '9')) { 563 if ((c < '0') || (c > '9')) {
564 return false; 564 return false;
565 } 565 }
566 } 566 }
567 return true; 567 return true;
568 }; 568 };
569 569
570 /** @type {remoting.HostSetupDialog} */ 570 /** @type {remoting.HostSetupDialog} */
571 remoting.hostSetupDialog = null; 571 remoting.hostSetupDialog = null;
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/identity.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698