OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
9 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
11 | 12 |
12 #define PPB_INSTANCE_INTERFACE "PPB_Instance;0.1" | 13 #define PPB_INSTANCE_INTERFACE "PPB_Instance;0.2" |
13 | 14 |
14 /** | 15 /** |
15 * @file | 16 * @file |
16 * Defines the API ... | 17 * Defines the API ... |
17 * | 18 * |
18 * @addtogroup PPB | 19 * @addtogroup PPB |
19 * @{ | 20 * @{ |
20 */ | 21 */ |
21 | 22 |
22 struct PPB_Instance { | 23 struct PPB_Instance { |
23 /** Returns a reference to the DOM window containing this instance. */ | 24 /** Returns a reference to the DOM window containing this instance. */ |
24 struct PP_Var (*GetWindowObject)(PP_Instance instance); | 25 struct PP_Var (*GetWindowObject)(PP_Instance instance); |
25 | 26 |
26 /** Returns a reference to the DOM element containing this instance. */ | 27 /** Returns a reference to the DOM element containing this instance. */ |
27 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); | 28 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); |
28 | 29 |
29 /** | 30 /** |
30 * Binds the given graphics device as the current drawing surface. The | 31 * Binds the given graphics device as the current drawing surface. The |
31 * contents of this device is what will be displayed in the plugin's area | 32 * contents of this device is what will be displayed in the plugin's area |
32 * on the web page. The device must be a 2D or a 3D device. | 33 * on the web page. The device must be a 2D or a 3D device. |
33 * | 34 * |
34 * You can pass a NULL resource as the device parameter to unbind all | 35 * You can pass a NULL resource as the device parameter to unbind all |
35 * devices from the given instance. The instance will then appear | 36 * devices from the given instance. The instance will then appear |
36 * transparent. Re-binding the same device will return true and will do | 37 * transparent. Re-binding the same device will return PP_TRUE and will do |
37 * nothing. Unbinding a device will drop any pending flush callbacks. | 38 * nothing. Unbinding a device will drop any pending flush callbacks. |
38 * | 39 * |
39 * Any previously-bound device will be Release()d. It is an error to bind | 40 * Any previously-bound device will be Release()d. It is an error to bind |
40 * a device when it is already bound to another plugin instance. If you want | 41 * a device when it is already bound to another plugin instance. If you want |
41 * to move a device between instances, first unbind it from the old one, and | 42 * to move a device between instances, first unbind it from the old one, and |
42 * then rebind it to the new one. | 43 * then rebind it to the new one. |
43 * | 44 * |
44 * Returns true if the bind was successful. False means the device was not | 45 * Returns PP_TRUE if the bind was successful. False means the device was not |
45 * the correct type. On success, a reference to the device will be held by | 46 * the correct type. On success, a reference to the device will be held by |
46 * the plugin instance, so the caller can release its reference if it | 47 * the plugin instance, so the caller can release its reference if it |
47 * chooses. | 48 * chooses. |
48 * | 49 * |
49 * Binding a device will invalidate that portion of the web page to flush the | 50 * Binding a device will invalidate that portion of the web page to flush the |
50 * contents of the new device to the screen. | 51 * contents of the new device to the screen. |
51 */ | 52 */ |
52 bool (*BindGraphics)(PP_Instance instance, PP_Resource device); | 53 PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); |
53 | 54 |
54 /** | 55 /** |
55 * Returns true if the instance is full-frame. Such a plugin represents the | 56 * Returns PP_TRUE if the instance is full-frame. Such a plugin represents |
56 * entire document in a frame rather than an embedded resource. This can | 57 * the entire document in a frame rather than an embedded resource. This can |
57 * happen if the user does a top level navigation or the page specifies an | 58 * happen if the user does a top level navigation or the page specifies an |
58 * iframe to a resource with a MIME type registered by the plugin. | 59 * iframe to a resource with a MIME type registered by the plugin. |
59 */ | 60 */ |
60 bool (*IsFullFrame)(PP_Instance instance); | 61 PP_Bool (*IsFullFrame)(PP_Instance instance); |
61 | 62 |
62 /** | 63 /** |
63 * Executes the given script in the context of the frame containing the | 64 * Executes the given script in the context of the frame containing the |
64 * plugin. | 65 * plugin. |
65 * | 66 * |
66 * The exception, if any, will be returned in *exception. As | 67 * The exception, if any, will be returned in *exception. As |
67 * with the PPB_Var interface, the exception parameter, | 68 * with the PPB_Var interface, the exception parameter, |
68 * if non-NULL, must be initialized | 69 * if non-NULL, must be initialized |
69 * to a void exception or the function will immediately return. On success, | 70 * to a void exception or the function will immediately return. On success, |
70 * the exception parameter will be set to a "void" var. On failure, the return | 71 * the exception parameter will be set to a "void" var. On failure, the return |
71 * value will be a "void" var. | 72 * value will be a "void" var. |
72 * | 73 * |
73 * @param script A string containing the JavaScript to execute. | 74 * @param script A string containing the JavaScript to execute. |
74 * @param exception Initialize this to NULL if you don't want exception info; | 75 * @param exception Initialize this to NULL if you don't want exception info; |
75 * initialize this to a void exception if you do. | 76 * initialize this to a void exception if you do. |
76 * See the function description for details. | 77 * See the function description for details. |
77 * | 78 * |
78 * @return The result of the script execution, | 79 * @return The result of the script execution, |
79 * or a "void" var if execution failed. | 80 * or a "void" var if execution failed. |
80 */ | 81 */ |
81 PP_Var (*ExecuteScript)(PP_Instance instance, PP_Var script, | 82 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
82 PP_Var* exception); | 83 struct PP_Var script, |
| 84 struct PP_Var* exception); |
83 }; | 85 }; |
84 | 86 |
85 /** | 87 /** |
86 * @} | 88 * @} |
87 * End addtogroup PPB | 89 * End addtogroup PPB |
88 */ | 90 */ |
89 #endif // PPAPI_C_PPB_INSTANCE_H_ | 91 #endif // PPAPI_C_PPB_INSTANCE_H_ |
OLD | NEW |