Index: remoting/webapp/client_session.js |
diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js |
index bbc428a8374a3fd30c33d86465a93f28716bba00..d3d7f8562cc0cb9d19da371fe099006331a79dbc 100644 |
--- a/remoting/webapp/client_session.js |
+++ b/remoting/webapp/client_session.js |
@@ -362,7 +362,8 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) { |
this.onConnectionReady_.bind(this); |
this.plugin.onDesktopSizeUpdateHandler = |
this.onDesktopSizeChanged_.bind(this); |
- |
+ this.plugin.fetchThirdPartyTokenHandler = |
+ this.fetchThirdPartyToken_.bind(this); |
this.connectPluginToWcs_(); |
}; |
@@ -698,7 +699,30 @@ remoting.ClientSession.prototype.onConnectionReady_ = function(ready) { |
} else { |
this.plugin.element().classList.remove("session-client-inactive"); |
} |
-} |
+}; |
+ |
+/** |
+ * Callback that the plugin invokes when a token is required by a host. |
+ * |
+ * @private |
+ * @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. |
+ */ |
+remoting.ClientSession.prototype.fetchThirdPartyToken_ = function( |
+ tokenUrl, hostPublicKey, scope) { |
+ /** @type {remoting.ClientSession} */ |
+ var that = this; |
Jamie
2013/03/28 23:29:36
I think this would be clearer using bind:
this.pl
rmsousa
2013/03/29 04:08:21
Done.
|
+ var onThirdPartyTokenFetched = |
+ /** @param {string} token |
+ * @param {string} sharedSecret */ |
+ function(token, sharedSecret) { |
+ that.plugin.onThirdPartyTokenFetched(token, sharedSecret); |
+ }; |
+ var thirdPartyTokenFetcher = new remoting.ThirdPartyTokenFetcher( |
+ tokenUrl, hostPublicKey, scope, onThirdPartyTokenFetched); |
+ thirdPartyTokenFetcher.fetchToken(); |
+}; |
/** |
* @private |