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