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

Unified Diff: remoting/webapp/client_plugin_async.js

Issue 12867004: Webapp changes to support asking for a PIN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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
Index: remoting/webapp/client_plugin_async.js
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index bdda43331a69d334967aad471c8d37269c704256..cd7e1c0e380c0ac8ce6ff9e59ada6e0ba7eb40d7 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -41,6 +41,7 @@ remoting.ClientPluginAsync = function(plugin) {
/** @param {boolean} ready Connection ready state. */
this.onConnectionReadyHandler = function(ready) {};
this.onDesktopSizeUpdateHandler = function () {};
+ this.fetchPinHandler = function () {};
/** @type {number} */
this.pluginApiVersion_ = -1;
@@ -205,8 +206,10 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
}
var ready = /** @type {boolean} */ message.data['ready'];
this.onConnectionReadyHandler(ready);
+ } else if (message.method == 'fetchPin') {
+ this.fetchPinHandler();
}
-}
+};
/**
* Deletes the plugin.
@@ -435,6 +438,32 @@ remoting.ClientPluginAsync.prototype.pauseAudio =
};
/**
+ * Called when a PIN is obtained from the user.
+ *
+ * @param {string} pin The PIN.
+ */
+remoting.ClientPluginAsync.prototype.onPinFetched =
+ function(pin) {
+ if (!this.hasFeature(remoting.ClientPlugin.Feature.ON_PIN_FETCHED)) {
+ return;
+ }
+ this.plugin.postMessage(JSON.stringify(
+ { method: 'onPinFetched', data: { pin: pin }}));
+};
+
+/**
+ * Tells the plugin to ask for the PIN asynchronously.
+ */
+remoting.ClientPluginAsync.prototype.useAsyncPinDialog =
+ function() {
+ if (!this.hasFeature(remoting.ClientPlugin.Feature.USE_ASYNC_PIN_DIALOG)) {
+ return;
+ }
+ this.plugin.postMessage(JSON.stringify(
+ { method: 'useAsyncPinDialog', data: {} }));
+};
+
+/**
* If we haven't yet received a "hello" message from the plugin, change its
* size so that the user can confirm it if click-to-play is enabled, or can
* see the "this plugin is disabled" message if it is actually disabled.

Powered by Google App Engine
This is Rietveld 408576698