Index: ppapi/c/ppp_instance.h |
=================================================================== |
--- ppapi/c/ppp_instance.h (revision 77328) |
+++ ppapi/c/ppp_instance.h (working copy) |
@@ -13,12 +13,12 @@ |
struct PP_InputEvent; |
struct PP_Var; |
-#define PPP_INSTANCE_INTERFACE "PPP_Instance;0.4" |
+#define PPP_INSTANCE_INTERFACE "PPP_Instance;0.5" |
/** |
* @file |
- * This file defines the PPP_Instance structure - a series of points to methods |
- * that you must implement in your model. |
+ * This file defines the PPP_Instance structure - a series of pointers to |
+ * methods that you must implement in your module instance. |
* |
*/ |
@@ -172,6 +172,32 @@ |
* @return A PP_Var containing scriptable object. |
*/ |
struct PP_Var (*GetInstanceObject)(PP_Instance instance); |
+ |
+ /** |
+ * HandleMessage is a pointer to a function that the browser will call when |
+ * @a postMessage() is invoked on the DOM object for this module instance in |
+ * JavaScript. Note that @a postMessage() in the JavaScript interface is |
+ * asynchronous, meaning JavaScript execution will not be blocked while |
+ * @a HandleMessage() is processing the given @a message. |
+ * |
+ * For example: |
+ * |
+ * \verbatim |
+ * |
+ * <body> |
+ * <object id="plugin" |
+ * type="application/x-ppapi-postMessage-example"/> |
+ * <script type="text/javascript"> |
+ * document.getElementById('plugin').postMessage("Hello world!"); |
+ * </script> |
+ * </body> |
+ * |
+ * \endverbatim |
+ * |
+ * This will result in HandleMessage being invoked on the instance, with |
+ * message being a string PP_Var containing "Hello world!". |
+ */ |
+ void (*HandleMessage)(PP_Instance instance, struct PP_Var message); |
}; |
/** |
* @} |