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_0_4 "PPP_Instance;0.4" |
| 17 #define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" |
| 18 |
| 19 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 |
17 | 20 |
18 /** | 21 /** |
19 * @file | 22 * @file |
20 * This file defines the PPP_Instance structure - a series of points to methods | 23 * This file defines the PPP_Instance structure - a series of pointers to |
21 * that you must implement in your model. | 24 * methods that you must implement in your module instance. |
22 * | 25 * |
23 */ | 26 */ |
24 | 27 |
25 /** @addtogroup Interfaces | 28 /** @addtogroup Interfaces |
26 * @{ | 29 * @{ |
27 */ | 30 */ |
28 | 31 |
29 /** | 32 /** |
30 * The PPP_Instance interface contains pointers to a series of functions that | 33 * 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 | 34 * 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 * | 168 * |
166 * On Failure, the returned var should be a "void" var. | 169 * On Failure, the returned var should be a "void" var. |
167 * | 170 * |
168 * The returned PP_Var should have a reference added for the caller, which | 171 * The returned PP_Var should have a reference added for the caller, which |
169 * will be responsible for Release()ing that reference. | 172 * will be responsible for Release()ing that reference. |
170 * | 173 * |
171 * @param[in] instance A PP_Instance indentifying one instance of a module. | 174 * @param[in] instance A PP_Instance indentifying one instance of a module. |
172 * @return A PP_Var containing scriptable object. | 175 * @return A PP_Var containing scriptable object. |
173 */ | 176 */ |
174 struct PP_Var (*GetInstanceObject)(PP_Instance instance); | 177 struct PP_Var (*GetInstanceObject)(PP_Instance instance); |
| 178 |
| 179 /** |
| 180 * HandleMessage is a pointer to a function that the browser will call when |
| 181 * @a postMessage() is invoked on the DOM object for this module instance in |
| 182 * JavaScript. Note that @a postMessage() in the JavaScript interface is |
| 183 * asynchronous, meaning JavaScript execution will not be blocked while |
| 184 * @a HandleMessage() is processing the given @a message. |
| 185 * |
| 186 * For example: |
| 187 * |
| 188 * \verbatim |
| 189 * |
| 190 * <body> |
| 191 * <object id="plugin" |
| 192 * type="application/x-ppapi-postMessage-example"/> |
| 193 * <script type="text/javascript"> |
| 194 * document.getElementById('plugin').postMessage("Hello world!"); |
| 195 * </script> |
| 196 * </body> |
| 197 * |
| 198 * \endverbatim |
| 199 * |
| 200 * This will result in HandleMessage being invoked on the instance, with |
| 201 * message being a string PP_Var containing "Hello world!". |
| 202 */ |
| 203 void (*HandleMessage)(PP_Instance instance, struct PP_Var message); |
175 }; | 204 }; |
176 /** | 205 /** |
177 * @} | 206 * @} |
178 */ | 207 */ |
179 | 208 |
| 209 /* This version exists to help provide backwards compatibility. */ |
| 210 struct PPP_Instance_0_4 { |
| 211 PP_Bool (*DidCreate)(PP_Instance instance, |
| 212 uint32_t argc, |
| 213 const char* argn[], |
| 214 const char* argv[]); |
| 215 void (*DidDestroy)(PP_Instance instance); |
| 216 void (*DidChangeView)(PP_Instance instance, |
| 217 const struct PP_Rect* position, |
| 218 const struct PP_Rect* clip); |
| 219 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); |
| 220 PP_Bool (*HandleInputEvent)(PP_Instance instance, |
| 221 const struct PP_InputEvent* event); |
| 222 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
| 223 struct PP_Var (*GetInstanceObject)(PP_Instance instance); |
| 224 }; |
| 225 |
180 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 226 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
181 | 227 |
OLD | NEW |