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 * OAuth2 class that handles retrieval/storage of an OAuth2 token. | 7 * OAuth2 class that handles retrieval/storage of an OAuth2 token. |
8 * | 8 * |
9 * Uses a content script to trampoline the OAuth redirect page back into the | 9 * Uses a content script to trampoline the OAuth redirect page back into the |
10 * extension context. This works around the lack of native support for | 10 * extension context. This works around the lack of native support for |
11 * chrome-extensions in OAuth2. | 11 * chrome-extensions in OAuth2. |
12 */ | 12 */ |
13 | 13 |
14 // TODO(jamiewalch): Delete this code once Chromoting is a v2 app and uses the | 14 // TODO(jamiewalch): Delete this code once Chromoting is a v2 app and uses the |
15 // identity API (http://crbug.com/ 134213). | 15 // identity API (http://crbug.com/ 134213). |
16 | 16 |
17 'use strict'; | 17 'use strict'; |
18 | 18 |
19 /** @suppress {duplicate} */ | 19 /** @suppress {duplicate} */ |
20 var remoting = remoting || {}; | 20 var remoting = remoting || {}; |
21 | 21 |
22 /** @type {remoting.OAuth2} */ | 22 /** @type {remoting.OAuth2} */ |
23 remoting.oauth2 = null; | 23 remoting.oauth2 = null; |
24 | 24 |
25 | 25 |
26 /** @constructor */ | 26 /** @constructor |
27 * @extends {remoting.Identity} */ | |
kelvinp
2015/02/28 03:03:52
Nit: indent.
garykac
2015/02/28 03:28:23
Done.
| |
27 remoting.OAuth2 = function() { | 28 remoting.OAuth2 = function() { |
28 }; | 29 }; |
29 | 30 |
30 // Constants representing keys used for storing persistent state. | 31 // Constants representing keys used for storing persistent state. |
31 /** @private */ | 32 /** @private */ |
32 remoting.OAuth2.prototype.KEY_REFRESH_TOKEN_ = 'oauth2-refresh-token'; | 33 remoting.OAuth2.prototype.KEY_REFRESH_TOKEN_ = 'oauth2-refresh-token'; |
33 /** @private */ | 34 /** @private */ |
34 remoting.OAuth2.prototype.KEY_ACCESS_TOKEN_ = 'oauth2-access-token'; | 35 remoting.OAuth2.prototype.KEY_ACCESS_TOKEN_ = 'oauth2-access-token'; |
35 /** @private */ | 36 /** @private */ |
36 remoting.OAuth2.prototype.KEY_EMAIL_ = 'remoting-email'; | 37 remoting.OAuth2.prototype.KEY_EMAIL_ = 'remoting-email'; |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
466 * @return {?string} The user's full name, if it has been cached by a previous | 467 * @return {?string} The user's full name, if it has been cached by a previous |
467 * call to getUserInfo, otherwise null. | 468 * call to getUserInfo, otherwise null. |
468 */ | 469 */ |
469 remoting.OAuth2.prototype.getCachedUserFullName = function() { | 470 remoting.OAuth2.prototype.getCachedUserFullName = function() { |
470 var value = window.localStorage.getItem(this.KEY_FULLNAME_); | 471 var value = window.localStorage.getItem(this.KEY_FULLNAME_); |
471 if (typeof value == 'string') { | 472 if (typeof value == 'string') { |
472 return value; | 473 return value; |
473 } | 474 } |
474 return null; | 475 return null; |
475 }; | 476 }; |
OLD | NEW |