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

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

Issue 963103004: Remove getCached* methods from remoting.Identity. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and jscompile fixes. 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
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/oauth2.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 /** 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';
11 11
12 /** @suppress {duplicate} */ 12 /** @suppress {duplicate} */
13 var remoting = remoting || {}; 13 var remoting = remoting || {};
14 14
15 /** 15 /**
16 * TODO(jamiewalch): Remove remoting.OAuth2 from this type annotation when
17 * the Apps v2 work is complete.
18 *
19 * @type {remoting.Identity} 16 * @type {remoting.Identity}
20 */ 17 */
21 remoting.identity = null; 18 remoting.identity = null;
22 19
23 /** 20 /**
24 * @param {remoting.Identity.ConsentDialog=} opt_consentDialog 21 * @param {remoting.Identity.ConsentDialog=} opt_consentDialog
25 * @constructor 22 * @constructor
26 */ 23 */
27 remoting.Identity = function(opt_consentDialog) { 24 remoting.Identity = function(opt_consentDialog) {
28 /** @private */ 25 /** @private */
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 * @return {!Promise<string>} Promise resolved with the user's email 153 * @return {!Promise<string>} Promise resolved with the user's email
157 * address or rejected with a remoting.Error. 154 * address or rejected with a remoting.Error.
158 */ 155 */
159 remoting.Identity.prototype.getEmail = function() { 156 remoting.Identity.prototype.getEmail = function() {
160 return this.getUserInfo().then(function(userInfo) { 157 return this.getUserInfo().then(function(userInfo) {
161 return userInfo.email; 158 return userInfo.email;
162 }); 159 });
163 }; 160 };
164 161
165 /** 162 /**
166 * Gets the user's email address, or null if no successful call to
167 * getUserInfo has been made.
168 *
169 * @return {?string} The cached email address, if available.
170 */
171 remoting.Identity.prototype.getCachedEmail = function() {
172 return this.email_;
173 };
174
175 /**
176 * Gets the user's full name.
177 *
178 * This will return null if either:
179 * No successful call to getUserInfo has been made, or
180 * The webapp doesn't have permission to access this value.
181 *
182 * @return {?string} The cached user's full name, if available.
183 */
184 remoting.Identity.prototype.getCachedUserFullName = function() {
185 return this.fullName_;
186 };
187
188 /**
189 * Callback for the getAuthToken API. 163 * Callback for the getAuthToken API.
190 * 164 *
191 * @param {boolean} interactive The value of the "interactive" parameter to 165 * @param {boolean} interactive The value of the "interactive" parameter to
192 * getAuthToken. 166 * getAuthToken.
193 * @param {?string} token The auth token, or null if the request failed. 167 * @param {?string} token The auth token, or null if the request failed.
194 * @private 168 * @private
195 */ 169 */
196 remoting.Identity.prototype.onAuthComplete_ = function(interactive, token) { 170 remoting.Identity.prototype.onAuthComplete_ = function(interactive, token) {
197 var authTokenDeferred = this.authTokenDeferred_; 171 var authTokenDeferred = this.authTokenDeferred_;
198 172
(...skipping 28 matching lines...) Expand all
227 }; 201 };
228 202
229 /** 203 /**
230 * Returns whether the web app has authenticated with the Google services. 204 * Returns whether the web app has authenticated with the Google services.
231 * 205 *
232 * @return {boolean} 206 * @return {boolean}
233 */ 207 */
234 remoting.Identity.prototype.isAuthenticated = function() { 208 remoting.Identity.prototype.isAuthenticated = function() {
235 return remoting.identity.email_ !== ''; 209 return remoting.identity.email_ !== '';
236 }; 210 };
OLDNEW
« no previous file with comments | « remoting/webapp/crd/js/host_screen.js ('k') | remoting/webapp/crd/js/oauth2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698