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_0_4 "PPB_Instance;0.4" |
14 #define PPB_INSTANCE_INTERFACE_0_5 "PPB_Instance;0.5" | |
15 | |
16 #define PPB_INSTANCE_INTERFACE PPB_INSTANCE_INTERFACE_0_5 | |
14 | 17 |
15 /** | 18 /** |
16 * @file | 19 * @file |
17 * This file defines the PPB_Instance interface implemented by the | 20 * This file defines the PPB_Instance interface implemented by the |
18 * browser and containing pointers to functions related to | 21 * browser and containing pointers to functions related to |
19 * the module instance on a web page. | 22 * the module instance on a web page. |
20 * | 23 * |
21 * @addtogroup Interfaces | 24 * @addtogroup Interfaces |
22 * @{ | 25 * @{ |
23 */ | 26 */ |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 * @param[in/out] exception PP_Var containing the exception. Initialize | 103 * @param[in/out] exception PP_Var containing the exception. Initialize |
101 * this to NULL if you don't want exception info; initialize this to a void | 104 * this to NULL if you don't want exception info; initialize this to a void |
102 * exception if want exception info. | 105 * exception if want exception info. |
103 * | 106 * |
104 * @return The result of the script execution, or a "void" var | 107 * @return The result of the script execution, or a "void" var |
105 * if execution failed. | 108 * if execution failed. |
106 */ | 109 */ |
107 struct PP_Var (*ExecuteScript)(PP_Instance instance, | 110 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
108 struct PP_Var script, | 111 struct PP_Var script, |
109 struct PP_Var* exception); | 112 struct PP_Var* exception); |
113 | |
114 /** | |
115 * @a PostMessage is a pointer to a function which asynchronously invokes th | |
brettw
2011/03/16 21:34:11
th -> the
dmichael(do not use this one)
2011/03/21 21:43:35
Done.
| |
116 * onmessage handler on the DOM element for this module instance, if one | |
117 * exists. @a message is a PP_Var containing the data to be sent to | |
118 * JavaScript. Currently, it can have an int32_t, double, bool, or string | |
119 * value (objects are not currently supported.) | |
120 * | |
121 * The onmessage handler in JavaScript code will receive an object conforming | |
122 * to the MessageEvent interface. In particular, the value of @a message will | |
123 * be contained as a property called @a data in the received MessageEvent. | |
124 * This is analogous to listening for messages from Web Workers. | |
125 * | |
126 * See: | |
127 * http://www.whatwg.org/specs/web-workers/current-work/ | |
128 * | |
129 * For example: | |
130 * | |
131 * \verbatim | |
132 * | |
133 * <body> | |
134 * <object id="plugin" | |
135 * type="application/x-ppapi-postMessage-example"/> | |
136 * <script type="text/javascript"> | |
137 * document.getElementById('plugin').onmessage = function(message) { | |
138 * alert(message.data); | |
139 * } | |
140 * </script> | |
141 * </body> | |
142 * | |
143 * \endverbatim | |
144 * | |
145 * If the module instance then invokes @a PostMessage() as follows: | |
146 * <code> | |
147 * char hello_world[] = "Hello world!"; | |
148 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance, | |
149 * hello_world, | |
150 * sizeof(hello_world)); | |
151 * the_ppb_instance->PostMessage(instance, hello_var); | |
152 * </code> | |
153 * | |
154 * The browser will pop-up an alert saying "Hello world!". | |
155 */ | |
156 void (*PostMessage)(PP_Instance instance, struct PP_Var message); | |
110 }; | 157 }; |
111 /** | 158 /** |
112 * @} | 159 * @} |
113 */ | 160 */ |
114 | 161 |
115 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ | 162 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ |
116 | 163 |
OLD | NEW |