| OLD | NEW |
| 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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 }); | 150 }); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * Gets the user's email address. | 154 * Gets the user's email address. |
| 155 * | 155 * |
| 156 * @return {!Promise<string>} Promise resolved with the user's email | 156 * @return {!Promise<string>} Promise resolved with the user's email |
| 157 * address or rejected with a remoting.Error. | 157 * address or rejected with a remoting.Error. |
| 158 */ | 158 */ |
| 159 remoting.Identity.prototype.getEmail = function() { | 159 remoting.Identity.prototype.getEmail = function() { |
| 160 this.getUserInfo().then(function(userInfo) { | 160 return this.getUserInfo().then(function(userInfo) { |
| 161 return userInfo.email; | 161 return userInfo.email; |
| 162 }); | 162 }); |
| 163 }; | 163 }; |
| 164 | 164 |
| 165 /** | 165 /** |
| 166 * Gets the user's email address, or null if no successful call to | 166 * Gets the user's email address, or null if no successful call to |
| 167 * getUserInfo has been made. | 167 * getUserInfo has been made. |
| 168 * | 168 * |
| 169 * @return {?string} The cached email address, if available. | 169 * @return {?string} The cached email address, if available. |
| 170 */ | 170 */ |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 }; | 229 }; |
| 230 | 230 |
| 231 /** | 231 /** |
| 232 * Returns whether the web app has authenticated with the Google services. | 232 * Returns whether the web app has authenticated with the Google services. |
| 233 * | 233 * |
| 234 * @return {boolean} | 234 * @return {boolean} |
| 235 */ | 235 */ |
| 236 remoting.Identity.prototype.isAuthenticated = function() { | 236 remoting.Identity.prototype.isAuthenticated = function() { |
| 237 return remoting.identity.email_ !== ''; | 237 return remoting.identity.email_ !== ''; |
| 238 }; | 238 }; |
| OLD | NEW |