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 Sat Jul 16 16:50:26 2011. */ | 6 /* From ppp_instance.idl modified Sat Jul 16 16:50:26 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 |
(...skipping 20 matching lines...) Expand all Loading... |
31 * @addtogroup Interfaces | 31 * @addtogroup Interfaces |
32 * @{ | 32 * @{ |
33 */ | 33 */ |
34 /** | 34 /** |
35 * The <code>PPP_Instance</code> interface contains pointers to a series of | 35 * The <code>PPP_Instance</code> interface contains pointers to a series of |
36 * functions that you must implement in your module. These functions can be | 36 * functions that you must implement in your module. These functions can be |
37 * trivial (simply return the default return value) unless you want your module | 37 * trivial (simply return the default return value) unless you want your module |
38 * to handle events such as change of focus or input events (keyboard/mouse) | 38 * to handle events such as change of focus or input events (keyboard/mouse) |
39 * events. | 39 * events. |
40 */ | 40 */ |
41 #define PPP_INSTANCE_INTERFACE_1_0 "PPP_Instance;1.0" | 41 #define PPP_INSTANCE_INTERFACE_0_5 "PPP_Instance;0.5" |
42 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_1_0 | 42 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_5 |
43 | 43 |
44 struct PPP_Instance { | 44 struct PPP_Instance { |
45 /** | 45 /** |
46 * DidCreate() is a creation handler that is called when a new instance is | 46 * DidCreate() is a creation handler that is called when a new instance is |
47 * created. This function is called for each instantiation on the page, | 47 * created. This function is called for each instantiation on the page, |
48 * corresponding to one \<embed\> tag on the page. | 48 * corresponding to one \<embed\> tag on the page. |
49 * | 49 * |
50 * Generally you would handle this call by initializing the information | 50 * Generally you would handle this call by initializing the information |
51 * your module associates with an instance and creating a mapping from the | 51 * your module associates with an instance and creating a mapping from the |
52 * given <code>PP_Instance</code> handle to this data. The | 52 * given <code>PP_Instance</code> handle to this data. The |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 */ | 147 */ |
148 void (*DidChangeView)(PP_Instance instance, | 148 void (*DidChangeView)(PP_Instance instance, |
149 const struct PP_Rect* position, | 149 const struct PP_Rect* position, |
150 const struct PP_Rect* clip); | 150 const struct PP_Rect* clip); |
151 /** | 151 /** |
152 * DidChangeFocus() is called when an instance has gained or lost focus. | 152 * DidChangeFocus() is called when an instance has gained or lost focus. |
153 * Having focus means that keyboard events will be sent to the instance. | 153 * Having focus means that keyboard events will be sent to the instance. |
154 * An instance's default condition is that it will not have focus. | 154 * An instance's default condition is that it will not have focus. |
155 * | 155 * |
156 * <strong>Note:</strong>Clicks on instances will give focus only if you | 156 * <strong>Note:</strong>Clicks on instances will give focus only if you |
157 * handle the click event. Return <code>true</code> from | 157 * handle the click event. Return <code>true</code> from HandleInputEvent to |
158 * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use | 158 * signal that the click event was handled. Otherwise the browser will bubble |
159 * unfiltered events) to signal that the click event was handled. Otherwise, | 159 * the event and give focus to the element on the page that actually did end |
160 * the browser will bubble the event and give focus to the element on the page | 160 * up consuming it. If you're not getting focus, check to make sure you're |
161 * that actually did end up consuming it. If you're not getting focus, check | 161 * returning true from the mouse click in <code>HandleInputEvent</code>. |
162 * to make sure you're returning true from the mouse click in | |
163 * <code>HandleInputEvent</code>. | |
164 * | 162 * |
165 * @param[in] instance A <code>PP_Instance</code> indentifying the instance | 163 * @param[in] instance A <code>PP_Instance</code> indentifying the instance |
166 * receiving the input event. | 164 * receiving the input event. |
167 * | 165 * |
168 * @param[in] has_focus Indicates the new focused state of the instance. | 166 * @param[in] has_focus Indicates the new focused state of the instance. |
169 */ | 167 */ |
170 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); | 168 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); |
171 /** | 169 /** |
| 170 * HandleInputEvent() handles input events, such as keyboard events. This |
| 171 * function returns <code>PP_TRUE</code> if the event was handled or |
| 172 * <code>PP_FALSE</code> if it was not. |
| 173 * |
| 174 * If the event was handled, it will not be forwarded to the web page or |
| 175 * browser. If it was not handled, it will bubble according to the normal |
| 176 * rules. So it is important that a module respond accurately with whether |
| 177 * event propagation should continue. |
| 178 * |
| 179 * Event propagation also controls focus. If you handle an event like a mouse |
| 180 * event, typically the instance will be given focus. Returning false means |
| 181 * that the click will be given to a lower part of the page and your module |
| 182 * will not receive focus. This allows an instance to be partially |
| 183 * transparent, where clicks on the transparent areas will behave like clicks |
| 184 * to the underlying page. |
| 185 * |
| 186 * @param[in] instance A <code>PP_Instance</code> indentifying one instance |
| 187 * of a module. |
| 188 * |
| 189 * @param[in] event The input event. |
| 190 * |
| 191 * @return <code>PP_TRUE</code> if <code>event</code> was handled, |
| 192 * <code>PP_FALSE</code> otherwise. |
| 193 */ |
| 194 PP_Bool (*HandleInputEvent)(PP_Instance instance, |
| 195 const struct PP_InputEvent* event); |
| 196 /** |
172 * HandleDocumentLoad() is called after initialize for a full-frame | 197 * HandleDocumentLoad() is called after initialize for a full-frame |
173 * module that was instantiated based on the MIME type of a DOMWindow | 198 * module that was instantiated based on the MIME type of a DOMWindow |
174 * navigation. This situation only applies to modules that are pre-registered | 199 * navigation. This situation only applies to modules that are pre-registered |
175 * to handle certain MIME types. If you haven't specifically registered to | 200 * to handle certain MIME types. If you haven't specifically registered to |
176 * handle a MIME type or aren't positive this applies to you, your | 201 * handle a MIME type or aren't positive this applies to you, your |
177 * implementation of this function can just return <code>PP_FALSE</code>. | 202 * implementation of this function can just return <code>PP_FALSE</code>. |
178 * | 203 * |
179 * The given <code>url_loader</code> corresponds to a | 204 * The given <code>url_loader</code> corresponds to a |
180 * <code>PPB_URLLoader</code> instance that is already opened. Its response | 205 * <code>PPB_URLLoader</code> instance that is already opened. Its response |
181 * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. | 206 * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. |
(...skipping 13 matching lines...) Expand all Loading... |
195 * @return <code>PP_TRUE</code> if the data was handled, | 220 * @return <code>PP_TRUE</code> if the data was handled, |
196 * <code>PP_FALSE</code> otherwise. | 221 * <code>PP_FALSE</code> otherwise. |
197 */ | 222 */ |
198 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); | 223 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
199 }; | 224 }; |
200 /** | 225 /** |
201 * @} | 226 * @} |
202 */ | 227 */ |
203 | 228 |
204 | 229 |
205 typedef struct PPP_Instance PPP_Instance_1_0; | 230 typedef struct PPP_Instance PPP_Instance_0_5; |
206 | 231 |
207 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 232 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
208 | 233 |
OLD | NEW |