OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * This file defines the PPP_Messaging interface containing pointers to | 7 * This file defines the PPP_Messaging interface containing pointers to |
8 * functions that you must implement to handle postMessage messages | 8 * functions that you must implement to handle postMessage messages |
9 * on the associated DOM element. | 9 * on the associated DOM element. |
10 * | 10 * |
(...skipping 18 matching lines...) Expand all Loading... |
29 * | 29 * |
30 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 30 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
31 * of a module. | 31 * of a module. |
32 * @param[in] message A <code>PP_Var</code> which has been converted from a | 32 * @param[in] message A <code>PP_Var</code> which has been converted from a |
33 * JavaScript value. JavaScript array/object types are supported from Chrome | 33 * JavaScript value. JavaScript array/object types are supported from Chrome |
34 * M29 onward. All JavaScript values are copied when passing them to the | 34 * M29 onward. All JavaScript values are copied when passing them to the |
35 * plugin. | 35 * plugin. |
36 * | 36 * |
37 * When converting JavaScript arrays, any object properties whose name | 37 * When converting JavaScript arrays, any object properties whose name |
38 * is not an array index are ignored. When passing arrays and objects, the | 38 * is not an array index are ignored. When passing arrays and objects, the |
39 * entire reference graph will be converted and transferred, including | 39 * entire reference graph will be converted and transferred. If the reference |
40 * reference cycles if they exist. Since <code>PP_Var</code>s are ref-counted, | 40 * graph has cycles, an undefined var will be sent instead and an error will |
41 * the author of the plugin must take care if they expect to receive vars with | 41 * be logged to the console. |
42 * cycles. Cycles must be manually broken to correctly release the vars. | |
43 * | 42 * |
44 * The following JavaScript code invokes <code>HandleMessage</code>, passing | 43 * The following JavaScript code invokes <code>HandleMessage</code>, passing |
45 * the module instance on which it was invoked, with <code>message</code> | 44 * the module instance on which it was invoked, with <code>message</code> |
46 * being a string <code>PP_Var</code> containing "Hello world!" | 45 * being a string <code>PP_Var</code> containing "Hello world!" |
47 * | 46 * |
48 * <strong>Example:</strong> | 47 * <strong>Example:</strong> |
49 * | 48 * |
50 * @code | 49 * @code |
51 * | 50 * |
52 * <body> | 51 * <body> |
53 * <object id="plugin" | 52 * <object id="plugin" |
54 * type="application/x-ppapi-postMessage-example"/> | 53 * type="application/x-ppapi-postMessage-example"/> |
55 * <script type="text/javascript"> | 54 * <script type="text/javascript"> |
56 * document.getElementById('plugin').postMessage("Hello world!"); | 55 * document.getElementById('plugin').postMessage("Hello world!"); |
57 * </script> | 56 * </script> |
58 * </body> | 57 * </body> |
59 * | 58 * |
60 * @endcode | 59 * @endcode |
61 * | 60 * |
62 */ | 61 */ |
63 void HandleMessage([in] PP_Instance instance, [in] PP_Var message); | 62 void HandleMessage([in] PP_Instance instance, [in] PP_Var message); |
64 }; | 63 }; |
65 | 64 |
OLD | NEW |