typedef struct XW_CoreInterface_1 XW_CoreInterface;
+/*
+ * XW_MESSAGING_INTERFACE_1 is no longer used in webapi-plugins
+ * but its declaration stays in this header, so that the dependencies
+ * of webapi-plugins-common can find the declaration in the XW_Extension.h
+ * they include.
+ */
+#define XW_MESSAGING_INTERFACE_1 "XW_MessagingInterface_1"
+
+typedef void (*XW_HandleMessageCallback)(XW_Instance instance, const char* message);
+
+struct XW_MessagingInterface_1 {
+ // Register a callback to be called when the JavaScript code associated
+ // with the extension posts a message. Note that the callback will be called
+ // with the XW_Instance that posted the message as well as the message
+ // contents.
+ void (*Register)(XW_Extension extension, XW_HandleMessageCallback handle_message);
+
+ // Post a message to the web content associated with the instance. To
+ // receive this message the extension's JavaScript code should set a
+ // listener using extension.setMessageListener() function.
+ //
+ // This function is thread-safe and can be called until the instance is
+ // destroyed.
+ void (*PostMessage)(XW_Instance instance, const char* message);
+};
+
//
// XW_MESSAGING_INTERFACE: Exchange asynchronous messages with JavaScript
// code provided by extension.