Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: ppapi/c/ppb_instance.h

Issue 6538028: A proposal for an initial postMessage interface. This will allow JavaScript ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/c/ppp_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 * @a PostMessage asynchronously invokes the onmessage handler on the DOM
polina 2011/03/03 00:22:16 Btw, note that our tech writers are changing all t
113 * element for this module instance, if one exists. @a message is a PP_Var
114 * containing the data to be sent to JavaScript. Currently, it can have an
115 * int32_t, double, bool, or string value (objects are not currently
polina 2011/03/03 00:22:16 Thanks for the helpful clarification. I would say
116 * supported.)
117 *
118 * The onmessage handler in JavaScript code will receive an object conforming
119 * to the MessageEvent interface. In particular, the value of @a message will
120 * be contained as a property called @a data in the received MessageEvent.
121 * This is analogous to listening for messages from Web Workers.
122 *
123 * See:
124 * http://www.whatwg.org/specs/web-workers/current-work/
125 *
126 * For example:
127 *
128 * <body>
129 * <object id="plugin"
130 * type="application/x-ppapi-postMessage-example"/>
131 * <script type="text/javascript">
132 * document.getElementById('plugin').onmessage = function(message) {
133 * alert(message.data);
134 * }
135 * </script>
136 * </body>
137 *
138 * If the module instance then invokes @a PostMessage() as follows:
139 * char hello_world[] = "Hello world!";
140 * PP_Var hello_var = ppb_var_if->VarFromUtf8(instance,
141 * hello_world,
142 * sizeof(hello_world));
143 * the_ppb_instance->PostMessage(instance, hello_var);
144 *
145 * The browser will pop-up an alert saying "Hello world!".
146 */
147 void (*PostMessage)(PP_Instance instance, struct PP_Var message);
110 }; 148 };
111 /** 149 /**
112 * @} 150 * @}
113 */ 151 */
114 152
115 #endif /* PPAPI_C_PPB_INSTANCE_H_ */ 153 #endif /* PPAPI_C_PPB_INSTANCE_H_ */
116 154
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/ppp_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698