OLD | NEW |
(Empty) | |
| 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 |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 #ifndef PPAPI_C_DEV_PPP_MESSAGING_DEV_H_ |
| 6 #define PPAPI_C_DEV_PPP_MESSAGING_DEV_H_ |
| 7 |
| 8 #include "ppapi/c/pp_instance.h" |
| 9 |
| 10 struct PP_Var; |
| 11 |
| 12 #define PPP_MESSAGING_DEV_INTERFACE_0_1 "PPP_Messaging_Dev;0.1" |
| 13 |
| 14 #define PPP_MESSAGING_DEV_INTERFACE PPP_MESSAGING_DEV_INTERFACE_0_1 |
| 15 |
| 16 /** |
| 17 * @file |
| 18 * This file defines the PPP_Messaging_Dev structure - a series of pointers to |
| 19 * methods that you must implement in your module instance if you wish to |
| 20 * handle messages posted to the module instance via calls to postMessage on |
| 21 * the DOM element associated with the module instance. |
| 22 * |
| 23 */ |
| 24 |
| 25 /** @addtogroup Interfaces |
| 26 * @{ |
| 27 */ |
| 28 |
| 29 /** |
| 30 * The PPP_Messaging_Dev interface contains pointers to a series of functions |
| 31 * that you must implement if you wish to handle messages posted to the module |
| 32 * instance via calls to postMessage on the DOM element associated with the |
| 33 * module instance. |
| 34 */ |
| 35 struct PPP_Messaging_Dev { |
| 36 /** |
| 37 * HandleMessage is a pointer to a function that the browser will call when |
| 38 * @a postMessage() is invoked on the DOM object for the module instance in |
| 39 * JavaScript. Note that @a postMessage() in the JavaScript interface is |
| 40 * asynchronous, meaning JavaScript execution will not be blocked while |
| 41 * @a HandleMessage() is processing the given @a message. |
| 42 * |
| 43 * For example: |
| 44 * |
| 45 * \verbatim |
| 46 * |
| 47 * <body> |
| 48 * <object id="plugin" |
| 49 * type="application/x-ppapi-postMessage-example"/> |
| 50 * <script type="text/javascript"> |
| 51 * document.getElementById('plugin').postMessage("Hello world!"); |
| 52 * </script> |
| 53 * </body> |
| 54 * |
| 55 * \endverbatim |
| 56 * |
| 57 * This will result in HandleMessage being invoked, passing the module |
| 58 * instance on which it was invoked, with message being a string PP_Var |
| 59 * containing "Hello world!". |
| 60 */ |
| 61 void (*HandleMessage)(PP_Instance instance, struct PP_Var message); |
| 62 }; |
| 63 /** |
| 64 * @} |
| 65 */ |
| 66 #endif /* PPAPI_C_DEV_PPP_MESSAGING_DEV_H_ */ |
| 67 |
OLD | NEW |