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

Unified Diff: remoting/webapp/client_plugin_async.js

Issue 22477006: Added JsonMessage to the control channel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/client_plugin_async.js
diff --git a/remoting/webapp/client_plugin_async.js b/remoting/webapp/client_plugin_async.js
index f457d159fe466b838744443b4fe2f846891b8271..ac82c9f914177d86e01e400e508e167c150b0621 100644
--- a/remoting/webapp/client_plugin_async.js
+++ b/remoting/webapp/client_plugin_async.js
@@ -313,6 +313,10 @@ remoting.ClientPluginAsync.prototype.handleMessage_ = function(messageStr) {
return;
}
this.onPairingComplete_(clientId, sharedSecret);
+ } else if (message.method == 'extensionMessage') {
+ // No messages currently supported.
+ console.log('Unexpected message received: ' +
+ message.data.type + ': ' + message.data.data);
}
};
@@ -607,6 +611,23 @@ remoting.ClientPluginAsync.prototype.requestPairing =
};
/**
+ * Send an extension message to the host.
+ *
+ * @param {string} type The message type.
+ * @param {Object} message The message payload.
+ */
+remoting.ClientPluginAsync.prototype.sendClientMessage =
+ function(type, message) {
+ if (!this.hasFeature(remoting.ClientPlugin.Feature.EXTENSION_MESSAGE)) {
+ return;
+ }
+ this.plugin.postMessage(JSON.stringify(
+ { method: 'extensionMessage',
+ data: { type: type, data: JSON.stringify(message) } }));
+
+};
+
+/**
* 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.
« no previous file with comments | « remoting/webapp/client_plugin.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698