diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 04:01:00 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-07 04:01:00 +0000 |
commit | 50b82260d18b63c6678ea8bb8f90410cffb4b0b4 (patch) | |
tree | fe0f5fa318fe120e26994610ed928dd6af9e2445 /remoting/webapp/client_screen.js | |
parent | 099a5ca5f24b8458da27ae32d7fa1f56e8d55f15 (diff) | |
download | chromium_src-50b82260d18b63c6678ea8bb8f90410cffb4b0b4.zip chromium_src-50b82260d18b63c6678ea8bb8f90410cffb4b0b4.tar.gz chromium_src-50b82260d18b63c6678ea8bb8f90410cffb4b0b4.tar.bz2 |
Show error if plugin doesn't support PIN auth.
Review URL: https://chromiumcodereview.appspot.com/9325087
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/webapp/client_screen.js')
-rw-r--r-- | remoting/webapp/client_screen.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/remoting/webapp/client_screen.js b/remoting/webapp/client_screen.js index 80b15bd..e03bb17 100644 --- a/remoting/webapp/client_screen.js +++ b/remoting/webapp/client_screen.js @@ -404,6 +404,21 @@ function updateStatistics_() { window.setTimeout(updateStatistics_, 1000); } +/** + * @return {boolean} true if the client plugin supports PIN auth. + */ +remoting.isPinAuthSupported = function () { + var plugin = /** @type {remoting.ViewerPlugin} */ + document.createElement('embed'); + plugin.src = 'about://none'; + plugin.type = 'pepper-application/x-chromoting'; + plugin.width = 0; + plugin.height = 0; + document.body.appendChild(plugin); + var version = plugin.apiVersion; + document.body.removeChild(plugin); + return version && version >= 4; +}; /** * Shows PIN entry screen. @@ -419,7 +434,11 @@ remoting.connectMe2Me = function(hostId, retryIfOffline) { remoting.hostId = hostId; remoting.retryIfOffline = retryIfOffline; - // TODO(sergeyu): Ask pin only when it is necessary: crbug.com/111290 . + if (!remoting.isPinAuthSupported()) { + showConnectError_(remoting.Error.BAD_PLUGIN_VERSION); + return; + } + remoting.setMode(remoting.AppMode.CLIENT_PIN_PROMPT); }; |