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

Unified Diff: ppapi/c/ppb_messaging.h

Issue 252023009: PPAPI: Add dev synchronous JS->Plugin messaging API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use channel=dev instead of none Created 6 years, 7 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
« no previous file with comments | « ppapi/api/ppp_message_handler.idl ('k') | ppapi/c/ppp_message_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/ppb_messaging.h
diff --git a/ppapi/c/ppb_messaging.h b/ppapi/c/ppb_messaging.h
index 06e31205167eb495e54c51ebd5a9bafcb6c7731f..21c8467d5f5bb6b00f8e4e179076c07b9740bbf8 100644
--- a/ppapi/c/ppb_messaging.h
+++ b/ppapi/c/ppb_messaging.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From ppb_messaging.idl modified Wed Jun 5 10:32:59 2013. */
+/* From ppb_messaging.idl modified Mon Jun 2 11:00:28 2014. */
#ifndef PPAPI_C_PPB_MESSAGING_H_
#define PPAPI_C_PPB_MESSAGING_H_
@@ -11,10 +11,13 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppp_message_handler.h"
#define PPB_MESSAGING_INTERFACE_1_0 "PPB_Messaging;1.0"
+#define PPB_MESSAGING_INTERFACE_1_1 "PPB_Messaging;1.1" /* dev */
#define PPB_MESSAGING_INTERFACE PPB_MESSAGING_INTERFACE_1_0
/**
@@ -34,7 +37,7 @@
* and is related to sending messages to JavaScript message event listeners on
* the DOM element associated with specific module instance.
*/
-struct PPB_Messaging_1_0 {
+struct PPB_Messaging_1_1 { /* dev */
/**
* PostMessage() asynchronously invokes any listeners for message events on
* the DOM element for the given module instance. A call to PostMessage()
@@ -96,6 +99,66 @@ struct PPB_Messaging_1_0 {
* The browser will pop-up an alert saying "Hello world!"
*/
void (*PostMessage)(PP_Instance instance, struct PP_Var message);
+ /**
+ * <strong>Note:</strong> This function is not yet implemented. Please use
+ * PPB_Messaging_1_0.
+ *
+ * Registers a handler for receiving messages from JavaScript. If a handler
+ * is registered this way, it will replace PPP_Messaging, and all messages
+ * sent from JavaScript via postMessage and postMessageAndAwaitResponse will
+ * be dispatched to <code>handler</code>.
+ *
+ * The function calls will be dispatched via <code>message_loop</code>. This
+ * means that the functions will be invoked on the thread to which
+ * <code>message_loop</code> is attached, when <code>message_loop</code> is
+ * run. It is illegal to pass the main thread message loop;
+ * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case.
+ *
+ * Attempting to register a message handler when one is already registered
+ * will cause the current MessageHandler to be unregistered and replaced. In
+ * that case, no messages will be sent to the "default" message handler
+ * (PPP_Messaging). Messages will stop arriving at the prior message handler
+ * and will begin to be dispatched at the new message handler.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance
+ * of a module.
+ * @param[in] user_data A pointer the plugin may choose to use when handling
+ * calls to functions within PPP_MessageHandler. The browser will pass this
+ * same pointer when invoking functions within PPP_MessageHandler.
+ * @param[in] handler The plugin-provided set of functions for handling
+ * messages.
+ * @param[in] message_loop Represents the message loop on which
+ * PPP_MessageHandler functions should be invoked.
+ * @return PP_OK on success, or an error from pp_errors.h.
+ */
+ int32_t (*RegisterMessageHandler)(
+ PP_Instance instance,
+ void* user_data,
+ const struct PPP_MessageHandler_0_1* handler,
+ PP_Resource message_loop);
+ /**
+ * <strong>Note:</strong> This function is not yet implemented. Please use
+ * PPB_Messaging_1_0.
+ *
+ * Unregisters the current message handler for <code>instance</code> if one
+ * is registered. After this call, the message handler (if one was
+ * registered) will have "Destroy" called on it and will receive no further
+ * messages after that point. After that point, all messages sent from
+ * JavaScript using postMessage() will be dispatched to PPP_Messaging (if
+ * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call
+ * postMessageAndAwaitResponse() from JavaScript will fail.
+ *
+ * Attempting to unregister a message handler when none is registered has no
+ * effect.
+ *
+ * @param[in] instance A <code>PP_Instance</code> identifying one instance
+ * of a module.
+ */
+ void (*UnregisterMessageHandler)(PP_Instance instance);
+};
+
+struct PPB_Messaging_1_0 {
+ void (*PostMessage)(PP_Instance instance, struct PP_Var message);
};
typedef struct PPB_Messaging_1_0 PPB_Messaging;
« no previous file with comments | « ppapi/api/ppp_message_handler.idl ('k') | ppapi/c/ppp_message_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698