Bumping manifests a=b2g-bump
[gecko.git] / dom / plugins / ipc / PPluginInstance.ipdl
blob659805e99981945ec39889646ffe6ea56abe53d2
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/. */
6 include protocol PPluginBackgroundDestroyer;
7 include protocol PPluginModule;
8 include protocol PPluginScriptableObject;
9 include protocol PBrowserStream;
10 include protocol PPluginStream;
11 include protocol PStreamNotify;
12 include protocol PPluginSurface;
14 include "mozilla/GfxMessageUtils.h";
16 using NPError from "npapi.h";
17 using struct mozilla::plugins::NPRemoteWindow from "mozilla/plugins/PluginMessageUtils.h";
18 using struct mozilla::plugins::NPRemoteEvent from "mozilla/plugins/PluginMessageUtils.h";
19 using NPRect from "npapi.h";
20 using NPNURLVariable from "npapi.h";
21 using NPCoordinateSpace from "npapi.h";
22 using NPNVariable from "npapi.h";
23 using mozilla::plugins::NativeWindowHandle from "mozilla/plugins/PluginMessageUtils.h";
24 using gfxSurfaceType from "gfxTypes.h";
25 using gfxIntSize from "nsSize.h";
26 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
27 using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
28 using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
29 using struct nsIntRect from "nsRect.h";
31 namespace mozilla {
32 namespace plugins {
34 struct IOSurfaceDescriptor {
35   uint32_t surfaceId;
36   double contentsScaleFactor;
39 union SurfaceDescriptor {
40   Shmem;
41   SurfaceDescriptorX11;
42   PPluginSurface; // used on Windows
43   IOSurfaceDescriptor; // used on OSX 10.5+
44   // Descriptor can be null here in case
45   // 1) of first Show call (prevSurface is null)
46   // 2) when child is going to destroy
47   //    and it just want to grab prevSurface
48   //     back without giving new surface
49   null_t;
52 union OptionalShmem {
53   Shmem;
54   null_t;
57 intr protocol PPluginInstance
59   manager PPluginModule;
61   manages PPluginBackgroundDestroyer;
62   manages PPluginScriptableObject;
63   manages PBrowserStream;
64   manages PPluginStream;
65   manages PStreamNotify;
66   manages PPluginSurface;
68 child:
69   intr __delete__();
71   intr NPP_SetWindow(NPRemoteWindow window);
73   intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams()
74     returns (bool value, NPError result);
76   // this message is not used on non-X platforms
77   intr NPP_GetValue_NPPVpluginNeedsXEmbed()
78     returns (bool value, NPError result);
80   intr NPP_GetValue_NPPVpluginScriptableNPObject()
81     returns (nullable PPluginScriptableObject value, NPError result);
83   intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
84   intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
85     returns (nsCString plug_id, NPError result);
87   intr NPP_HandleEvent(NPRemoteEvent event)
88     returns (int16_t handled);
89   // special cases where we need to a shared memory buffer
90   intr NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
91     returns (int16_t handled, Shmem rtnbuffer);
92   // special cases where we need an iosurface
93   intr NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
94     returns (int16_t handled);
95   // special cases of HandleEvent to make mediating races simpler
96   intr Paint(NPRemoteEvent event)
97     returns (int16_t handled);
98   // this is only used on windows to forward WM_WINDOWPOSCHANGE
99   async WindowPosChanged(NPRemoteEvent event);
100   // used on OS X to tell the child the contents scale factor
101   // of its parent has changed
102   async ContentsScaleFactorChanged(double aContentsScaleFactor);
104   // ********************** Async plugins rendering
105   // see https://wiki.mozilla.org/Gecko:AsyncPluginPainting
106   // **********************
108   // Async version of SetWindow call
109   // @param surfaceType - gfxASurface::gfxSurfaceType
110   //        plugin child must create offscreen buffer
111   //        with type equals to surfaceType
112   async AsyncSetWindow(gfxSurfaceType surfaceType, NPRemoteWindow window);
114   // There is now an opaque background behind this instance (or the
115   // background was updated).  The changed area is |rect|.  The
116   // browser owns the background surface, and it's read-only from
117   // within the plugin process.  |background| is either null_t to
118   // refer to the existing background or a fresh descriptor.
119   async UpdateBackground(SurfaceDescriptor background, nsIntRect rect);
121   async NPP_DidComposite();
123   intr NPP_Destroy()
124     returns (NPError rv);
126 parent:
127   intr NPN_GetValue_NPNVWindowNPObject()
128     returns (nullable PPluginScriptableObject value, NPError result);
129   intr NPN_GetValue_NPNVPluginElementNPObject()
130     returns (nullable PPluginScriptableObject value, NPError result);
131   intr NPN_GetValue_NPNVprivateModeBool()
132     returns (bool value, NPError result);
133   intr NPN_GetValue_NPNVnetscapeWindow()
134     returns (NativeWindowHandle value, NPError result);
135   intr NPN_GetValue_NPNVdocumentOrigin()
136     returns (nsCString value, NPError result);
137   intr NPN_GetValue_DrawingModelSupport(NPNVariable model)
138     returns (bool value);
140   intr NPN_SetValue_NPPVpluginWindow(bool windowed)
141     returns (NPError result);
142   intr NPN_SetValue_NPPVpluginTransparent(bool transparent)
143     returns (NPError result);
144   intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor)
145     returns (NPError result);
146   intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
147     returns (NPError result);
148   intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
149     returns (NPError result);
151   intr NPN_GetURL(nsCString url, nsCString target)
152     returns (NPError result);
153   intr NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file)
154     returns (NPError result);
156   /**
157    * Covers both NPN_GetURLNotify and NPN_PostURLNotify.
158    * @TODO This would be more readable as an overloaded method,
159    *       but IPDL doesn't allow that for constructors.
160    */
161   intr PStreamNotify(nsCString url, nsCString target, bool post,
162                     nsCString buffer, bool file)
163     returns (NPError result);
165   async NPN_InvalidateRect(NPRect rect);
167   // Give |newSurface|, containing this instance's updated pixels, to
168   // the browser for compositing.  When this method returns, any surface 
169   // previously passed to Show may be destroyed.
170   //
171   // @param rect - actually updated rectangle, comparing to prevSurface content
172   //               could be used for partial render of layer to topLevel context
173   // @param newSurface - remotable surface
174   // @param prevSurface - if the previous surface was shared-memory, returns
175   //                      the shmem for reuse
176   sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
177     returns (SurfaceDescriptor prevSurface);
179   async PPluginSurface(WindowsSharedMemoryHandle handle,
180                        gfxIntSize size,
181                        bool transparent);
183   intr NPN_PushPopupsEnabledState(bool aState);
185   intr NPN_PopPopupsEnabledState();
187   intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
188     returns (nsCString value, NPError result);
190   intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
191                          nsCString value)
192     returns (NPError result);
194   intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
195                                 int32_t port, nsCString scheme,
196                                 nsCString realm)
197     returns (nsCString username, nsCString password, NPError result);
199   intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
200                        NPCoordinateSpace destSpace)
201     returns (double destX, double destY, bool result);
203   async RedrawPlugin();
205   // Send notification that a plugin tried to negotiate Carbon NPAPI so that
206   // users can be notified that restarting the browser in i386 mode may allow
207   // them to use the plugin.
208   sync NegotiatedCarbon();
210   // Notifies the parent of its NPP_New result code.
211   async AsyncNPP_NewResult(NPError aResult);
213 both:
214   async PPluginScriptableObject();
216 child:
217   /* NPP_NewStream */
218   async PBrowserStream(nsCString url,
219                        uint32_t length,
220                        uint32_t lastmodified,
221                        nullable PStreamNotify notifyData,
222                        nsCString headers);
224   // Implements the legacy (synchronous) version of NPP_NewStream for when
225   // async plugin init is preffed off.
226   intr NPP_NewStream(PBrowserStream actor, nsCString mimeType, bool seekable)
227     returns (NPError rv,
228              uint16_t stype);
230   // Implements the async plugin init version of NPP_NewStream.
231   async AsyncNPP_NewStream(PBrowserStream actor, nsCString mimeType, bool seekable);
233 parent:
234   /* NPN_NewStream */
235   intr PPluginStream(nsCString mimeType,
236                     nsCString target)
237     returns (NPError result);
239 parent:
240   intr PluginFocusChange(bool gotFocus);
242 child:
243   intr SetPluginFocus();
244   intr UpdateWindow();
246   async PPluginBackgroundDestroyer();
249 } // namespace plugins
250 } // namespace mozilla