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.5" |
| 14 | 14 |
| 15 /** | 15 /** |
| 16 * @file | 16 * @file |
| 17 * This file defines the PPB_Instance interface implemented by the | 17 * This file defines the PPB_Instance interface implemented by the |
| 18 * browser and containing pointers to functions related to | 18 * browser and containing pointers to functions related to |
| 19 * the module instance on a web page. | 19 * the module instance on a web page. |
| 20 * | 20 * |
| 21 * @addtogroup Interfaces | 21 * @addtogroup Interfaces |
| 22 * @{ | 22 * @{ |
| 23 */ | 23 */ |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 * @param[in/out] exception PP_Var containing the exception. Initialize | 100 * @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 | 101 * this to NULL if you don't want exception info; initialize this to a void |
| 102 * exception if want exception info. | 102 * exception if want exception info. |
| 103 * | 103 * |
| 104 * @return The result of the script execution, or a "void" var | 104 * @return The result of the script execution, or a "void" var |
| 105 * if execution failed. | 105 * if execution failed. |
| 106 */ | 106 */ |
| 107 struct PP_Var (*ExecuteScript)(PP_Instance instance, | 107 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
| 108 struct PP_Var script, | 108 struct PP_Var script, |
| 109 struct PP_Var* exception); | 109 struct PP_Var* exception); |
| 110 | |
| 111 /** | |
| 112 * PostMessage asynchronously invokes the onmessage handler of the 'embed' | |
|
polina
2011/02/26 08:00:08
s/'embed' instance/module instance/
dmichael(do not use this one)
2011/02/28 15:59:28
That's not quite what I was trying (badly) to conv
| |
| 113 * instance, if one exists. This is analogous to listening for messages from | |
| 114 * Web Workers. | |
| 115 * See: | |
| 116 * http://www.whatwg.org/specs/web-workers/current-work/ | |
| 117 * | |
| 118 * For example: | |
| 119 * | |
| 120 * <body> | |
| 121 * <object id="module" | |
|
polina
2011/02/26 08:00:08
s/module/plugin/
(You are also misusing the word "
dmichael(do not use this one)
2011/02/28 15:59:28
Done.
| |
| 122 * type="application/x-ppapi-postMessage-example"/> | |
| 123 * <script type="text/javascript"> | |
| 124 * document.getElementById('module').onmessage = function(message) { | |
| 125 * alert(message.data); | |
|
polina
2011/02/26 08:00:08
It would be a good idea to extend the header comme
dmichael(do not use this one)
2011/02/28 15:59:28
Done.
| |
| 126 * } | |
| 127 * </script> | |
| 128 * </body> | |
| 129 * | |
| 130 * If the module then invokes PostMessage as follows: | |
|
polina
2011/02/26 08:00:08
PostMessage()
dmichael(do not use this one)
2011/02/28 15:59:28
Done. I also threw in some @a doxygen annotations
polina
2011/03/03 00:22:16
You should be consistent with whatever annotations
| |
| 131 * char hello_world[] = "Hello world!"; | |
| 132 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance, | |
| 133 * hello_world, | |
| 134 * sizeof(hello_world)); | |
| 135 * the_ppb_instance->PostMessage(instance, hello_var); | |
| 136 * | |
| 137 * The browser will pop-up an alert saying "Hello world!". | |
| 138 */ | |
| 139 void (*PostMessage)(PP_Instance instance, struct PP_Var message); | |
|
polina
2011/02/26 08:00:08
Can this be any type of PP_Var?
dmichael(do not use this one)
2011/02/28 15:59:28
I added more information to the top-level comment.
| |
| 110 }; | 140 }; |
| 111 /** | 141 /** |
| 112 * @} | 142 * @} |
| 113 */ | 143 */ |
| 114 | 144 |
| 115 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ | 145 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ |
| 116 | 146 |
| OLD | NEW |