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_PPB_INSTANCE_H_ | 5 #ifndef PPAPI_C_PPB_INSTANCE_H_ |
6 #define PPAPI_C_PPB_INSTANCE_H_ | 6 #define PPAPI_C_PPB_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_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
12 | 12 |
13 #define PPB_INSTANCE_INTERFACE_0_4 "PPB_Instance;0.4" | 13 #define PPB_INSTANCE_INTERFACE_0_4 "PPB_Instance;0.4" |
| 14 #define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5" |
| 15 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING |
| 16 #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_5 |
| 17 #else |
14 #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_4 | 18 #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_4 |
| 19 #endif |
15 | 20 |
16 /** | 21 /** |
17 * @file | 22 * @file |
18 * This file defines the PPB_Instance interface implemented by the | 23 * This file defines the PPB_Instance interface implemented by the |
19 * browser and containing pointers to functions related to | 24 * browser and containing pointers to functions related to |
20 * the module instance on a web page. | 25 * the module instance on a web page. |
21 * | 26 * |
22 * @addtogroup Interfaces | 27 * @addtogroup Interfaces |
23 * @{ | 28 * @{ |
24 */ | 29 */ |
25 | 30 |
26 /** | 31 /** |
27 * The PPB_Instance interface contains pointers to functions | 32 * The PPB_Instance interface contains pointers to functions |
28 * related to the module instance on a web page. | 33 * related to the module instance on a web page. |
29 * | 34 * |
30 */ | 35 */ |
| 36 |
| 37 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING |
31 struct PPB_Instance { | 38 struct PPB_Instance { |
32 /** | 39 #else |
33 * GetWindowObject is a pointer to a function that determines | 40 struct PPB_Instance_0_5 { |
34 * the DOM window containing this module instance. | 41 #endif |
35 * | |
36 * @param[in] instance A PP_Instance whose WindowObject should be retrieved. | |
37 * @return A PP_Var containing window object on success. | |
38 */ | |
39 struct PP_Var (*GetWindowObject)(PP_Instance instance); | |
40 | |
41 /** | |
42 * GetOwnerElementObject is a pointer to a function that determines | |
43 * the DOM element containing this module instance. | |
44 * | |
45 * @param[in] instance A PP_Instance whose WindowObject should be retrieved. | |
46 * @return A PP_Var containing DOM element on success. | |
47 */ | |
48 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); | |
49 | |
50 /** | 42 /** |
51 * BindGraphics is a pointer to a function that binds the given | 43 * BindGraphics is a pointer to a function that binds the given |
52 * graphics as the current drawing surface. The | 44 * graphics as the current drawing surface. The |
53 * contents of this device is what will be displayed in the plugin's area | 45 * contents of this device is what will be displayed in the plugin's area |
54 * on the web page. The device must be a 2D or a 3D device. | 46 * on the web page. The device must be a 2D or a 3D device. |
55 * | 47 * |
56 * You can pass a NULL resource as the device parameter to unbind all | 48 * You can pass a NULL resource as the device parameter to unbind all |
57 * devices from the given instance. The instance will then appear | 49 * devices from the given instance. The instance will then appear |
58 * transparent. Re-binding the same device will return PP_TRUE and will do | 50 * transparent. Re-binding the same device will return PP_TRUE and will do |
59 * nothing. Unbinding a device will drop any pending flush callbacks. | 51 * nothing. Unbinding a device will drop any pending flush callbacks. |
(...skipping 20 matching lines...) Expand all Loading... |
80 * module instance is full-frame (repr). Such a module represents | 72 * module instance is full-frame (repr). Such a module represents |
81 * the entire document in a frame rather than an embedded resource. This can | 73 * the entire document in a frame rather than an embedded resource. This can |
82 * happen if the user does a top level navigation or the page specifies an | 74 * happen if the user does a top level navigation or the page specifies an |
83 * iframe to a resource with a MIME type registered by the plugin. | 75 * iframe to a resource with a MIME type registered by the plugin. |
84 * | 76 * |
85 * @param[in] instance A PP_Instance indentifying one instance of a module. | 77 * @param[in] instance A PP_Instance indentifying one instance of a module. |
86 * @return A PP_Bool containing PP_TRUE if the instance is full-frame. | 78 * @return A PP_Bool containing PP_TRUE if the instance is full-frame. |
87 */ | 79 */ |
88 PP_Bool (*IsFullFrame)(PP_Instance instance); | 80 PP_Bool (*IsFullFrame)(PP_Instance instance); |
89 | 81 |
90 /** | 82 }; |
91 * ExecuteScript is a pointer to a function that executes the given | 83 |
92 * script in the context of the frame containing the module. | 84 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING |
93 * | 85 struct PPB_Instance_0_4 { |
94 * The exception, if any, will be returned in *exception. As with the PPB_Var | 86 #else |
95 * interface, the exception parameter, if non-NULL, must be initialized | 87 struct PPB_Instance { |
96 * to a void exception or the function will immediately return. On success, | 88 #endif |
97 * the exception parameter will be set to a "void" var. On failure, the | 89 struct PP_Var (*GetWindowObject)(PP_Instance instance); |
98 * return value will be a "void" var. | 90 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); |
99 * | 91 PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); |
100 * @param[in] script A string containing the JavaScript to execute. | 92 PP_Bool (*IsFullFrame)(PP_Instance instance); |
101 * @param[in/out] exception PP_Var containing the exception. Initialize | |
102 * this to NULL if you don't want exception info; initialize this to a void | |
103 * exception if want exception info. | |
104 * | |
105 * @return The result of the script execution, or a "void" var | |
106 * if execution failed. | |
107 */ | |
108 struct PP_Var (*ExecuteScript)(PP_Instance instance, | 93 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
109 struct PP_Var script, | 94 struct PP_Var script, |
110 struct PP_Var* exception); | 95 struct PP_Var* exception); |
111 }; | 96 }; |
| 97 |
112 /** | 98 /** |
113 * @} | 99 * @} |
114 */ | 100 */ |
115 | 101 |
116 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ | 102 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ |
117 | 103 |
OLD | NEW |