|
1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 include protocol PPluginInstance; |
|
7 include protocol PPluginIdentifier; |
|
8 |
|
9 using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; |
|
10 using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; |
|
11 |
|
12 namespace mozilla { |
|
13 namespace plugins { |
|
14 |
|
15 union Variant { |
|
16 void_t; |
|
17 null_t; |
|
18 bool; |
|
19 int; |
|
20 double; |
|
21 nsCString; |
|
22 nullable PPluginScriptableObject; |
|
23 }; |
|
24 |
|
25 intr protocol PPluginScriptableObject |
|
26 { |
|
27 manager PPluginInstance; |
|
28 |
|
29 both: |
|
30 async __delete__(); |
|
31 |
|
32 parent: |
|
33 intr NPN_Evaluate(nsCString aScript) |
|
34 returns (Variant aResult, |
|
35 bool aSuccess); |
|
36 |
|
37 child: |
|
38 intr Invalidate(); |
|
39 |
|
40 both: |
|
41 // NPClass methods |
|
42 intr HasMethod(PPluginIdentifier aId) |
|
43 returns (bool aHasMethod); |
|
44 |
|
45 intr Invoke(PPluginIdentifier aId, |
|
46 Variant[] aArgs) |
|
47 returns (Variant aResult, |
|
48 bool aSuccess); |
|
49 |
|
50 intr InvokeDefault(Variant[] aArgs) |
|
51 returns (Variant aResult, |
|
52 bool aSuccess); |
|
53 |
|
54 intr HasProperty(PPluginIdentifier aId) |
|
55 returns (bool aHasProperty); |
|
56 |
|
57 intr SetProperty(PPluginIdentifier aId, |
|
58 Variant aValue) |
|
59 returns (bool aSuccess); |
|
60 |
|
61 intr RemoveProperty(PPluginIdentifier aId) |
|
62 returns (bool aSuccess); |
|
63 |
|
64 intr Enumerate() |
|
65 returns (PPluginIdentifier[] aProperties, |
|
66 bool aSuccess); |
|
67 |
|
68 intr Construct(Variant[] aArgs) |
|
69 returns (Variant aResult, |
|
70 bool aSuccess); |
|
71 |
|
72 // Objects are initially unprotected, and the Protect and Unprotect functions |
|
73 // only affect protocol objects that represent NPObjects created in the same |
|
74 // process (rather than protocol objects that are a proxy for an NPObject |
|
75 // created in another process). Protocol objects representing local NPObjects |
|
76 // are protected after an NPObject has been associated with the protocol |
|
77 // object. Sending the protocol object as an argument to the other process |
|
78 // temporarily protects the protocol object again for the duration of the call. |
|
79 async Protect(); |
|
80 async Unprotect(); |
|
81 |
|
82 /** |
|
83 * GetProperty is slightly wonky due to the way we support NPObjects that have |
|
84 * methods and properties with the same name. When child calls parent we |
|
85 * simply return a property. When parent calls child, however, we need to do |
|
86 * several checks at once and return all the results simultaneously. |
|
87 */ |
|
88 parent: |
|
89 intr GetParentProperty(PPluginIdentifier aId) |
|
90 returns (Variant aResult, |
|
91 bool aSuccess); |
|
92 |
|
93 child: |
|
94 intr GetChildProperty(PPluginIdentifier aId) |
|
95 returns (bool aHasProperty, |
|
96 bool aHasMethod, |
|
97 Variant aResult, |
|
98 bool aSuccess); |
|
99 }; |
|
100 |
|
101 } // namespace plugins |
|
102 } // namespace mozilla |