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 Mon Feb 27 13:31:21 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 |
81 * | |
82 * | 81 * |
83 * char hello_world[] = "Hello world!"; | 82 * char hello_world[] = "Hello world!"; |
84 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, | 83 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, |
85 * hello_world, | 84 * hello_world, |
86 * sizeof(hello_world)); | 85 * sizeof(hello_world)); |
87 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. | 86 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. |
88 * ppb_var_interface->Release(hello_var); | 87 * ppb_var_interface->Release(hello_var); |
89 * | 88 * |
90 * </code> | 89 * @endcode |
91 * | 90 * |
92 * The browser will pop-up an alert saying "Hello world!" | 91 * The browser will pop-up an alert saying "Hello world!" |
93 */ | 92 */ |
94 void (*PostMessage)(PP_Instance instance, struct PP_Var message); | 93 void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
95 }; | 94 }; |
96 | 95 |
97 typedef struct PPB_Messaging_1_0 PPB_Messaging; | 96 typedef struct PPB_Messaging_1_0 PPB_Messaging; |
98 /** | 97 /** |
99 * @} | 98 * @} |
100 */ | 99 */ |
101 | 100 |
102 #endif /* PPAPI_C_PPB_MESSAGING_H_ */ | 101 #endif /* PPAPI_C_PPB_MESSAGING_H_ */ |
103 | 102 |
OLD | NEW |