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

Unified Diff: ppapi/c/ppp_instance.h

Issue 6538028: A proposal for an initial postMessage interface. This will allow JavaScript ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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: ppapi/c/ppp_instance.h
===================================================================
--- ppapi/c/ppp_instance.h (revision 77426)
+++ ppapi/c/ppp_instance.h (working copy)
@@ -13,12 +13,15 @@
struct PP_InputEvent;
struct PP_Var;
-#define PPP_INSTANCE_INTERFACE "PPP_Instance;0.4"
+#define PPP_INSTANCE_INTERFACE_0_4 "PPP_Instance;0.4"
+#define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5"
+#define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_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,10 +175,53 @@
* @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);
};
/**
* @}
*/
+/* This version exists to help provide backwards compatibility. */
+struct PPP_Instance_0_4 {
+ PP_Bool (*DidCreate)(PP_Instance instance,
+ uint32_t argc,
+ const char* argn[],
+ const char* argv[]);
+ void (*DidDestroy)(PP_Instance instance);
+ void (*DidChangeView)(PP_Instance instance,
+ const struct PP_Rect* position,
+ const struct PP_Rect* clip);
+ void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus);
+ PP_Bool (*HandleInputEvent)(PP_Instance instance,
+ const struct PP_InputEvent* event);
+ PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
+ struct PP_Var (*GetInstanceObject)(PP_Instance instance);
+};
+
#endif /* PPAPI_C_PPP_INSTANCE_H_ */

Powered by Google App Engine
This is Rietveld 408576698