Index: remoting/webapp/client_plugin_async.js |
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js |
index e9b1f6564bb65678d8433516493f0eb0caa44f77..78c6962c2e09b18478937b6de69966d072c68683 100644 |
--- a/remoting/webapp/client_plugin_async.js |
+++ b/remoting/webapp/client_plugin_async.js |
@@ -40,6 +40,13 @@ remoting.ClientPluginAsync = function(plugin) { |
this.onConnectionStatusUpdateHandler = function(state, error) {}; |
/** @param {boolean} ready Connection ready state. */ |
this.onConnectionReadyHandler = function(ready) {}; |
+ /** |
+ * @param {string} tokenUrl Token-request URL, received from the host. |
+ * @param {string} hostPublicKey Public key for the host. |
+ * @param {string} scope OAuth scope to request the token for. |
+ */ |
+ this.fetchThirdPartyTokenHandler = function( |
+ tokenUrl, hostPublicKey, scope) {}; |
this.onDesktopSizeUpdateHandler = function () {}; |
this.fetchPinHandler = function () {}; |
@@ -208,6 +215,18 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) { |
this.onConnectionReadyHandler(ready); |
} else if (message.method == 'fetchPin') { |
this.fetchPinHandler(); |
+ } else if (message.method == 'fetchThirdPartyToken') { |
+ if (typeof message.data['tokenUrl'] != 'string' || |
+ typeof message.data['hostPublicKey'] != 'string' || |
+ typeof message.data['scope'] != 'string') { |
+ console.error('Received incorrect fetchThirdPartyToken message.'); |
+ return; |
+ } |
+ var tokenUrl = /** @type {string} */ message.data['tokenUrl']; |
+ var hostPublicKey = |
+ /** @type {string} */ message.data['hostPublicKey']; |
+ var scope = /** @type {string} */ message.data['scope']; |
+ this.fetchThirdPartyTokenHandler(tokenUrl, hostPublicKey, scope); |
} |
}; |
@@ -464,6 +483,19 @@ remoting.ClientPluginAsync.prototype.useAsyncPinDialog = |
}; |
/** |
+ * Sets the third party authentication token and shared secret. |
+ * |
+ * @param {string} token The token received from the token URL. |
+ * @param {string} sharedSecret Shared secret received from the token URL. |
+ */ |
+remoting.ClientPluginAsync.prototype.onThirdPartyTokenFetched = function( |
+ token, sharedSecret) { |
+ this.plugin.postMessage(JSON.stringify( |
+ { method: 'onThirdPartyTokenFetched', |
+ data: { token: token, sharedSecret: sharedSecret}})); |
+}; |
+ |
+/** |
* 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. |