Chromium Code Reviews| Index: remoting/webapp/crd/js/identity.js |
| diff --git a/remoting/webapp/crd/js/identity.js b/remoting/webapp/crd/js/identity.js |
| index 0421410448a5ce7660487b695d1a6b541ecc0e50..84db4c74d76b0713c255586f6ee1f168983d96cf 100644 |
| --- a/remoting/webapp/crd/js/identity.js |
| +++ b/remoting/webapp/crd/js/identity.js |
| @@ -21,7 +21,7 @@ var remoting = remoting || {}; |
| remoting.identity = null; |
| /** |
| - * @param {remoting.Identity.ConsentDialog} consentDialog |
| + * @param {remoting.Identity.ConsentDialog=} consentDialog |
|
dcaiafa
2015/02/04 00:12:35
nit: According to the Google style guide, optional
kelvinp
2015/02/04 00:38:13
Done.
|
| * @constructor |
| */ |
| remoting.Identity = function(consentDialog) { |
| @@ -36,7 +36,7 @@ remoting.Identity = function(consentDialog) { |
| }; |
| /** |
| - * chrome.identity.getAuthToken must be initiated from user interactions if |
| + * chrome.identity.getAuthToken should be initiated from user interactions if |
| * called with interactive equals true. This interface prompts a dialog for |
| * the user's consent. |
| * |
| @@ -223,7 +223,9 @@ remoting.Identity.prototype.onAuthComplete_ = function(interactive, token) { |
| // If there's no token, but we haven't yet prompted for permission, do so |
| // now. |
| var that = this; |
| - this.consentDialog_.show().then(function() { |
| + var showConsentDialog = |
| + (this.consentDialog_) ? this.consentDialog_.show() : Promise.resolve(); |
| + showConsentDialog.then(function() { |
| chrome.identity.getAuthToken({'interactive': true}, |
| that.onAuthComplete_.bind(that, true)); |
| }); |