| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 11 matching lines...) Expand all Loading... |
| 22 */ | 22 */ |
| 23 [version=0.1] | 23 [version=0.1] |
| 24 interface PPP_Messaging { | 24 interface PPP_Messaging { |
| 25 /** | 25 /** |
| 26 * HandleMessage() is a function that the browser calls when PostMessage() | 26 * HandleMessage() is a function that the browser calls when PostMessage() |
| 27 * is invoked on the DOM element for the module instance in JavaScript. Note | 27 * is invoked on the DOM element for the module instance in JavaScript. Note |
| 28 * that PostMessage() in the JavaScript interface is asynchronous, meaning | 28 * that PostMessage() in the JavaScript interface is asynchronous, meaning |
| 29 * JavaScript execution will not be blocked while HandleMessage() is | 29 * JavaScript execution will not be blocked while HandleMessage() is |
| 30 * processing the message. | 30 * processing the message. |
| 31 * | 31 * |
| 32 * @param[in] instance A <code>PP_Instance</code> indentifying one instance | 32 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
| 33 * of a module. | 33 * of a module. |
| 34 * @param[in] message A <code>PP_Var</code> containing the data to be sent | 34 * @param[in] message A <code>PP_Var</code> containing the data to be sent |
| 35 * to JavaScript. Message can have an int32_t, double, bool, or string value | 35 * to JavaScript. Message can have an int32_t, double, bool, or string value |
| 36 * (objects are not supported). | 36 * (objects are not supported). |
| 37 * | 37 * |
| 38 * <strong>Example:</strong> | |
| 39 * | |
| 40 * The following JavaScript code invokes <code>HandleMessage</code>, passing | 38 * The following JavaScript code invokes <code>HandleMessage</code>, passing |
| 41 * the module instance on which it was invoked, with <code>message</code> | 39 * the module instance on which it was invoked, with <code>message</code> |
| 42 * being a string <code>PP_Var</code> containing "Hello world!" | 40 * being a string <code>PP_Var</code> containing "Hello world!" |
| 43 * | 41 * |
| 44 * @code | 42 * <strong>Example:</strong> |
| 43 * |
| 44 * <code> |
| 45 * | 45 * |
| 46 * <body> | 46 * <body> |
| 47 * <object id="plugin" | 47 * <object id="plugin" |
| 48 * type="application/x-ppapi-postMessage-example"/> | 48 * type="application/x-ppapi-postMessage-example"/> |
| 49 * <script type="text/javascript"> | 49 * <script type="text/javascript"> |
| 50 * document.getElementById('plugin').postMessage("Hello world!"); | 50 * document.getElementById('plugin').postMessage("Hello world!"); |
| 51 * </script> | 51 * </script> |
| 52 * </body> | 52 * </body> |
| 53 * | 53 * |
| 54 * @endcode | 54 * </code> |
| 55 * | 55 * |
| 56 */ | 56 */ |
| 57 void HandleMessage([in] PP_Instance instance, [in] PP_Var message); | 57 void HandleMessage([in] PP_Instance instance, [in] PP_Var message); |
| 58 }; | 58 }; |
| 59 | 59 |
| OLD | NEW |