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

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

Issue 585913003: Improve sign-in error UX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | 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 * @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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 while (this.pendingCallbacks_.length > 0) { 117 while (this.pendingCallbacks_.length > 0) {
118 var callback = /** @type {remoting.Identity.Callbacks} */ 118 var callback = /** @type {remoting.Identity.Callbacks} */
119 this.pendingCallbacks_.shift(); 119 this.pendingCallbacks_.shift();
120 callback.onOk(token); 120 callback.onOk(token);
121 } 121 }
122 return; 122 return;
123 } 123 }
124 124
125 // If not, pass an error back to the callback(s) if we've already prompted the 125 // If not, pass an error back to the callback(s) if we've already prompted the
126 // user for permission. 126 // user for permission.
127 // TODO(jamiewalch): Figure out what to do with the error in this case.
128 if (interactive) { 127 if (interactive) {
129 console.error(chrome.runtime.lastError); 128 console.error(chrome.runtime.lastError);
130 while (this.pendingCallbacks_.length > 0) { 129 while (this.pendingCallbacks_.length > 0) {
131 var callback = /** @type {remoting.Identity.Callbacks} */ 130 var callback = /** @type {remoting.Identity.Callbacks} */
132 this.pendingCallbacks_.shift(); 131 this.pendingCallbacks_.shift();
133 callback.onError(remoting.Error.UNEXPECTED); 132 callback.onError(remoting.Error.NOT_AUTHENTICATED);
134 } 133 }
135 return; 134 return;
136 } 135 }
137 136
138 // If there's no token, but we haven't yet prompted for permission, do so 137 // If there's no token, but we haven't yet prompted for permission, do so
139 // now. The consent callback is responsible for continuing the auth flow. 138 // now. The consent callback is responsible for continuing the auth flow.
140 this.consentCallback_(this.onAuthContinue_.bind(this)); 139 this.consentCallback_(this.onAuthContinue_.bind(this));
141 }; 140 };
142 141
143 /** 142 /**
(...skipping 23 matching lines...) Expand all
167 }; 166 };
168 167
169 /** 168 /**
170 * Returns whether the web app has authenticated with the Google services. 169 * Returns whether the web app has authenticated with the Google services.
171 * 170 *
172 * @return {boolean} 171 * @return {boolean}
173 */ 172 */
174 remoting.Identity.prototype.isAuthenticated = function() { 173 remoting.Identity.prototype.isAuthenticated = function() {
175 return remoting.identity.email_ != null; 174 return remoting.identity.email_ != null;
176 }; 175 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698