Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: ppapi/c/ppp_instance.h

Issue 7038044: First step to remove scripting from PPP_Instance and PPB_Instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/c/ppb_instance.h ('k') | ppapi/cpp/instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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; 14 struct PP_Var;
15 15
16 #define PPP_INSTANCE_INTERFACE "PPP_Instance;0.4" 16 #define PPP_INSTANCE_INTERFACE_0_4 "PPP_Instance;0.4"
17 #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
20 #else
21 #define PPP_INSTANCE_INTERFACE PPP_INSTANCE_INTERFACE_0_4
22 #endif
23
17 24
18 /** 25 /**
19 * @file 26 * @file
20 * This file defines the PPP_Instance structure - a series of pointers to 27 * This file defines the PPP_Instance structure - a series of pointers to
21 * methods that you must implement in your module. 28 * methods that you must implement in your module.
22 */ 29 */
23 30
24 /** @addtogroup Interfaces 31 /** @addtogroup Interfaces
25 * @{ 32 * @{
26 */ 33 */
27 34
28 /** 35 /**
29 * The PPP_Instance interface contains pointers to a series of functions that 36 * The PPP_Instance interface contains pointers to a series of functions that
30 * you must implement in your module. These functions can be trivial (simply 37 * you must implement in your module. These functions can be trivial (simply
31 * return the default return value) unless you want your module 38 * return the default return value) unless you want your module
32 * to handle events such as change of focus or input events (keyboard/mouse) 39 * to handle events such as change of focus or input events (keyboard/mouse)
33 * events. 40 * events.
34 */ 41 */
35 42
43 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING
36 struct PPP_Instance { 44 struct PPP_Instance {
45 #else
46 struct PPP_Instance_0_5 {
47 #endif
37 /** 48 /**
38 * This value represents a pointer to a function that is called when a new 49 * This value represents a pointer to a function that is called when a new
39 * module is instantiated on the web page. The identifier of the new 50 * module is instantiated on the web page. The identifier of the new
40 * instance will be passed in as the first argument (this value is 51 * instance will be passed in as the first argument (this value is
41 * generated by the browser and is an opaque handle). This is called for each 52 * generated by the browser and is an opaque handle). This is called for each
42 * instantiation of the NaCl module, which is each time the <embed> tag for 53 * instantiation of the NaCl module, which is each time the <embed> tag for
43 * this module is encountered. 54 * this module is encountered.
44 * 55 *
45 * It's possible for more than one module instance to be created 56 * It's possible for more than one module instance to be created
46 * (i.e. you may get more than one OnCreate without an OnDestroy 57 * (i.e. you may get more than one OnCreate without an OnDestroy
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 * addref it yourself. 163 * addref it yourself.
153 * 164 *
154 * This method returns PP_FALSE if the module cannot handle the data. In 165 * This method returns PP_FALSE if the module cannot handle the data. In
155 * response to this method, the module should call ReadResponseBody to read 166 * response to this method, the module should call ReadResponseBody to read
156 * the incoming data. 167 * the incoming data.
157 * @param[in] instance A PP_Instance indentifying one instance of a module. 168 * @param[in] instance A PP_Instance indentifying one instance of a module.
158 * @param[in] url_loader A PP_Resource an open PPB_URLLoader instance. 169 * @param[in] url_loader A PP_Resource an open PPB_URLLoader instance.
159 * @return PP_TRUE if the data was handled, PP_FALSE otherwise. 170 * @return PP_TRUE if the data was handled, PP_FALSE otherwise.
160 */ 171 */
161 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader); 172 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
173 };
162 174
163 /** 175 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING
164 * This value represents a pointer to a function that returns a Var 176 struct PPP_Instance_0_4 {
165 * representing the scriptable object for the given instance. Normally 177 #else
166 * this will be a PPP_Class object that exposes certain methods the page 178 struct PPP_Instance {
167 * may want to call. 179 #endif
168 * 180 PP_Bool (*DidCreate)(PP_Instance instance,
169 * On Failure, the returned var should be a "void" var. 181 uint32_t argc,
170 * 182 const char* argn[],
171 * The returned PP_Var should have a reference added for the caller, which 183 const char* argv[]);
172 * will be responsible for Release()ing that reference. 184 void (*DidDestroy)(PP_Instance instance);
173 * 185 void (*DidChangeView)(PP_Instance instance,
174 * @param[in] instance A PP_Instance indentifying one instance of a module. 186 const struct PP_Rect* position,
175 * @return A PP_Var containing scriptable object. 187 const struct PP_Rect* clip);
176 */ 188 void (*DidChangeFocus)(PP_Instance instance, PP_Bool has_focus);
189 PP_Bool (*HandleInputEvent)(PP_Instance instance,
190 const struct PP_InputEvent* event);
191 PP_Bool (*HandleDocumentLoad)(PP_Instance instance, PP_Resource url_loader);
177 struct PP_Var (*GetInstanceObject)(PP_Instance instance); 192 struct PP_Var (*GetInstanceObject)(PP_Instance instance);
178 }; 193 };
194
179 /** 195 /**
180 * @} 196 * @}
181 */ 197 */
182 198
199 #ifdef PPAPI_INSTANCE_REMOVE_SCRIPTING
200 typedef struct PPP_Instance PPP_Instance_0_5;
201 #else
202 typedef struct PPP_Instance PPP_Instance_0_4;
203 #endif
204
183 #endif /* PPAPI_C_PPP_INSTANCE_H_ */ 205 #endif /* PPAPI_C_PPP_INSTANCE_H_ */
184 206
OLDNEW
« no previous file with comments | « ppapi/c/ppb_instance.h ('k') | ppapi/cpp/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698