Chromium Code Reviews| 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_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
| 11 #include "ppapi/c/pp_var.h" | 11 #include "ppapi/c/pp_var.h" |
| 12 | 12 |
| 13 #define PPB_INSTANCE_INTERFACE "PPB_Instance;0.4" | 13 #define PPB_INSTANCE_INTERFACE "PPB_Instance;0.4" |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @file | 16 * @file |
| 17 * Defines the API ... | 17 * This file defines the PPB_Instance interface defined by the |
| 18 * browser and containing pointers to functions related to | |
| 19 * the module instance on a web page. | |
| 18 * | 20 * |
| 19 * @addtogroup Interfaces | 21 * @addtogroup Interfaces |
| 20 * @{ | 22 * @{ |
| 21 */ | 23 */ |
| 22 | 24 |
| 25 /** | |
| 26 * The PPB_Instance interface contains pointers to functions | |
| 27 * related to the module instance on a web page. | |
| 28 * | |
| 29 */ | |
| 23 struct PPB_Instance { | 30 struct PPB_Instance { |
| 24 /** Returns a reference to the DOM window containing this instance. */ | 31 /** |
| 32 * This value represents a pointer to a function that determines | |
|
dmichael(do not use this one)
2011/02/08 21:51:17
This is not a value, it's a function pointer type.
jond
2011/02/09 16:42:04
I queried the group and we're going to go with thi
| |
| 33 * the DOM window containing this module instance. | |
| 34 * | |
| 35 * @param[in] instance A PP_Instance indentifying one instance of a module. | |
|
dmichael(do not use this one)
2011/02/08 21:51:17
'A PP_Instance identifying one instance of a modul
jond
2011/02/09 16:42:04
Is this not implied? That is, wouldn't developers
dmichael(do not use this one)
2011/02/11 16:42:04
True, but I also think 'identifying on instance of
jond
2011/02/15 17:02:47
Done.
| |
| 36 * @return PP_Var containing window object on success. | |
| 37 */ | |
| 25 struct PP_Var (*GetWindowObject)(PP_Instance instance); | 38 struct PP_Var (*GetWindowObject)(PP_Instance instance); |
| 26 | 39 |
| 27 /** Returns a reference to the DOM element containing this instance. */ | 40 /** |
| 41 * This value represents a pointer to a function that determines | |
| 42 * the DOM element containing this module instance. | |
| 43 * | |
| 44 * @param[in] instance A PP_Instance indentifying one instance of a module. | |
| 45 * @return PP_Var containing DOM element on success. | |
| 46 */ | |
| 28 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); | 47 struct PP_Var (*GetOwnerElementObject)(PP_Instance instance); |
| 29 | 48 |
| 30 /** | 49 /** |
| 31 * Binds the given graphics device as the current drawing surface. The | 50 * This value represents a pointer to a function that binds the given |
| 51 * graphics as the current drawing surface. The | |
| 32 * contents of this device is what will be displayed in the plugin's area | 52 * contents of this device is what will be displayed in the plugin's area |
| 33 * on the web page. The device must be a 2D or a 3D device. | 53 * on the web page. The device must be a 2D or a 3D device. |
| 34 * | 54 * |
| 35 * You can pass a NULL resource as the device parameter to unbind all | 55 * You can pass a NULL resource as the device parameter to unbind all |
| 36 * devices from the given instance. The instance will then appear | 56 * devices from the given instance. The instance will then appear |
| 37 * transparent. Re-binding the same device will return PP_TRUE and will do | 57 * transparent. Re-binding the same device will return PP_TRUE and will do |
| 38 * nothing. Unbinding a device will drop any pending flush callbacks. | 58 * nothing. Unbinding a device will drop any pending flush callbacks. |
| 39 * | 59 * |
| 40 * Any previously-bound device will be Release()d. It is an error to bind | 60 * Any previously-bound device will be Release()d. It is an error to bind |
| 41 * a device when it is already bound to another plugin instance. If you want | 61 * a device when it is already bound to another plugin instance. If you want |
| 42 * to move a device between instances, first unbind it from the old one, and | 62 * to move a device between instances, first unbind it from the old one, and |
| 43 * then rebind it to the new one. | 63 * then rebind it to the new one. |
| 44 * | 64 * |
| 45 * Returns PP_TRUE if the bind was successful. False means the device was not | |
| 46 * the correct type. On success, a reference to the device will be held by | |
| 47 * the plugin instance, so the caller can release its reference if it | |
| 48 * chooses. | |
| 49 * | |
| 50 * Binding a device will invalidate that portion of the web page to flush the | 65 * Binding a device will invalidate that portion of the web page to flush the |
| 51 * contents of the new device to the screen. | 66 * contents of the new device to the screen. |
| 67 * | |
| 68 * @param[in] instance A PP_Instance indentifying one instance of a module. | |
| 69 * @param[in] device A PP_Resourse representing the graphics device. | |
| 70 * @return PP_Bool containing PP_TRUE if bind was successful or PP_FALSE if | |
| 71 * the device was not the correct type. On success, a reference to the | |
| 72 * device will be held by the plugin instance, so the caller can release | |
| 73 * its reference if it chooses. | |
| 52 */ | 74 */ |
| 53 PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); | 75 PP_Bool (*BindGraphics)(PP_Instance instance, PP_Resource device); |
| 54 | 76 |
| 55 /** | 77 /** |
| 56 * Returns PP_TRUE if the instance is full-frame. Such a plugin represents | 78 * This value represents a pointer to a function that determines if the |
| 79 * module instance is full-frame (repr). Such a module represents | |
| 57 * the entire document in a frame rather than an embedded resource. This can | 80 * the entire document in a frame rather than an embedded resource. This can |
| 58 * happen if the user does a top level navigation or the page specifies an | 81 * happen if the user does a top level navigation or the page specifies an |
| 59 * iframe to a resource with a MIME type registered by the plugin. | 82 * iframe to a resource with a MIME type registered by the plugin. |
| 83 * | |
| 84 * @param[in] instance A PP_Instance indentifying one instance of a module. | |
| 85 * @return PP_Var containing PP_TRUE if the instance is full-frame. | |
| 60 */ | 86 */ |
| 61 PP_Bool (*IsFullFrame)(PP_Instance instance); | 87 PP_Bool (*IsFullFrame)(PP_Instance instance); |
| 62 | 88 |
| 63 /** | 89 /** |
| 64 * Executes the given script in the context of the frame containing the | 90 * This value represents a pointer to a function that executes the given |
| 65 * plugin. | 91 * script in the context of the frame containing the module. |
| 66 * | 92 * |
| 67 * The exception, if any, will be returned in *exception. As | 93 * The exception, if any, will be returned in *exception. As with the PPB_Var |
| 68 * with the PPB_Var interface, the exception parameter, | 94 * interface, the exception parameter, if non-NULL, must be initialized |
| 69 * if non-NULL, must be initialized | |
| 70 * to a void exception or the function will immediately return. On success, | 95 * to a void exception or the function will immediately return. On success, |
| 71 * the exception parameter will be set to a "void" var. On failure, the return | 96 * the exception parameter will be set to a "void" var. On failure, the return |
| 72 * value will be a "void" var. | 97 * value will be a "void" var. |
| 73 * | 98 * |
| 74 * @param script A string containing the JavaScript to execute. | 99 * @param[in] script A string containing the JavaScript to execute. |
| 75 * @param exception Initialize this to NULL if you don't want exception info; | 100 * @param[in/out] exception PP_Var containing the exception. Initialize |
| 76 * initialize this to a void exception if you do. | 101 * this to NULL if you don't want exception info; initialize this to a void |
| 77 * See the function description for details. | 102 * exception if want exception info. |
| 78 * | 103 * |
| 79 * @return The result of the script execution, | 104 * @return The result of the script execution, or a "void" var |
| 80 * or a "void" var if execution failed. | 105 * if execution failed. |
| 81 */ | 106 */ |
| 82 struct PP_Var (*ExecuteScript)(PP_Instance instance, | 107 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
| 83 struct PP_Var script, | 108 struct PP_Var script, |
| 84 struct PP_Var* exception); | 109 struct PP_Var* exception); |
| 85 }; | 110 }; |
| 86 /** | 111 /** |
| 87 * @} | 112 * @} |
| 88 */ | 113 */ |
| 89 | 114 |
| 90 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ | 115 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ |
| 91 | 116 |
| OLD | NEW |