Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1154)

Unified Diff: remoting/webapp/client_screen.js

Issue 9325087: Show error if plugin doesn't support PIN auth. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_screen.js
diff --git a/remoting/webapp/client_screen.js b/remoting/webapp/client_screen.js
index 80b15bd007c607bb3ddf97382cd49d2bdb4e40de..e03bb1767cb35114b9ddb18caff9a1c55d763721 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);
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698