OLD | NEW |
---|---|
(Empty) | |
1 /* Copyright 2014 The Chromium Authors. All rights reserved. | |
2 * Use of this source code is governed by a BSD-style license that can be | |
3 * found in the LICENSE file. | |
4 */ | |
5 | |
6 /** | |
7 * This file defines the <code>PPB_Messaging</code> interface implemented | |
8 * by the browser for sending messages to DOM elements associated with a | |
9 * specific module instance. | |
10 */ | |
11 | |
12 label Chrome { | |
13 [channel=dev] M36 = 0.1 | |
14 }; | |
15 | |
16 /** | |
17 * The <code>PPP_MessageHandler</code> interface is implemented by the plugin | |
18 * if the plugin wants to receive messages from a thread other than the main | |
19 * Pepper thread, or if the plugin wants to handle blocking messages which | |
20 * JavaScript may send via postMessageAndAwaitResponse(). | |
21 * | |
22 * This interface struct should not be returned by PPP_GetInterface; instead it | |
23 * must be passed as a parameter to PPB_Messaging::RegisterMessageHandler. | |
24 */ | |
25 [no_interface_string] | |
26 interface PPP_MessageHandler { | |
darin (slow to review)
2014/05/02 08:02:15
Perhaps an alternative approach is to expose a PPB
dmichael (off chromium)
2014/05/02 16:28:54
Right, I started out down that road. It actually g
| |
27 /** | |
28 * Invoked as a result of JavaScript invoking postMessage() on the plugin's | |
29 * DOM element. | |
30 * | |
31 * @param[in] instance A <code>PP_Instance</code> identifying one instance | |
32 * of a module. | |
33 * @param[in] user_data is the same pointer which was provided by a call to | |
34 * RegisterMessageHandler. | |
35 * @param[in] message A copy of the parameter that JavaScript provided to | |
36 * postMessage(). | |
37 */ | |
38 void HandleMessage([in] PP_Instance instance, | |
39 [in] mem_t user_data, | |
40 [in] PP_Var message); | |
41 /** | |
42 * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() | |
43 * on the plugin's DOM element. | |
44 * | |
45 * @param[in] instance A <code>PP_Instance</code> identifying one instance | |
46 * of a module. | |
47 * @param[in] user_data is the same pointer which was provided by a call to | |
48 * RegisterMessageHandler. | |
49 * @param[in] message is a copy of the parameter that JavaScript provided | |
50 * to postMessageAndAwaitResponse. | |
51 * @return will be copied to a JavaScript object which is returned as | |
52 * the result of postMessageAndAwaitResponse to the invoking JavaScript. | |
53 */ | |
54 PP_Var HandleBlockingMessage([in] PP_Instance instance, | |
55 [in] mem_t user_data, | |
56 [in] PP_Var message); | |
57 /** | |
58 * Invoked when the handler object is no longer needed. After this, no more | |
59 * calls will be made which pass this same value for <code>instance</code> | |
60 * and <code>user_data</code>. | |
61 * | |
62 * @param[in] instance A <code>PP_Instance</code> identifying one instance | |
63 * of a module. | |
64 * @param[in] user_data is the same pointer which was provided by a call to | |
65 * RegisterMessageHandler. | |
66 */ | |
67 void Destroy([in] PP_Instance instance, | |
68 [in] mem_t user_data); | |
69 }; | |
70 | |
OLD | NEW |