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. |