| 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 /** | 6 /** |
| 7 * @fileoverview | 7 * @fileoverview |
| 8 * A class that provides an interface to a WCS connection. | 8 * A class that provides an interface to a WCS connection. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 /** @type {remoting.Wcs} */ | 55 /** @type {remoting.Wcs} */ |
| 56 var that = this; | 56 var that = this; |
| 57 /** | 57 /** |
| 58 * A timer that polls for an updated access token. | 58 * A timer that polls for an updated access token. |
| 59 * @type {number} | 59 * @type {number} |
| 60 * @private | 60 * @private |
| 61 */ | 61 */ |
| 62 this.pollForUpdatedToken_ = setInterval( | 62 this.pollForUpdatedToken_ = setInterval( |
| 63 function() { | 63 function() { |
| 64 /** @param {string} token */ | 64 /** @param {string?} token */ |
| 65 var updateAccessToken = function(token) { | 65 var updateAccessToken = function(token) { |
| 66 that.updateAccessToken_(token); | 66 if (token) { |
| 67 that.updateAccessToken_(token); |
| 68 } else { |
| 69 console.error('pollForUpdatedToken: Authentication failed.'); |
| 70 // No need to update the token. The hanging GET will fail anyway. |
| 71 } |
| 67 } | 72 } |
| 68 remoting.oauth2.callWithToken(updateAccessToken); | 73 remoting.oauth2.callWithToken(updateAccessToken); |
| 69 }, | 74 }, |
| 70 60 * 1000); | 75 60 * 1000); |
| 71 | 76 |
| 72 /** | 77 /** |
| 73 * A function called when an IQ stanza is received. | 78 * A function called when an IQ stanza is received. |
| 74 * @param {string} stanza The IQ stanza. | 79 * @param {string} stanza The IQ stanza. |
| 75 * @private | 80 * @private |
| 76 */ | 81 */ |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 /** | 144 /** |
| 140 * Sets the function called when an IQ stanza is received. | 145 * Sets the function called when an IQ stanza is received. |
| 141 * | 146 * |
| 142 * @param {function(string): void} onIq The function called when an IQ stanza | 147 * @param {function(string): void} onIq The function called when an IQ stanza |
| 143 * is received. | 148 * is received. |
| 144 * @return {void} Nothing. | 149 * @return {void} Nothing. |
| 145 */ | 150 */ |
| 146 remoting.Wcs.prototype.setOnIq = function(onIq) { | 151 remoting.Wcs.prototype.setOnIq = function(onIq) { |
| 147 this.onIq_ = onIq; | 152 this.onIq_ = onIq; |
| 148 }; | 153 }; |
| OLD | NEW |