| Index: remoting/webapp/client_session.js
|
| diff --git a/remoting/webapp/client_session.js b/remoting/webapp/client_session.js
|
| index 3579b0d55327a22961752911e0d5bd42deeaa83d..400ae35e248a826948a8568e242dc051e171a90c 100644
|
| --- a/remoting/webapp/client_session.js
|
| +++ b/remoting/webapp/client_session.js
|
| @@ -166,6 +166,9 @@ remoting.ClientSession = function(container, hostDisplayName, accessCode,
|
| /** @type {remoting.GnubbyAuthHandler} @private */
|
| this.gnubbyAuthHandler_ = null;
|
|
|
| + /** @type {remoting.CastExtensionHandler} @private */
|
| + this.castExtensionHandler_ = null;
|
| +
|
| if (this.mode_ == remoting.ClientSession.Mode.IT2ME) {
|
| // Resize-to-client is not supported for IT2Me hosts.
|
| this.resizeToClientButton_.hidden = true;
|
| @@ -373,7 +376,8 @@ remoting.ClientSession.Capability = {
|
| // this.plugin_.notifyClientResolution().
|
| SEND_INITIAL_RESOLUTION: 'sendInitialResolution',
|
| RATE_LIMIT_RESIZE_REQUESTS: 'rateLimitResizeRequests',
|
| - VIDEO_RECORDER: 'videoRecorder'
|
| + VIDEO_RECORDER: 'videoRecorder',
|
| + CAST: 'casting'
|
| };
|
|
|
| /**
|
| @@ -587,6 +591,8 @@ remoting.ClientSession.prototype.onPluginInitialized_ = function(initialized) {
|
| this.plugin_.onSetCapabilitiesHandler = this.onSetCapabilities_.bind(this);
|
| this.plugin_.onGnubbyAuthHandler = this.processGnubbyAuthMessage_.bind(this);
|
| this.plugin_.updateMouseCursorImage = this.updateMouseCursorImage_.bind(this);
|
| + this.plugin_.onCastExtensionHandler =
|
| + this.processCastExtensionMessage_.bind(this);
|
| this.initiateConnection_();
|
| };
|
|
|
| @@ -1109,6 +1115,7 @@ remoting.ClientSession.prototype.setState_ = function(newState) {
|
| this.logToServer.logClientSessionStateChange(state, this.error_, this.mode_);
|
| if (this.state_ == remoting.ClientSession.State.CONNECTED) {
|
| this.createGnubbyAuthHandler_();
|
| + this.createCastExtensionHandler_();
|
| }
|
|
|
| this.raiseEvent(remoting.ClientSession.Events.stateChanged,
|
| @@ -1578,3 +1585,36 @@ remoting.ClientSession.prototype.getPluginPositionForTesting = function() {
|
| left: parseFloat(style.marginLeft)
|
| };
|
| };
|
| +
|
| +/**
|
| + * Send a cast extension message to the host.
|
| + * @param {Object} data The cast message data.
|
| + */
|
| +remoting.ClientSession.prototype.sendCastExtensionMessage = function(data) {
|
| + if (!this.plugin_)
|
| + return;
|
| + this.plugin_.sendClientMessage('cast_message', JSON.stringify(data));
|
| +};
|
| +
|
| +/**
|
| + * Process a remote cast extension message from the host.
|
| + * @param {string} data Remote cast extension data message.
|
| + * @private
|
| + */
|
| +remoting.ClientSession.prototype.processCastExtensionMessage_ = function(data) {
|
| + if (this.castExtensionHandler_) {
|
| + this.castExtensionHandler_.onMessage(data);
|
| + }
|
| +};
|
| +
|
| +/**
|
| + * Create a cast extension handler and inform the host that cast extension
|
| + * is supported.
|
| + * @private
|
| + */
|
| +remoting.ClientSession.prototype.createCastExtensionHandler_ = function() {
|
| + if(this.mode_ == remoting.ClientSession.Mode.ME2ME) {
|
| + this.castExtensionHandler_ = new remoting.CastExtensionHandler(this);
|
| + }
|
| +};
|
| +
|
|
|