Chromium Code Reviews| 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 /* From ppb_messaging.idl modified Wed Oct 5 14:06:02 2011. */ | 6 /* From ppb_messaging.idl modified Wed Jan 25 11:40:12 2012. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_PPB_MESSAGING_H_ | 8 #ifndef PPAPI_C_PPB_MESSAGING_H_ |
| 9 #define PPAPI_C_PPB_MESSAGING_H_ | 9 #define PPAPI_C_PPB_MESSAGING_H_ |
| 10 | 10 |
| 11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
| 14 #include "ppapi/c/pp_stdint.h" | 14 #include "ppapi/c/pp_stdint.h" |
| 15 #include "ppapi/c/pp_var.h" | 15 #include "ppapi/c/pp_var.h" |
| 16 | 16 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 53 * Specifically, the value of message will be contained as a property called | 53 * Specifically, the value of message will be contained as a property called |
| 54 * data in the received <code>MessageEvent</code>. | 54 * data in the received <code>MessageEvent</code>. |
| 55 * | 55 * |
| 56 * This messaging system is similar to the system used for listening for | 56 * This messaging system is similar to the system used for listening for |
| 57 * messages from Web Workers. Refer to | 57 * messages from Web Workers. Refer to |
| 58 * <code>http://www.whatwg.org/specs/web-workers/current-work/</code> for | 58 * <code>http://www.whatwg.org/specs/web-workers/current-work/</code> for |
| 59 * further information. | 59 * further information. |
| 60 * | 60 * |
| 61 * <strong>Example:</strong> | 61 * <strong>Example:</strong> |
| 62 * | 62 * |
| 63 * <code> | 63 * @code |
| 64 * | 64 * |
| 65 * <body> | 65 * <body> |
| 66 * <object id="plugin" | 66 * <object id="plugin" |
| 67 * type="application/x-ppapi-postMessage-example"/> | 67 * type="application/x-ppapi-postMessage-example"/> |
| 68 * <script type="text/javascript"> | 68 * <script type="text/javascript"> |
| 69 * var plugin = document.getElementById('plugin'); | 69 * var plugin = document.getElementById('plugin'); |
| 70 * plugin.AddEventListener("message", | 70 * plugin.AddEventListener("message", |
| 71 * function(message) { alert(message.data); }, | 71 * function(message) { alert(message.data); }, |
| 72 * false); | 72 * false); |
| 73 * </script> | 73 * </script> |
| 74 * </body> | 74 * </body> |
| 75 * | 75 * |
| 76 * </code> | 76 * @endcode |
| 77 * | 77 * |
| 78 * The module instance then invokes PostMessage() as follows: | 78 * The module instance then invokes PostMessage() as follows: |
| 79 * | 79 * |
| 80 * <code> | 80 * <code> |
|
cstefansen
2012/02/24 21:09:10
@code?
jond
2012/02/27 20:31:49
Done.
| |
| 81 * | 81 * |
| 82 * | 82 * |
| 83 * char hello_world[] = "Hello world!"; | 83 * char hello_world[] = "Hello world!"; |
| 84 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, | 84 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, |
| 85 * hello_world, | 85 * hello_world, |
| 86 * sizeof(hello_world)); | 86 * sizeof(hello_world)); |
| 87 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. | 87 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. |
| 88 * ppb_var_interface->Release(hello_var); | 88 * ppb_var_interface->Release(hello_var); |
| 89 * | 89 * |
| 90 * </code> | 90 * </code> |
|
cstefansen
2012/02/24 21:09:10
@endcode?
jond
2012/02/27 20:31:49
Done.
| |
| 91 * | 91 * |
| 92 * The browser will pop-up an alert saying "Hello world!" | 92 * The browser will pop-up an alert saying "Hello world!" |
| 93 */ | 93 */ |
| 94 void (*PostMessage)(PP_Instance instance, struct PP_Var message); | 94 void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 typedef struct PPB_Messaging_1_0 PPB_Messaging; | 97 typedef struct PPB_Messaging_1_0 PPB_Messaging; |
| 98 /** | 98 /** |
| 99 * @} | 99 * @} |
| 100 */ | 100 */ |
| 101 | 101 |
| 102 #endif /* PPAPI_C_PPB_MESSAGING_H_ */ | 102 #endif /* PPAPI_C_PPB_MESSAGING_H_ */ |
| 103 | 103 |
| OLD | NEW |