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

Side by Side Diff: ppapi/api/ppb_messaging.idl

Issue 252023009: PPAPI: Add dev synchronous JS->Plugin messaging API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: improve comments Created 6 years, 7 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
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 /* Copyright (c) 2012 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 5
6 /** 6 /**
7 * This file defines the <code>PPB_Messaging</code> interface implemented 7 * This file defines the <code>PPB_Messaging</code> interface implemented
8 * by the browser for sending messages to DOM elements associated with a 8 * by the browser for sending messages to DOM elements associated with a
9 * specific module instance. 9 * specific module instance.
10 */ 10 */
11 11
12 [generate_thunk] 12 [generate_thunk]
13 13
14 label Chrome { 14 label Chrome {
15 M14 = 1.0 15 M14 = 1.0,
16 [channel=dev] M36 = 1.1
16 }; 17 };
17 18
18 /** 19 /**
19 * The <code>PPB_Messaging</code> interface is implemented by the browser 20 * The <code>PPB_Messaging</code> interface is implemented by the browser
20 * and is related to sending messages to JavaScript message event listeners on 21 * and is related to sending messages to JavaScript message event listeners on
21 * the DOM element associated with specific module instance. 22 * the DOM element associated with specific module instance.
22 */ 23 */
23 interface PPB_Messaging { 24 interface PPB_Messaging {
24 /** 25 /**
25 * PostMessage() asynchronously invokes any listeners for message events on 26 * PostMessage() asynchronously invokes any listeners for message events on
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance, 75 * PP_Var hello_var = ppb_var_interface->VarFromUtf8(instance,
75 * hello_world, 76 * hello_world,
76 * sizeof(hello_world)); 77 * sizeof(hello_world));
77 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var. 78 * ppb_messaging_interface->PostMessage(instance, hello_var); // Copies var.
78 * ppb_var_interface->Release(hello_var); 79 * ppb_var_interface->Release(hello_var);
79 * 80 *
80 * @endcode 81 * @endcode
81 * 82 *
82 * The browser will pop-up an alert saying "Hello world!" 83 * The browser will pop-up an alert saying "Hello world!"
83 */ 84 */
85 [version=1.0]
84 void PostMessage([in] PP_Instance instance, [in] PP_Var message); 86 void PostMessage([in] PP_Instance instance, [in] PP_Var message);
87
88 /**
89 * Registers a handler for receiving messages from JavaScript. If a handler
90 * is registered this way, it will replace PPP_Messaging, and all messages
91 * sent from JavaScript via postMessage and postMessageAndAwaitResponse will
92 * be dispatched to <code>handler</code>.
93 *
94 * The function calls will be dispatched via <code>message_loop</code>. This
95 * means that the functions will be invoked on the thread to which
96 * <code>message_loop</code> is attached, when <code>message_loop</code> is
97 * run. It is illegal to pass the main thread message loop;
98 * RegisterMessageHandler will return PP_ERROR_WRONG_THREAD in that case.
99 *
100 * Attempting to register a message handler when one is already registered
101 * will cause the current MessageHandler to be unregistered and replaced. In
102 * that case, no messages will be sent to the "default" message handler
103 * (PPP_Messaging). Messages will stop arriving at the prior message handler
104 * and will begin to be dispatched at the new message handler.
105 *
106 * @param[in] instance A <code>PP_Instance</code> identifying one instance
107 * of a module.
108 * @param[in] user_data A pointer the plugin may choose to use when handling
109 * calls to functions within PPP_MessageHandler. The browser will pass this
110 * same pointer when invoking functions within PPP_MessageHandler.
111 * @param[in] handler The plugin-provided set of functions for handling
112 * messages.
113 * @param[in] message_loop represents the message loop on which
114 * PPP_MessageHandler functions should be invoked.
115 * @return PP_OK on success, or an error from pp_errors.h.
116 */
117 [version=1.1]
118 int32_t RegisterMessageHandler([in] PP_Instance instance,
119 [in] mem_t user_data,
120 [in] PPP_MessageHandler handler,
121 [in] PP_Resource message_loop);
122 /**
123 * Unregisters the current message handler for <code>instance</code> if one
124 * is registered. After this call, the message handler (if one was
125 * registered) will have "Destroy" called on it and will receive no further
126 * messages after that point. After that point, all messages sent from
127 * JavaScript using postMessage() will be dispatched to PPP_Messaging (if
128 * the plugin supports PPP_MESSAGING_INTERFACE). Attempts to call
129 * postMessageAndAwaitResponse() from JavaScript will fail.
130 *
131 * Attempting to unregister a message handler when none is registered has no
132 * effect.
133 *
134 * @param[in] instance A <code>PP_Instance</code> identifying one instance
135 * of a module.
136 */
137 [version=1.1]
138 void UnregisterMessageHandler([in] PP_Instance instance);
85 }; 139 };
86 140
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698