OLD | NEW |
1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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; | |
15 | 14 |
16 #define PPP_INSTANCE_INTERFACE_0_4 "PPP_Instance;0.4" | |
17 #define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" | 15 #define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" |
18 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING | |
19 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 | 16 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 |
20 #else | |
21 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_4 | |
22 #endif | |
23 | |
24 | 17 |
25 /** | 18 /** |
26 * @file | 19 * @file |
27 * This file defines the <code>PPP_Instance</code> structure - a series of | 20 * This file defines the <code>PPP_Instance</code> structure - a series of |
28 * pointers to methods that you must implement in your module. | 21 * pointers to methods that you must implement in your module. |
29 */ | 22 */ |
30 | 23 |
31 /** @addtogroup Interfaces | 24 /** @addtogroup Interfaces |
32 * @{ | 25 * @{ |
33 */ | 26 */ |
34 | 27 |
35 /** | 28 /** |
36 * The <code>PPP_Instance</code> interface contains pointers to a series of | 29 * The <code>PPP_Instance</code> interface contains pointers to a series of |
37 * functions that you must implement in your module. These functions can be | 30 * functions that you must implement in your module. These functions can be |
38 * trivial (simply return the default return value) unless you want your module | 31 * trivial (simply return the default return value) unless you want your module |
39 * to handle events such as change of focus or input events (keyboard/mouse) | 32 * to handle events such as change of focus or input events (keyboard/mouse) |
40 * events. | 33 * events. |
41 */ | 34 */ |
42 | 35 |
43 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING | |
44 struct PPP_Instance { | 36 struct PPP_Instance { |
45 #else | |
46 struct PPP_Instance_0_5 { | |
47 #endif | |
48 /** | 37 /** |
49 * DidCreate() is a creation handler that is called when a new instance is | 38 * DidCreate() is a creation handler that is called when a new instance is |
50 * created. This function is called for each instantiation on the page, | 39 * created. This function is called for each instantiation on the page, |
51 * corresponding to one \<embed\> tag on the page. | 40 * corresponding to one \<embed\> tag on the page. |
52 * | 41 * |
53 * Generally you would handle this call by initializing the information | 42 * Generally you would handle this call by initializing the information |
54 * your module associates with an instance and creating a mapping from the | 43 * your module associates with an instance and creating a mapping from the |
55 * given <code>PP_Instance</code> handle to this data. The | 44 * given <code>PP_Instance</code> handle to this data. The |
56 * <code>PP_Instance</code> handle will be used in subsequent calls to | 45 * <code>PP_Instance</code> handle will be used in subsequent calls to |
57 * identify which instance the call pertains to. | 46 * identify which instance the call pertains to. |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 * that should do the load. | 213 * that should do the load. |
225 * | 214 * |
226 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. | 215 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. |
227 * | 216 * |
228 * @return <code>PP_TRUE</code> if the data was handled, | 217 * @return <code>PP_TRUE</code> if the data was handled, |
229 * <code>PP_FALSE</code> otherwise. | 218 * <code>PP_FALSE</code> otherwise. |
230 */ | 219 */ |
231 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); | 220 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
232 }; | 221 }; |
233 | 222 |
234 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING | |
235 struct PPP_Instance_0_4 { | |
236 #else | |
237 struct PPP_Instance { | |
238 #endif | |
239 PP_Bool (*DidCreate)(PP_Instance instance, | |
240 uint32_t argc, | |
241 const char* argn[], | |
242 const char* argv[]); | |
243 void (*DidDestroy)(PP_Instance instance); | |
244 void (*DidChangeView)(PP_Instance instance, | |
245 const struct PP_Rect* position, | |
246 const struct PP_Rect* clip); | |
247 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); | |
248 PP_Bool (*HandleInputEvent)(PP_Instance instance, | |
249 const struct PP_InputEvent* event); | |
250 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); | |
251 struct PP_Var (*GetInstanceObject)(PP_Instance instance); | |
252 }; | |
253 | |
254 /** | 223 /** |
255 * @} | 224 * @} |
256 */ | 225 */ |
257 | 226 |
258 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING | |
259 typedef struct PPP_Instance PPP_Instance_0_5; | 227 typedef struct PPP_Instance PPP_Instance_0_5; |
260 #else | |
261 typedef struct PPP_Instance PPP_Instance_0_4; | |
262 #endif | |
263 | 228 |
264 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 229 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
265 | 230 |
OLD | NEW |