Index: ppapi/c/dev/ppb_messaging_dev.h |
=================================================================== |
--- ppapi/c/dev/ppb_messaging_dev.h (revision 0) |
+++ ppapi/c/dev/ppb_messaging_dev.h (revision 0) |
@@ -0,0 +1,84 @@ |
+/* 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_DEV_PPB_MESSAGING_DEV_H_ |
+#define PPAPI_C_DEV_PPB_MESSAGING_DEV_H_ |
+ |
+#include "ppapi/c/pp_instance.h" |
+#include "ppapi/c/pp_var.h" |
+ |
+#define PPB_MESSAGING_DEV_INTERFACE_0_1 "PPB_Messaging(Dev);0.1" |
+ |
+#define PPB_MESSAGING_DEV_INTERFACE PPB_MESSAGING_DEV_INTERFACE_0_1 |
neb
2011/03/23 17:45:30
I agree with Polina - I'm actually against doing t
brettw
2011/03/23 17:51:39
Let's change this in a separate pass for every fil
dmichael(do not use this one)
2011/03/23 18:48:04
Okay, I made it match other interfaces.
|
+ |
+/** |
+ * @file |
+ * This file defines the PPB_Messaging_Dev interface implemented by the browser. |
+ * The PPB_Messaging_Dev interface contains pointers to functions related to |
+ * sending messages to the JavaScript onmessage handler on the DOM element |
+ * associated with a specific module instance. |
+ * |
+ * @addtogroup Interfaces |
+ * @{ |
+ */ |
+ |
+/** |
+ * The PPB_Messaging_Dev interface contains pointers to functions related to |
neb
2011/03/23 17:45:30
Since all our interfaces are pointers to functions
dmichael(do not use this one)
2011/03/23 18:48:04
I agree... but this is what docs folks have decid
polina
2011/03/24 05:42:33
I had the same concern in a code review I was doin
|
+ * sending messages to the JavaScript onmessage handler on the DOM element |
+ * associated with a specific module instance. |
+ */ |
+struct PPB_Messaging_Dev { |
+ /** |
+ * @a PostMessage is a pointer to a function which asynchronously invokes the |
neb
2011/03/23 17:45:30
Same as above, I think it's obvious that this is a
dmichael(do not use this one)
2011/03/23 18:48:04
Agreed, but I'm following what I think is establis
|
+ * onmessage handler on the DOM element for the given module instance, if one |
+ * exists. This means that a call to @a PostMessage will not block while the |
+ * message is processed. |
+ * |
+ * @a message is a PP_Var containing the data to be sent |
neb
2011/03/23 17:45:30
@param?
dmichael(do not use this one)
2011/03/23 18:48:04
Done.
|
+ * to JavaScript. Currently, it can have an int32_t, double, bool, or string |
+ * value (objects are not supported.) |
+ * |
+ * The onmessage handler in JavaScript code will receive an object conforming |
+ * to the MessageEvent interface. In particular, the value of @a message will |
+ * be contained as a property called @a data in the received MessageEvent. |
+ * This is analogous to listening for messages from Web Workers. |
+ * |
+ * See: |
+ * http://www.whatwg.org/specs/web-workers/current-work/ |
+ * |
+ * For example: |
+ * |
+ * \verbatim |
neb
2011/03/23 17:45:30
We're using @ elsewhere, so please use @verbratim
dmichael(do not use this one)
2011/03/23 18:48:04
Done.
|
+ * |
+ * <body> |
+ * <object id="plugin" |
+ * type="application/x-ppapi-postMessage-example"/> |
+ * <script type="text/javascript"> |
+ * document.getElementById('plugin').onmessage = function(message) { |
+ * alert(message.data); |
+ * } |
+ * </script> |
+ * </body> |
+ * |
+ * \endverbatim |
neb
2011/03/23 17:45:30
... and @endverbatim here.
dmichael(do not use this one)
2011/03/23 18:48:04
Done.
|
+ * |
+ * If the module instance then invokes @a PostMessage() as follows: |
+ * <code> |
neb
2011/03/23 17:45:30
You used @verbatim above, now <code>?
dmichael(do not use this one)
2011/03/23 18:48:04
I'm pretty new to doxygen stuff, so I'm making my
|
+ * char hello_world[] = "Hello world!"; |
+ * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance, |
+ * hello_world, |
+ * sizeof(hello_world)); |
+ * ppb_messaging_if->PostMessage(instance, hello_var); |
+ * </code> |
+ * |
+ * The browser will pop-up an alert saying "Hello world!". |
+ */ |
+ void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
+}; |
+/** |
+ * @} |
+ */ |
+ |
+#endif /* PPAPI_C_DEV_PPB_MESSAGING_DEV_H_ */ |
+ |
Property changes on: ppapi/c/dev/ppb_messaging_dev.h |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |