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 Mon Aug 15 11:01:06 2011. */ | 6 /* From ppp_instance.idl modified Tue Aug 23 11:29:06 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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 * identify which instance the call pertains to. | 51 * identify which instance the call pertains to. |
52 * | 52 * |
53 * It's possible for more than one instance to be created in a single module. | 53 * It's possible for more than one instance to be created in a single module. |
54 * This means that you may get more than one <code>OnCreate</code> without an | 54 * This means that you may get more than one <code>OnCreate</code> without an |
55 * <code>OnDestroy</code> in between, and should be prepared to maintain | 55 * <code>OnDestroy</code> in between, and should be prepared to maintain |
56 * multiple states associated with each instance. | 56 * multiple states associated with each instance. |
57 * | 57 * |
58 * If this function reports a failure (by returning <code>PP_FALSE</code>), | 58 * If this function reports a failure (by returning <code>PP_FALSE</code>), |
59 * the instance will be deleted. | 59 * the instance will be deleted. |
60 * | 60 * |
61 * @param[in] instance A new <code>PP_Instance</code> indentifying one | 61 * @param[in] instance A new <code>PP_Instance</code> identifying one |
62 * instance of a module. This is an opaque handle. | 62 * instance of a module. This is an opaque handle. |
63 * | 63 * |
64 * @param[in] argc The number of arguments contained in <code>argn</code> | 64 * @param[in] argc The number of arguments contained in <code>argn</code> |
65 * and <code>argv</code>. | 65 * and <code>argv</code>. |
66 * | 66 * |
67 * @param[in] argn An array of argument names. These argument names are | 67 * @param[in] argn An array of argument names. These argument names are |
68 * supplied in the \<embed\> tag, for example: | 68 * supplied in the \<embed\> tag, for example: |
69 * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two | 69 * <code>\<embed id="nacl_module" dimensions="2"\></code> will produce two |
70 * argument names: "id" and "dimensions." | 70 * argument names: "id" and "dimensions." |
71 * | 71 * |
(...skipping 27 matching lines...) Expand all Loading... |
99 * do any asynchronous operations like network requests, file writes or | 99 * do any asynchronous operations like network requests, file writes or |
100 * messaging from this function since they will be immediately canceled. | 100 * messaging from this function since they will be immediately canceled. |
101 * | 101 * |
102 * <strong>Note:</strong> This function will always be skipped on untrusted | 102 * <strong>Note:</strong> This function will always be skipped on untrusted |
103 * (Native Client) implementations. This function may be skipped on trusted | 103 * (Native Client) implementations. This function may be skipped on trusted |
104 * implementations in certain circumstances when Chrome does "fast shutdown" | 104 * implementations in certain circumstances when Chrome does "fast shutdown" |
105 * of a web page. Fast shutdown will happen in some cases when all module | 105 * 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. | 106 * instances are being deleted, and no cleanup functions will be called. |
107 * The module will just be unloaded and the process terminated. | 107 * The module will just be unloaded and the process terminated. |
108 * | 108 * |
109 * @param[in] instance A <code>PP_Instance</code> indentifying one instance | 109 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
110 * of a module. | 110 * of a module. |
111 */ | 111 */ |
112 void (*DidDestroy)(PP_Instance instance); | 112 void (*DidDestroy)(PP_Instance instance); |
113 /** | 113 /** |
114 * DidChangeView() is called when the position, the size, of the clip | 114 * DidChangeView() is called when the position, the size, of the clip |
115 * rectangle of the element in the browser that corresponds to this | 115 * rectangle of the element in the browser that corresponds to this |
116 * instance has changed. | 116 * instance has changed. |
117 * | 117 * |
118 * A typical implementation will check the size of the <code>position</code> | 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 | 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 | 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 | 121 * the size doesn't change, so you should always check that the size is |
122 * actually different before doing any reallocations. | 122 * actually different before doing any reallocations. |
123 * | 123 * |
124 * @param[in] instance A <code>PP_Instance</code> indentifying the instance | 124 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
125 * that has changed. | 125 * that has changed. |
126 * | 126 * |
127 * @param[in] position The location on the page of the instance. This is | 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 | 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 | 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 | 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). | 131 * to the instance so the absolute position isn't useful in most cases). |
132 * | 132 * |
133 * @param[in] clip The visible region of the instance. This is relative to | 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 | 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). | 135 * module is invisible, <code>clip</code> will be (0, 0, 0, 0). |
136 * | 136 * |
137 * It's recommended to check for invisible instances and to stop | 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 | 138 * generating graphics updates in this case to save system resources. It's |
139 * not usually worthwhile, however, to generate partial updates according to | 139 * not usually worthwhile, however, to generate partial updates according to |
140 * the clip when the instance is partially visible. Instead, update the entire | 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 | 141 * region. The time saved doing partial paints is usually not significant and |
142 * it can create artifacts when scrolling (this notification is sent | 142 * it can create artifacts when scrolling (this notification is sent |
143 * asynchronously from scolling so there can be flashes of old content in the | 143 * asynchronously from scrolling so there can be flashes of old content in the |
144 * exposed regions). | 144 * exposed regions). |
145 */ | 145 */ |
146 void (*DidChangeView)(PP_Instance instance, | 146 void (*DidChangeView)(PP_Instance instance, |
147 const struct PP_Rect* position, | 147 const struct PP_Rect* position, |
148 const struct PP_Rect* clip); | 148 const struct PP_Rect* clip); |
149 /** | 149 /** |
150 * DidChangeFocus() is called when an instance has gained or lost focus. | 150 * DidChangeFocus() is called when an instance has gained or lost focus. |
151 * Having focus means that keyboard events will be sent to the instance. | 151 * 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. | 152 * An instance's default condition is that it will not have focus. |
153 * | 153 * |
154 * <strong>Note:</strong>Clicks on instances will give focus only if you | 154 * <strong>Note:</strong>Clicks on instances will give focus only if you |
155 * handle the click event. Return <code>true</code> from | 155 * handle the click event. Return <code>true</code> from |
156 * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use | 156 * <code>HandleInputEvent</code> in <code>PPP_InputEvent</code> (or use |
157 * unfiltered events) to signal that the click event was handled. Otherwise, | 157 * 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 | 158 * the browser will bubble the event and give focus to the element on the page |
159 * that actually did end up consuming it. If you're not getting focus, check | 159 * that actually did end up consuming it. If you're not getting focus, check |
160 * to make sure you're returning true from the mouse click in | 160 * to make sure you're returning true from the mouse click in |
161 * <code>HandleInputEvent</code>. | 161 * <code>HandleInputEvent</code>. |
162 * | 162 * |
163 * @param[in] instance A <code>PP_Instance</code> indentifying the instance | 163 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
164 * receiving the input event. | 164 * receiving the input event. |
165 * | 165 * |
166 * @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. |
167 */ | 167 */ |
168 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); | 168 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus); |
169 /** | 169 /** |
170 * HandleDocumentLoad() is called after initialize for a full-frame | 170 * HandleDocumentLoad() is called after initialize for a full-frame |
171 * module that was instantiated based on the MIME type of a DOMWindow | 171 * module that was instantiated based on the MIME type of a DOMWindow |
172 * navigation. This situation only applies to modules that are pre-registered | 172 * navigation. This situation only applies to modules that are pre-registered |
173 * to handle certain MIME types. If you haven't specifically registered to | 173 * to handle certain MIME types. If you haven't specifically registered to |
174 * handle a MIME type or aren't positive this applies to you, your | 174 * handle a MIME type or aren't positive this applies to you, your |
175 * implementation of this function can just return <code>PP_FALSE</code>. | 175 * implementation of this function can just return <code>PP_FALSE</code>. |
176 * | 176 * |
177 * The given <code>url_loader</code> corresponds to a | 177 * The given <code>url_loader</code> corresponds to a |
178 * <code>PPB_URLLoader</code> instance that is already opened. Its response | 178 * <code>PPB_URLLoader</code> instance that is already opened. Its response |
179 * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. | 179 * headers may be queried using <code>PPB_URLLoader::GetResponseInfo</code>. |
180 * The reference count for the URL loader is not incremented automatically on | 180 * The reference count for the URL loader is not incremented automatically on |
181 * behalf of the module. You need to increment the reference count yourself | 181 * behalf of the module. You need to increment the reference count yourself |
182 * if you are going to keep a reference to it. | 182 * if you are going to keep a reference to it. |
183 * | 183 * |
184 * This method returns <code>PP_FALSE</code> if the module cannot handle the | 184 * This method returns <code>PP_FALSE</code> if the module cannot handle the |
185 * data. In response to this method, the module should call | 185 * data. In response to this method, the module should call |
186 * ReadResponseBody() to read the incoming data. | 186 * ReadResponseBody() to read the incoming data. |
187 * | 187 * |
188 * @param[in] instance A <code>PP_Instance</code> indentifying the instance | 188 * @param[in] instance A <code>PP_Instance</code> identifying the instance |
189 * that should do the load. | 189 * that should do the load. |
190 * | 190 * |
191 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. | 191 * @param[in] url_loader An open <code>PPB_URLLoader</code> instance. |
192 * | 192 * |
193 * @return <code>PP_TRUE</code> if the data was handled, | 193 * @return <code>PP_TRUE</code> if the data was handled, |
194 * <code>PP_FALSE</code> otherwise. | 194 * <code>PP_FALSE</code> otherwise. |
195 */ | 195 */ |
196 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); | 196 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); |
197 }; | 197 }; |
198 /** | 198 /** |
199 * @} | 199 * @} |
200 */ | 200 */ |
201 | 201 |
202 | 202 |
203 typedef struct PPP_Instance PPP_Instance_1_0; | 203 typedef struct PPP_Instance PPP_Instance_1_0; |
204 | 204 |
205 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ | 205 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ |
206 | 206 |
OLD | NEW |