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

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

Issue 803653004: Update Chromoting to use /third_party/closure_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove unused types Created 5 years, 11 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 * @param {boolean} interactive The value of the "interactive" parameter to 156 * @param {boolean} interactive The value of the "interactive" parameter to
157 * getAuthToken. 157 * getAuthToken.
158 * @param {?string} token The auth token, or null if the request failed. 158 * @param {?string} token The auth token, or null if the request failed.
159 * @private 159 * @private
160 */ 160 */
161 remoting.Identity.prototype.onAuthComplete_ = function(interactive, token) { 161 remoting.Identity.prototype.onAuthComplete_ = function(interactive, token) {
162 // Pass the token to the callback(s) if it was retrieved successfully. 162 // Pass the token to the callback(s) if it was retrieved successfully.
163 if (token) { 163 if (token) {
164 while (this.pendingCallbacks_.length > 0) { 164 while (this.pendingCallbacks_.length > 0) {
165 var callback = /** @type {remoting.Identity.Callbacks} */ 165 var callback = /** @type {remoting.Identity.Callbacks} */
166 this.pendingCallbacks_.shift(); 166 (this.pendingCallbacks_.shift());
167 callback.onOk(token); 167 callback.onOk(token);
168 } 168 }
169 return; 169 return;
170 } 170 }
171 171
172 // If not, pass an error back to the callback(s) if we've already prompted the 172 // If not, pass an error back to the callback(s) if we've already prompted the
173 // user for permission. 173 // user for permission.
174 if (interactive) { 174 if (interactive) {
175 var error_message = 175 var error_message =
176 chrome.runtime.lastError ? chrome.runtime.lastError.message 176 chrome.runtime.lastError ? chrome.runtime.lastError.message
177 : 'Unknown error.'; 177 : 'Unknown error.';
178 console.error(error_message); 178 console.error(error_message);
179 while (this.pendingCallbacks_.length > 0) { 179 while (this.pendingCallbacks_.length > 0) {
180 var callback = /** @type {remoting.Identity.Callbacks} */ 180 var callback = /** @type {remoting.Identity.Callbacks} */
181 this.pendingCallbacks_.shift(); 181 (this.pendingCallbacks_.shift());
182 callback.onError(remoting.Error.NOT_AUTHENTICATED); 182 callback.onError(remoting.Error.NOT_AUTHENTICATED);
183 } 183 }
184 return; 184 return;
185 } 185 }
186 186
187 // If there's no token, but we haven't yet prompted for permission, do so 187 // If there's no token, but we haven't yet prompted for permission, do so
188 // now. The consent callback is responsible for continuing the auth flow. 188 // now. The consent callback is responsible for continuing the auth flow.
189 this.consentCallback_(this.onAuthContinue_.bind(this)); 189 this.consentCallback_(this.onAuthContinue_.bind(this));
190 }; 190 };
191 191
(...skipping 24 matching lines...) Expand all
216 }; 216 };
217 217
218 /** 218 /**
219 * Returns whether the web app has authenticated with the Google services. 219 * Returns whether the web app has authenticated with the Google services.
220 * 220 *
221 * @return {boolean} 221 * @return {boolean}
222 */ 222 */
223 remoting.Identity.prototype.isAuthenticated = function() { 223 remoting.Identity.prototype.isAuthenticated = function() {
224 return remoting.identity.email_ != null; 224 return remoting.identity.email_ != null;
225 }; 225 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698