1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
6 /* From ppp_messaging.idl modified Wed Jun 5 10:32:43 2013. */
8 #ifndef PPAPI_C_PPP_MESSAGING_H_
9 #define PPAPI_C_PPP_MESSAGING_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_var.h"
17 #define PPP_MESSAGING_INTERFACE_1_0 "PPP_Messaging;1.0"
18 #define PPP_MESSAGING_INTERFACE PPP_MESSAGING_INTERFACE_1_0
22 * This file defines the PPP_Messaging interface containing pointers to
23 * functions that you must implement to handle postMessage messages
24 * on the associated DOM element.
30 * @addtogroup Interfaces
34 * The <code>PPP_Messaging</code> interface contains pointers to functions
35 * that you must implement to handle postMessage events on the associated
38 struct PPP_Messaging_1_0
{
40 * HandleMessage() is a function that the browser calls when PostMessage()
41 * is invoked on the DOM element for the module instance in JavaScript. Note
42 * that PostMessage() in the JavaScript interface is asynchronous, meaning
43 * JavaScript execution will not be blocked while HandleMessage() is
44 * processing the message.
46 * @param[in] instance A <code>PP_Instance</code> identifying one instance
48 * @param[in] message A <code>PP_Var</code> which has been converted from a
49 * JavaScript value. JavaScript array/object types are supported from Chrome
50 * M29 onward. All JavaScript values are copied when passing them to the
53 * When converting JavaScript arrays, any object properties whose name
54 * is not an array index are ignored. When passing arrays and objects, the
55 * entire reference graph will be converted and transferred. If the reference
56 * graph has cycles, the message will not be sent and an error will be logged
59 * The following JavaScript code invokes <code>HandleMessage</code>, passing
60 * the module instance on which it was invoked, with <code>message</code>
61 * being a string <code>PP_Var</code> containing "Hello world!"
63 * <strong>Example:</strong>
69 * type="application/x-ppapi-postMessage-example"/>
70 * <script type="text/javascript">
71 * document.getElementById('plugin').postMessage("Hello world!");
78 void (*HandleMessage
)(PP_Instance instance
, struct PP_Var message
);
81 typedef struct PPP_Messaging_1_0 PPP_Messaging
;
86 #endif /* PPAPI_C_PPP_MESSAGING_H_ */