summaryrefslogtreecommitdiffstats
path: root/ppapi/c/ppp_messaging.h
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 21:36:23 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-04-08 21:36:23 +0000
commit5f2cb1c97b9ea8af6fbb3dae290da52597e806e4 (patch)
tree4eff2c5b59293a1d434e2624a39643629a06ac47 /ppapi/c/ppp_messaging.h
parent3c217ae1a9677660cacb51a21d88020f5bbb6047 (diff)
downloadchromium_src-5f2cb1c97b9ea8af6fbb3dae290da52597e806e4.zip
chromium_src-5f2cb1c97b9ea8af6fbb3dae290da52597e806e4.tar.gz
chromium_src-5f2cb1c97b9ea8af6fbb3dae290da52597e806e4.tar.bz2
Reupload of http://codereview.chromium.org/6801053/
My repo got messed up. BUG=None TEST=src/ppapi/tests/test_post_message.cc Review URL: http://codereview.chromium.org/6801053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80992 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/ppp_messaging.h')
-rw-r--r--ppapi/c/ppp_messaging.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/ppapi/c/ppp_messaging.h b/ppapi/c/ppp_messaging.h
new file mode 100644
index 0000000..29a1213
--- /dev/null
+++ b/ppapi/c/ppp_messaging.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#ifndef PPAPI_C_PPP_MESSAGING_H_
+#define PPAPI_C_PPP_MESSAGING_H_
+
+#include "ppapi/c/pp_instance.h"
+
+struct PP_Var;
+
+#define PPP_MESSAGING_INTERFACE "PPP_Messaging;0.1"
+
+/**
+ * @file
+ * This file defines the PPP_Messaging structure - a series of pointers to
+ * methods that you must implement if you wish to handle messages posted to the
+ * module instance via calls to postMessage on the associated DOM element.
+ *
+ */
+
+/** @addtogroup Interfaces
+ * @{
+ */
+
+/**
+ * The PPP_Messaging interface contains pointers to a series of functions
+ * that you must implement if you wish to handle messages posted to the module
+ * instance via calls to postMessage on the associated DOM element.
+ */
+struct PPP_Messaging {
+ /**
+ * HandleMessage is a pointer to a function that the browser will call when
+ * @a postMessage() is invoked on the DOM element for the 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 @a HandleMessage being invoked, passing the module
+ * instance on which it was invoked, with @a message being a string PP_Var
+ * containing "Hello world!".
+ */
+ void (*HandleMessage)(PP_Instance instance, struct PP_Var message);
+};
+/**
+ * @}
+ */
+#endif /* PPAPI_C_PPP_MESSAGING_H_ */
+