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

Unified Diff: remoting/webapp/client_session.js

Issue 464133003: CastExtensionHandler for Chromoting Webapp (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor Fixes Created 6 years, 4 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_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'
Jamie 2014/08/13 23:21:04 I think I would call this capability chromeCast (a
aiguha 2014/08/15 07:09:56 All the Cast docs avoid using Chromecast, because
Jamie 2014/08/15 18:45:43 How about GOOGLE_CAST, since that's the name of th
};
/**
@@ -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;
Jamie 2014/08/13 23:21:04 Braces for single-line conditionals, for consisten
aiguha 2014/08/15 07:09:56 sendClipboardItem and sendGnubbbyAuthMessage don't
Jamie 2014/08/15 18:45:43 I didn't realize they weren't consistent. Since th
+ this.plugin_.sendClientMessage('cast_message', JSON.stringify(data));
+};
+
+/**
+ * Process a remote cast extension message from the host.
Jamie 2014/08/13 23:21:04 s/cast/Cast/, here and below
aiguha 2014/08/15 07:09:56 Done.
+ * @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) {
Jamie 2014/08/13 23:21:04 Why is this restricted to Me2Me?
Jamie 2014/08/13 23:21:04 Nit: Space after 'if'
aiguha 2014/08/15 07:09:56 Done.
aiguha 2014/08/15 07:09:56 Only the remoting_me2me_host target supports the C
Jamie 2014/08/15 18:45:43 I didn't realize that. I think it's correct in tha
+ this.castExtensionHandler_ = new remoting.CastExtensionHandler(this);
+ }
+};
+

Powered by Google App Engine
This is Rietveld 408576698