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..e9b1f6564bb65678d8433516493f0eb0caa44f77 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.ASYNC_PIN)) { |
+ 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.ASYNC_PIN)) { |
+ 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. |