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 | 5 |
6 /* From ppp_instance.idl modified Tue Aug 23 11:29:06 2011. */ | 6 /* From ppp_instance.idl modified Thu Dec 15 10:30:21 2011. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPP_INSTANCE_H_ | 8 #ifndef PPAPI_C_PPP_INSTANCE_H_ |
9 #define PPAPI_C_PPP_INSTANCE_H_ | 9 #define PPAPI_C_PPP_INSTANCE_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_point.h" | 14 #include "ppapi/c/pp_point.h" |
15 #include "ppapi/c/pp_rect.h" | 15 #include "ppapi/c/pp_rect.h" |
16 #include "ppapi/c/pp_resource.h" | 16 #include "ppapi/c/pp_resource.h" |
17 #include "ppapi/c/pp_size.h" | 17 #include "ppapi/c/pp_size.h" |
18 #include "ppapi/c/pp_stdint.h" | 18 #include "ppapi/c/pp_stdint.h" |
19 | 19 |
20 #define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" | 20 #define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" |
21 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_0 | 21 #define PPP_INSTANCE_INTERFACE_1_1 "PPP_Instance;1.1" |
| 22 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_1 |
22 | 23 |
23 /** | 24 /** |
24 * @file | 25 * @file |
25 * This file defines the <code>PPP_Instance</code> structure - a series of | 26 * This file defines the <code>PPP_Instance</code> structure - a series of |
26 * pointers to methods that you must implement in your module. | 27 * pointers to methods that you must implement in your module. |
27 */ | 28 */ |
28 | 29 |
29 | 30 |
30 /** | 31 /** |
31 * @addtogroup Interfaces | 32 * @addtogroup Interfaces |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 * implementations in certain circumstances when Chrome does "fast shutdown" | 105 * implementations in certain circumstances when Chrome does "fast shutdown" |
105 * of a web page. Fast shutdown will happen in some cases when all module | 106 * of a web page. Fast shutdown will happen in some cases when all module |
106 * instances are being deleted, and no cleanup functions will be called. | 107 * instances are being deleted, and no cleanup functions will be called. |
107 * The module will just be unloaded and the process terminated. | 108 * The module will just be unloaded and the process terminated. |
108 * | 109 * |
109 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 110 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
110 * of a module. | 111 * of a module. |
111 */ | 112 */ |
112 void (*DidDestroy)(PP_Instance instance); | 113 void (*DidDestroy)(PP_Instance instance); |
113 /** | 114 /** |
114 * DidChangeView() is called when the position, the size, of the clip | 115 * <code>DidChangeView() is called when the position, size, or other view |
115 * rectangle of the element in the browser that corresponds to this | 116 * attributes of the instance has changed. |
116 * instance has changed. | |
117 * | |
118 * A typical implementation will check the size of the <code>position</code> | |
119 * argument and reallocate the graphics context when a different size is | |
120 * received. Note that this function will be called for scroll events where | |
121 * the size doesn't change, so you should always check that the size is | |
122 * actually different before doing any reallocations. | |
123 * | |
124 * @param[in] instance A <code>PP_Instance</code> identifying the instance | |
125 * that has changed. | |
126 * | |
127 * @param[in] position The location on the page of the instance. This is | |
128 * relative to the top left corner of the viewport, which changes as the | |
129 * page is scrolled. Generally the size of this value will be used to create | |
130 * a graphics device, and the position is ignored (most things are relative | |
131 * to the instance so the absolute position isn't useful in most cases). | |
132 * | |
133 * @param[in] clip The visible region of the instance. This is relative to | |
134 * the top left of the module's coordinate system (not the page). If the | |
135 * module is invisible, <code>clip</code> will be (0, 0, 0, 0). | |
136 * | |
137 * It's recommended to check for invisible instances and to stop | |
138 * generating graphics updates in this case to save system resources. It's | |
139 * not usually worthwhile, however, to generate partial updates according to | |
140 * the clip when the instance is partially visible. Instead, update the entire | |
141 * region. The time saved doing partial paints is usually not significant and | |
142 * it can create artifacts when scrolling (this notification is sent | |
143 * asynchronously from scrolling so there can be flashes of old content in the | |
144 * exposed regions). | |
145 */ | 117 */ |
146 void (*DidChangeView)(PP_Instance instance, | 118 void (*DidChangeView)(PP_Instance instance, PP_Resource view_resource); |
147 const struct PP_Rect* position, | |
148 const struct PP_Rect* clip); | |
149 /** | 119 /** |
150 * DidChangeFocus() is called when an instance has gained or lost focus. | 120 * DidChangeFocus() is called when an instance has gained or lost focus. |
151 * Having focus means that keyboard events will be sent to the instance. | 121 * Having focus means that keyboard events will be sent to the instance. |
152 * An instance's default condition is that it will not have focus. | 122 * An instance's default condition is that it will not have focus. |
153 * | 123 * |
154 * <strong>Note:</strong>Clicks on instances will give focus only if you | 124 * <strong>Note:</strong>Clicks on instances will give focus only if you |
155 * handle the click event. Return <code>true</code> from | 125 * handle the click event. Return <code>true</code> from |
156 * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use | 126 * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use |
157 * unfiltered events) to signal that the click event was handled. Otherwise, | 127 * unfiltered events) to signal that the click event was handled. Otherwise, |
158 * the browser will bubble the event and give focus to the element on the page | 128 * the browser will bubble the event and give focus to the element on the page |
(...skipping 29 matching lines...) Expand all Loading... |
188 * @param[in] instance A <code>PP_Instance</code> identifying the instance | 158 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
189 * that should do the load. | 159 * that should do the load. |
190 * | 160 * |
191 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. | 161 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. |
192 * | 162 * |
193 * @return <code>PP_TRUE</code> if the data was handled, | 163 * @return <code>PP_TRUE</code> if the data was handled, |
194 * <code>PP_FALSE</code> otherwise. | 164 * <code>PP_FALSE</code> otherwise. |
195 */ | 165 */ |
196 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); | 166 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
197 }; | 167 }; |
| 168 |
| 169 struct PPP_Instance_1_0 { |
| 170 PP_Bool (*DidCreate)(PP_Instance instance, |
| 171 uint32_t argc, |
| 172 const char* argn[], |
| 173 const char* argv[]); |
| 174 void (*DidDestroy)(PP_Instance instance); |
| 175 void (*DidChangeView)(PP_Instance instance, |
| 176 const struct PP_Rect* position, |
| 177 const struct PP_Rect* clip); |
| 178 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); |
| 179 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
| 180 }; |
198 /** | 181 /** |
199 * @} | 182 * @} |
200 */ | 183 */ |
201 | 184 |
202 | 185 |
203 typedef struct PPP_Instance PPP_Instance_1_0; | 186 typedef struct PPP_Instance PPP_Instance_1_1; |
204 | 187 |
205 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 188 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
206 | 189 |
OLD | NEW |