[PPAPI] Documentation fixes.
[chromium-blink-merge.git] / ppapi / c / ppp_messaging.h
blob1448bb11b3735e8de4083a67c5cff6e65b9d0d97
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.
4 */
6 /* From ppp_messaging.idl modified Wed Jan 25 11:41:09 2012. */
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
20 /**
21 * @file
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.
29 /**
30 * @addtogroup Interfaces
31 * @{
33 /**
34 * The <code>PPP_Messaging</code> interface contains pointers to functions
35 * that you must implement to handle postMessage events on the associated
36 * DOM element.
38 struct PPP_Messaging_1_0 {
39 /**
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
47 * of a module.
48 * @param[in] message A <code>PP_Var</code> containing the data to be sent
49 * to JavaScript. Message can have an int32_t, double, bool, or string value
50 * (objects are not supported).
52 * The following JavaScript code invokes <code>HandleMessage</code>, passing
53 * the module instance on which it was invoked, with <code>message</code>
54 * being a string <code>PP_Var</code> containing "Hello world!"
56 * <strong>Example:</strong>
58 * @code
60 * <body>
61 * <object id="plugin"
62 * type="application/x-ppapi-postMessage-example"/>
63 * <script type="text/javascript">
64 * document.getElementById('plugin').postMessage("Hello world!");
65 * </script>
66 * </body>
68 * @endcode
71 void (*HandleMessage)(PP_Instance instance, struct PP_Var message);
74 typedef struct PPP_Messaging_1_0 PPP_Messaging;
75 /**
76 * @}
79 #endif /* PPAPI_C_PPP_MESSAGING_H_ */