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