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

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

Issue 955283002: Converted remoting.Error from an enum to a class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Smaller diff. Created 5 years, 9 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
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 * Wrapper class for Chrome's identity API. 7 * Wrapper class for Chrome's identity API.
8 */ 8 */
9 9
10 'use strict'; 10 'use strict';
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return; 206 return;
207 } 207 }
208 208
209 // If not, pass an error back to the callback(s) if we've already prompted the 209 // If not, pass an error back to the callback(s) if we've already prompted the
210 // user for permission. 210 // user for permission.
211 if (interactive) { 211 if (interactive) {
212 var error_message = 212 var error_message =
213 chrome.runtime.lastError ? chrome.runtime.lastError.message 213 chrome.runtime.lastError ? chrome.runtime.lastError.message
214 : 'Unknown error.'; 214 : 'Unknown error.';
215 console.error(error_message); 215 console.error(error_message);
216 authTokenDeferred.reject(remoting.Error.NOT_AUTHENTICATED); 216 authTokenDeferred.reject(
217 remoting.Error.NOT_AUTHENTICATED);
Jamie 2015/02/26 18:57:42 No need for a new line here.
John Williams 2015/02/27 21:42:11 Oops, relic of a previous version of the CL.
217 return; 218 return;
218 } 219 }
219 220
220 // If there's no token, but we haven't yet prompted for permission, do so 221 // If there's no token, but we haven't yet prompted for permission, do so
221 // now. 222 // now.
222 var that = this; 223 var that = this;
223 var showConsentDialog = 224 var showConsentDialog =
224 (this.consentDialog_) ? this.consentDialog_.show() : Promise.resolve(); 225 (this.consentDialog_) ? this.consentDialog_.show() : Promise.resolve();
225 showConsentDialog.then(function() { 226 showConsentDialog.then(function() {
226 chrome.identity.getAuthToken( 227 chrome.identity.getAuthToken(
227 {'interactive': true}, that.onAuthComplete_.bind(that, true)); 228 {'interactive': true}, that.onAuthComplete_.bind(that, true));
228 }); 229 });
229 }; 230 };
230 231
231 /** 232 /**
232 * Returns whether the web app has authenticated with the Google services. 233 * Returns whether the web app has authenticated with the Google services.
233 * 234 *
234 * @return {boolean} 235 * @return {boolean}
235 */ 236 */
236 remoting.Identity.prototype.isAuthenticated = function() { 237 remoting.Identity.prototype.isAuthenticated = function() {
237 return remoting.identity.email_ !== ''; 238 return remoting.identity.email_ !== '';
238 }; 239 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698