Chromium Code Reviews| Index: remoting/client/appengine/static_files/chromoting_session.js |
| diff --git a/remoting/client/appengine/static_files/chromoting_session.js b/remoting/client/appengine/static_files/chromoting_session.js |
| index b6960dfedd0765e8682b53f47a8c29e2a248308e..b55071f94678f751db9f6c9430b29c9134ce4805 100644 |
| --- a/remoting/client/appengine/static_files/chromoting_session.js |
| +++ b/remoting/client/appengine/static_files/chromoting_session.js |
| @@ -6,6 +6,16 @@ |
| // Only the most recent <n> lines are displayed. |
| var MAX_DEBUG_LOG_SIZE = 1000; |
| +// Chromoting session API version (for this javascript). |
| +// This is compared with the plugin API version to verify that they are |
| +// compatible. |
| +chromoting.apiVersion = 42; |
|
Jamie
2011/05/25 00:29:34
Apart from the HHGTTG reference, why 42? Left-over
garykac
2011/05/25 16:39:44
Indeed. leftover debugging. I fixed up the webapp
|
| + |
| +// The oldest API version that we support. |
| +// This will differ from the |apiVersion| if we decide to maintain backward |
| +// compatibility with older API versions. |
| +chromoting.apiMinVersion = 1; |
| + |
| // Message id so that we can identify (and ignore) message fade operations for |
| // old messages. This starts at 1 and is incremented for each new message. |
| chromoting.messageId = 1; |
| @@ -94,6 +104,11 @@ function sendIq(msg) { |
| "&host_jid=" + encodeURIComponent(chromoting.hostjid)); |
| } |
| +function checkVersion(plugin) { |
| + return chromoting.apiVersion >= plugin.apiMinVersion && |
| + plugin.apiVersion >= chromoting.apiMinVersion; |
| +} |
| + |
| function init() { |
| // Kick off the connection. |
| var plugin = document.getElementById('chromoting'); |
| @@ -124,6 +139,12 @@ function init() { |
| plugin.desktopSizeUpdate = desktopSizeChanged; |
| plugin.loginChallenge = loginChallengeCallback; |
| + if (!checkVersion(plugin)) { |
| + // TODO(garykac): We need better messaging here. Perhaps an install link. |
| + setClientStateMessage("Out of date. Please re-install."); |
| + return; |
| + } |
| + |
| addToDebugLog('Connect to ' + chromoting.hostname + ' as user ' + |
| chromoting.username); |