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 * Defines the API ... | 17 * Defines the API ... |
18 * | 18 * |
19 * @addtogroup Interfaces | 19 * @addtogroup Interfaces |
20 * @{ | 20 * @{ |
21 */ | 21 */ |
22 | 22 |
23 struct PPB_Instance { | 23 struct PPB_Instance { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 * @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; |
76 * initialize this to a void exception if you do. | 76 * initialize this to a void exception if you do. |
77 * See the function description for details. | 77 * See the function description for details. |
78 * | 78 * |
79 * @return The result of the script execution, | 79 * @return The result of the script execution, |
80 * or a "void" var if execution failed. | 80 * or a "void" var if execution failed. |
81 */ | 81 */ |
82 struct PP_Var (*ExecuteScript)(PP_Instance instance, | 82 struct PP_Var (*ExecuteScript)(PP_Instance instance, |
83 struct PP_Var script, | 83 struct PP_Var script, |
84 struct PP_Var* exception); | 84 struct PP_Var* exception); |
| 85 |
| 86 /** |
| 87 * PostMessage asynchronously invokes the onmessage handler of the 'embed' |
| 88 * instance, if one exists. This is analogous to listening for messages from |
| 89 * Web Workers. |
| 90 * See: |
| 91 * http://www.whatwg.org/specs/web-workers/current-work/ |
| 92 * |
| 93 * For example: |
| 94 * |
| 95 * <body> |
| 96 * <object id="module" |
| 97 * type="application/x-ppapi-postMessage-example"/> |
| 98 * <script type="text/javascript"> |
| 99 * document.getElementById('module').onmessage = function(message) { |
| 100 * alert(message.data); |
| 101 * } |
| 102 * </script> |
| 103 * </body> |
| 104 * |
| 105 * If the module then invokes PostMessage as follows: |
| 106 * char hello_world[] = "Hello world!"; |
| 107 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance, |
| 108 * hello_world, |
| 109 * sizeof(hello_world)); |
| 110 * the_ppb_instance->PostMessage(instance, hello_var); |
| 111 * |
| 112 * The browser will pop-up an alert saying "Hello world!". |
| 113 */ |
| 114 void (*PostMessage)(PP_Instance instance, struct PP_Var message); |
85 }; | 115 }; |
86 /** | 116 /** |
87 * @} | 117 * @} |
88 */ | 118 */ |
89 | 119 |
90 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ | 120 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ |
91 | 121 |
OLD | NEW |