| 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 |
| 15 // identity API (http://crbug.com/ 134213). |
| 16 |
| 14 'use strict'; | 17 'use strict'; |
| 15 | 18 |
| 16 /** @suppress {duplicate} */ | 19 /** @suppress {duplicate} */ |
| 17 var remoting = remoting || {}; | 20 var remoting = remoting || {}; |
| 18 | 21 |
| 19 /** @type {remoting.OAuth2} */ | 22 /** @type {remoting.OAuth2} */ |
| 20 remoting.oauth2 = null; | 23 remoting.oauth2 = null; |
| 21 | 24 |
| 22 | 25 |
| 23 /** @constructor */ | 26 /** @constructor */ |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 * @return {?string} The email address, if it has been cached by a previous call | 553 * @return {?string} The email address, if it has been cached by a previous call |
| 551 * to getEmail, otherwise null. | 554 * to getEmail, otherwise null. |
| 552 */ | 555 */ |
| 553 remoting.OAuth2.prototype.getCachedEmail = function() { | 556 remoting.OAuth2.prototype.getCachedEmail = function() { |
| 554 var value = window.localStorage.getItem(this.KEY_EMAIL_); | 557 var value = window.localStorage.getItem(this.KEY_EMAIL_); |
| 555 if (typeof value == 'string') { | 558 if (typeof value == 'string') { |
| 556 return value; | 559 return value; |
| 557 } | 560 } |
| 558 return null; | 561 return null; |
| 559 }; | 562 }; |
| OLD | NEW |