Fix callback after destruction of native ContentViewRenderView.
[chromium-blink-merge.git] / ppapi / c / ppp_messaging.h
blobb2e1f3cea22ec60b9d8bd5cc85e5d06de47811b1
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 Tue May 21 09:01:17 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
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> 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
51 * plugin.
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, including
56 * reference cycles if they exist. Since <code>PP_Var</code>s are ref-counted,
57 * the author of the plugin must take care if they expect to receive vars with
58 * cycles. Cycles must be manually broken to correctly release the vars.
60 * The following JavaScript code invokes <code>HandleMessage</code>, passing
61 * the module instance on which it was invoked, with <code>message</code>
62 * being a string <code>PP_Var</code> containing "Hello world!"
64 * <strong>Example:</strong>
66 * @code
68 * <body>
69 * <object id="plugin"
70 * type="application/x-ppapi-postMessage-example"/>
71 * <script type="text/javascript">
72 * document.getElementById('plugin').postMessage("Hello world!");
73 * </script>
74 * </body>
76 * @endcode
79 void (*HandleMessage)(PP_Instance instance, struct PP_Var message);
82 typedef struct PPP_Messaging_1_0 PPP_Messaging;
83 /**
84 * @}
87 #endif /* PPAPI_C_PPP_MESSAGING_H_ */