| 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 * The deserialized form of the chromoting host as returned by Apiary. | 7 * The deserialized form of the chromoting host as returned by Apiary. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 'use strict'; | 10 'use strict'; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 /** @type {string} */ | 27 /** @type {string} */ |
| 28 this.jabberId = ''; | 28 this.jabberId = ''; |
| 29 /** @type {string} */ | 29 /** @type {string} */ |
| 30 this.publicKey = ''; | 30 this.publicKey = ''; |
| 31 /** @type {string} */ | 31 /** @type {string} */ |
| 32 this.hostVersion = ''; | 32 this.hostVersion = ''; |
| 33 /** @type {Array.<string>} */ | 33 /** @type {Array.<string>} */ |
| 34 this.tokenUrlPatterns = []; | 34 this.tokenUrlPatterns = []; |
| 35 /** @type {string} */ | 35 /** @type {string} */ |
| 36 this.updatedTime = ''; | 36 this.updatedTime = ''; |
| 37 /** @type {string} */ |
| 38 this.hostOfflineReason = ''; |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 /** | 41 /** |
| 40 * Determine whether a host needs to be manually updated. This is the case if | 42 * Determine whether a host needs to be manually updated. This is the case if |
| 41 * the host's major version number is more than 1 lower than that of the web- | 43 * the host's major version number is more than 1 lower than that of the web- |
| 42 * app (a difference of 1 is tolerated due to the different update mechanisms) | 44 * app (a difference of 1 is tolerated due to the different update mechanisms) |
| 43 * and if the host is on-line (off-line hosts are not expected to auto-update). | 45 * and if the host is on-line (off-line hosts are not expected to auto-update). |
| 44 * | 46 * |
| 45 * @param {remoting.Host} host The host information from the directory. | 47 * @param {remoting.Host} host The host information from the directory. |
| 46 * @param {string|number} webappVersion The version number of the web-app, in | 48 * @param {string|number} webappVersion The version number of the web-app, in |
| 47 * either dotted-decimal notation notation, or directly represented by the | 49 * either dotted-decimal notation notation, or directly represented by the |
| 48 * major version. | 50 * major version. |
| 49 * @return {boolean} True if the host is on-line but out-of-date. | 51 * @return {boolean} True if the host is on-line but out-of-date. |
| 50 */ | 52 */ |
| 51 remoting.Host.needsUpdate = function(host, webappVersion) { | 53 remoting.Host.needsUpdate = function(host, webappVersion) { |
| 52 if (host.status != 'ONLINE') { | 54 if (host.status != 'ONLINE') { |
| 53 return false; | 55 return false; |
| 54 } | 56 } |
| 55 var hostMajorVersion = parseInt(host.hostVersion, 10); | 57 var hostMajorVersion = parseInt(host.hostVersion, 10); |
| 56 if (isNaN(hostMajorVersion)) { | 58 if (isNaN(hostMajorVersion)) { |
| 57 // Host versions 26 and higher include the version number in heartbeats, | 59 // Host versions 26 and higher include the version number in heartbeats, |
| 58 // so if it's missing then the host is at most version 25. | 60 // so if it's missing then the host is at most version 25. |
| 59 hostMajorVersion = 25; | 61 hostMajorVersion = 25; |
| 60 } | 62 } |
| 61 return (parseInt(webappVersion, 10) - hostMajorVersion) > 1; | 63 return (parseInt(webappVersion, 10) - hostMajorVersion) > 1; |
| 62 }; | 64 }; |
| OLD | NEW |