Merge mozilla-central and tracemonkey. (a=blockers)
[mozilla-central.git] / dom / plugins / PPluginScriptableObject.ipdl
blob8f17c21bf26f1e298ce4f7a5ecbbc1182b87c61a
1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4  *
5  * The contents of this file are subject to the Mozilla Public License Version
6  * 1.1 (the "License"); you may not use this file except in compliance with
7  * the License. You may obtain a copy of the License at
8  * http://www.mozilla.org/MPL/
9  *
10  * Software distributed under the License is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12  * for the specific language governing rights and limitations under the
13  * License.
14  *
15  * The Original Code is Mozilla Plugins.
16  *
17  * The Initial Developer of the Original Code is
18  *   Chris Jones <jones.chris.g@gmail.com>.
19  * Portions created by the Initial Developer are Copyright (C) 2009
20  * the Initial Developer. All Rights Reserved.
21  *
22  * Contributor(s):
23  *   Benjamin Smedberg <benjamin@smedbergs.us>
24  *   Ben Turner <bent.mozilla@gmail.com>
25  *
26  * Alternatively, the contents of this file may be used under the terms of
27  * either the GNU General Public License Version 2 or later (the "GPL"), or
28  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29  * in which case the provisions of the GPL or the LGPL are applicable instead
30  * of those above. If you wish to allow use of your version of this file only
31  * under the terms of either the GPL or the LGPL, and not to allow others to
32  * use your version of this file under the terms of the MPL, indicate your
33  * decision by deleting the provisions above and replace them with the notice
34  * and other provisions required by the GPL or the LGPL. If you do not delete
35  * the provisions above, a recipient may use your version of this file under
36  * the terms of any one of the MPL, the GPL or the LGPL.
37  *
38  * ***** END LICENSE BLOCK ***** */
40 include protocol PPluginInstance;
41 include protocol PPluginIdentifier;
43 include "npapi.h";
44 include "npruntime.h";
45 include "mozilla/plugins/PluginMessageUtils.h";
47 using mozilla::void_t;
48 using mozilla::null_t;
50 namespace mozilla {
51 namespace plugins {
53 union Variant {
54   void_t;
55   null_t;
56   bool;
57   int;
58   double;
59   nsCString;
60   nullable PPluginScriptableObject;
63 rpc protocol PPluginScriptableObject
65   manager PPluginInstance;
67 both:
68   async __delete__();
70 parent:
71   rpc NPN_Evaluate(nsCString aScript)
72     returns (Variant aResult,
73              bool aSuccess);
75 child:
76   rpc Invalidate();
78 both:
79   // NPClass methods
80   rpc HasMethod(PPluginIdentifier aId)
81     returns (bool aHasMethod);
83   rpc Invoke(PPluginIdentifier aId,
84              Variant[] aArgs)
85     returns (Variant aResult,
86              bool aSuccess);
88   rpc InvokeDefault(Variant[] aArgs)
89     returns (Variant aResult,
90              bool aSuccess);
92   rpc HasProperty(PPluginIdentifier aId)
93     returns (bool aHasProperty);
95   rpc SetProperty(PPluginIdentifier aId,
96                   Variant aValue)
97     returns (bool aSuccess);
99   rpc RemoveProperty(PPluginIdentifier aId)
100     returns (bool aSuccess);
102   rpc Enumerate()
103     returns (PPluginIdentifier[] aProperties,
104              bool aSuccess);
106   rpc Construct(Variant[] aArgs)
107     returns (Variant aResult,
108              bool aSuccess);
110   // Objects are initially unprotected, and the Protect and Unprotect functions
111   // only affect protocol objects that represent NPObjects created in the same
112   // process (rather than protocol objects that are a proxy for an NPObject
113   // created in another process). Protocol objects representing local NPObjects
114   // are protected after an NPObject has been associated with the protocol
115   // object. Sending the protocol object as an argument to the other process
116   // temporarily protects the protocol object again for the duration of the call.
117   async Protect();
118   async Unprotect();
120   /**
121    * GetProperty is slightly wonky due to the way we support NPObjects that have
122    * methods and properties with the same name. When child calls parent we
123    * simply return a property. When parent calls child, however, we need to do
124    * several checks at once and return all the results simultaneously.
125    */
126 parent:
127   rpc GetParentProperty(PPluginIdentifier aId)
128     returns (Variant aResult,
129              bool aSuccess);
131 child:
132   rpc GetChildProperty(PPluginIdentifier aId)
133     returns (bool aHasProperty,
134              bool aHasMethod,
135              Variant aResult,
136              bool aSuccess);
139 } // namespace plugins
140 } // namespace mozilla