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'; |
11 | 11 |
12 /** @suppress {duplicate} */ | 12 /** @suppress {duplicate} */ |
13 var remoting = remoting || {}; | 13 var remoting = remoting || {}; |
14 | 14 |
15 /** | 15 /** |
16 * @type {remoting.Identity} | 16 * @type {remoting.Identity} |
17 */ | 17 */ |
18 remoting.identity = null; | 18 remoting.identity = null; |
19 | 19 |
20 /** | 20 /** |
21 * @param {remoting.Identity.ConsentDialog=} opt_consentDialog | 21 * @param {remoting.Identity.ConsentDialog=} opt_consentDialog |
22 * @constructor | 22 * @constructor |
23 */ | 23 */ |
24 remoting.Identity = function(opt_consentDialog) { | 24 remoting.Identity = function(opt_consentDialog) { |
25 /** @private */ | 25 /** @private */ |
26 this.consentDialog_ = opt_consentDialog; | 26 this.consentDialog_ = opt_consentDialog; |
27 /** @type {string} @private */ | 27 /** @private {string} */ |
28 this.email_ = ''; | 28 this.email_ = ''; |
29 /** @type {string} @private */ | 29 /** @private {string} */ |
30 this.fullName_ = ''; | 30 this.fullName_ = ''; |
31 /** @type {base.Deferred<string>} */ | 31 /** @type {base.Deferred<string>} */ |
32 this.authTokenDeferred_ = null; | 32 this.authTokenDeferred_ = null; |
33 }; | 33 }; |
34 | 34 |
35 /** | 35 /** |
36 * chrome.identity.getAuthToken should be initiated from user interactions if | 36 * chrome.identity.getAuthToken should be initiated from user interactions if |
37 * called with interactive equals true. This interface prompts a dialog for | 37 * called with interactive equals true. This interface prompts a dialog for |
38 * the user's consent. | 38 * the user's consent. |
39 * | 39 * |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 }; | 201 }; |
202 | 202 |
203 /** | 203 /** |
204 * Returns whether the web app has authenticated with the Google services. | 204 * Returns whether the web app has authenticated with the Google services. |
205 * | 205 * |
206 * @return {boolean} | 206 * @return {boolean} |
207 */ | 207 */ |
208 remoting.Identity.prototype.isAuthenticated = function() { | 208 remoting.Identity.prototype.isAuthenticated = function() { |
209 return remoting.identity.email_ !== ''; | 209 return remoting.identity.email_ !== ''; |
210 }; | 210 }; |
OLD | NEW |