OLD | NEW |
1 /* Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2010 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 #ifndef PPAPI_C_PPP_INSTANCE_H_ | 5 #ifndef PPAPI_C_PPP_INSTANCE_H_ |
6 #define PPAPI_C_PPP_INSTANCE_H_ | 6 #define PPAPI_C_PPP_INSTANCE_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
10 #include "ppapi/c/pp_rect.h" | 10 #include "ppapi/c/pp_rect.h" |
11 #include "ppapi/c/pp_resource.h" | 11 #include "ppapi/c/pp_resource.h" |
12 | 12 |
13 struct PP_InputEvent; | 13 struct PP_InputEvent; |
14 struct PP_Var; | 14 struct PP_Var; |
15 | 15 |
16 #define PPP_INSTANCE_INTERFACE "PPP_Instance;0.4" | 16 #define PPP_INSTANCE_INTERFACE "PPP_Instance;0.5" |
17 | 17 |
18 /** | 18 /** |
19 * @file | 19 * @file |
20 * This file defines the PPP_Instance structure - a series of points to methods | 20 * This file defines the PPP_Instance structure - a series of pointers to |
21 * that you must implement in your model. | 21 * methods that you must implement in your module instance. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 /** @addtogroup Interfaces | 25 /** @addtogroup Interfaces |
26 * @{ | 26 * @{ |
27 */ | 27 */ |
28 | 28 |
29 /** | 29 /** |
30 * The PPP_Instance interface contains pointers to a series of functions that | 30 * The PPP_Instance interface contains pointers to a series of functions that |
31 * you must implement in your module. These functions can be trivial (simply | 31 * you must implement in your module. These functions can be trivial (simply |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 * | 165 * |
166 * On Failure, the returned var should be a "void" var. | 166 * On Failure, the returned var should be a "void" var. |
167 * | 167 * |
168 * The returned PP_Var should have a reference added for the caller, which | 168 * The returned PP_Var should have a reference added for the caller, which |
169 * will be responsible for Release()ing that reference. | 169 * will be responsible for Release()ing that reference. |
170 * | 170 * |
171 * @param[in] instance A PP_Instance indentifying one instance of a module. | 171 * @param[in] instance A PP_Instance indentifying one instance of a module. |
172 * @return A PP_Var containing scriptable object. | 172 * @return A PP_Var containing scriptable object. |
173 */ | 173 */ |
174 struct PP_Var (*GetInstanceObject)(PP_Instance instance); | 174 struct PP_Var (*GetInstanceObject)(PP_Instance instance); |
| 175 |
| 176 /** |
| 177 * This method gets called when @a postMessage() is invoked on the DOM object |
| 178 * for this module instance in JavaScript. Note that @a postMessage() in the |
| 179 * JavaScript interface is asynchronous, meaning JavaScript execution will not |
| 180 * be blocked while @a HandleMessage() is processing the given @a message. |
| 181 * |
| 182 * For example: |
| 183 * |
| 184 * <body> |
| 185 * <object id="plugin" |
| 186 * type="application/x-ppapi-postMessage-example"/> |
| 187 * <script type="text/javascript"> |
| 188 * document.getElementById('plugin').postMessage("Hello world!"); |
| 189 * </script> |
| 190 * </body> |
| 191 * |
| 192 * This will result in HandleMessage being invoked on the instance, with |
| 193 * message being a string PP_Var containing "Hello world!". |
| 194 */ |
| 195 void (*HandleMessage)(PP_Instance instance, struct PP_Var message); |
175 }; | 196 }; |
176 /** | 197 /** |
177 * @} | 198 * @} |
178 */ | 199 */ |
179 | 200 |
180 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 201 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
181 | 202 |
OLD | NEW |