dom/plugins/ipc/PPluginInstance.ipdl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 NPImageFormat from "npapi.h";
    21 using NPNURLVariable from "npapi.h";
    22 using NPCoordinateSpace from "npapi.h";
    23 using NPNVariable from "npapi.h";
    24 using mozilla::plugins::NativeWindowHandle from "mozilla/plugins/PluginMessageUtils.h";
    25 using gfxSurfaceType from "gfxTypes.h";
    26 using gfxIntSize from "nsSize.h";
    27 using struct mozilla::null_t from "ipc/IPCMessageUtils.h";
    28 using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h";
    29 using mozilla::plugins::DXGISharedSurfaceHandle from "mozilla/plugins/PluginMessageUtils.h";
    30 using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h";
    31 using struct SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h";
    32 using struct nsIntRect from "nsRect.h";
    34 namespace mozilla {
    35 namespace plugins {
    37 struct IOSurfaceDescriptor {
    38   uint32_t surfaceId;
    39   double contentsScaleFactor;
    40 };
    42 union SurfaceDescriptor {
    43   Shmem;
    44   SurfaceDescriptorX11;
    45   PPluginSurface; // used on Windows
    46   IOSurfaceDescriptor; // used on OSX 10.5+
    47   // Descriptor can be null here in case
    48   // 1) of first Show call (prevSurface is null)
    49   // 2) when child is going to destroy
    50   //    and it just want to grab prevSurface
    51   //     back without giving new surface
    52   null_t;
    53 };
    55 union OptionalShmem {
    56   Shmem;
    57   null_t;
    58 };
    60 union AsyncSurfaceDescriptor {
    61   Shmem;
    62   DXGISharedSurfaceHandle;
    63 };
    65 struct NPRemoteAsyncSurface
    66 {
    67   uint32_t version;
    68   gfxIntSize size;
    69   NPImageFormat format;
    70   uint32_t      stride;
    71   AsyncSurfaceDescriptor data;
    72   uintptr_t hostPtr;
    73 };
    75 intr protocol PPluginInstance
    76 {
    77   manager PPluginModule;
    79   manages PPluginBackgroundDestroyer;
    80   manages PPluginScriptableObject;
    81   manages PBrowserStream;
    82   manages PPluginStream;
    83   manages PStreamNotify;
    84   manages PPluginSurface;
    86 child:
    87   intr __delete__();
    89   intr NPP_SetWindow(NPRemoteWindow window);
    91   intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams()
    92     returns (bool value, NPError result);
    94   // this message is not used on non-X platforms
    95   intr NPP_GetValue_NPPVpluginNeedsXEmbed()
    96     returns (bool value, NPError result);
    98   intr NPP_GetValue_NPPVpluginScriptableNPObject()
    99     returns (nullable PPluginScriptableObject value, NPError result);
   101   intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
   102   intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId()
   103     returns (nsCString plug_id, NPError result);
   105   intr NPP_HandleEvent(NPRemoteEvent event)
   106     returns (int16_t handled);
   107   // special cases where we need to a shared memory buffer
   108   intr NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
   109     returns (int16_t handled, Shmem rtnbuffer);
   110   // special cases where we need an iosurface
   111   intr NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
   112     returns (int16_t handled);
   113   // special cases of HandleEvent to make mediating races simpler
   114   intr Paint(NPRemoteEvent event)
   115     returns (int16_t handled);
   116   // this is only used on windows to forward WM_WINDOWPOSCHANGE
   117   async WindowPosChanged(NPRemoteEvent event);
   118   // used on OS X to tell the child the contents scale factor
   119   // of its parent has changed
   120   async ContentsScaleFactorChanged(double aContentsScaleFactor);
   122   // ********************** Async plugins rendering
   123   // see https://wiki.mozilla.org/Gecko:AsyncPluginPainting
   124   // **********************
   126   // Async version of SetWindow call
   127   // @param surfaceType - gfxASurface::gfxSurfaceType
   128   //        plugin child must create offscreen buffer
   129   //        with type equals to surfaceType
   130   async AsyncSetWindow(gfxSurfaceType surfaceType, NPRemoteWindow window);
   132   // There is now an opaque background behind this instance (or the
   133   // background was updated).  The changed area is |rect|.  The
   134   // browser owns the background surface, and it's read-only from
   135   // within the plugin process.  |background| is either null_t to
   136   // refer to the existing background or a fresh descriptor.
   137   async UpdateBackground(SurfaceDescriptor background, nsIntRect rect);
   139   async NPP_DidComposite();
   141   intr NPP_Destroy()
   142     returns (NPError rv);
   144 parent:
   145   intr NPN_GetValue_NPNVWindowNPObject()
   146     returns (nullable PPluginScriptableObject value, NPError result);
   147   intr NPN_GetValue_NPNVPluginElementNPObject()
   148     returns (nullable PPluginScriptableObject value, NPError result);
   149   intr NPN_GetValue_NPNVprivateModeBool()
   150     returns (bool value, NPError result);
   151   intr NPN_GetValue_NPNVnetscapeWindow()
   152     returns (NativeWindowHandle value, NPError result);
   153   intr NPN_GetValue_NPNVdocumentOrigin()
   154     returns (nsCString value, NPError result);
   155   intr NPN_GetValue_DrawingModelSupport(NPNVariable model)
   156     returns (bool value);
   158   intr NPN_SetValue_NPPVpluginWindow(bool windowed)
   159     returns (NPError result);
   160   intr NPN_SetValue_NPPVpluginTransparent(bool transparent)
   161     returns (NPError result);
   162   intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor)
   163     returns (NPError result);
   164   intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
   165     returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result);
   166   intr NPN_SetValue_NPPVpluginEventModel(int eventModel)
   167     returns (NPError result);
   169   intr NPN_GetURL(nsCString url, nsCString target)
   170     returns (NPError result);
   171   intr NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file)
   172     returns (NPError result);
   174   /**
   175    * Covers both NPN_GetURLNotify and NPN_PostURLNotify.
   176    * @TODO This would be more readable as an overloaded method,
   177    *       but IPDL doesn't allow that for constructors.
   178    */
   179   intr PStreamNotify(nsCString url, nsCString target, bool post,
   180                     nsCString buffer, bool file)
   181     returns (NPError result);
   183   async NPN_InvalidateRect(NPRect rect);
   185   // Give |newSurface|, containing this instance's updated pixels, to
   186   // the browser for compositing.  When this method returns, any surface 
   187   // previously passed to Show may be destroyed.
   188   //
   189   // @param rect - actually updated rectangle, comparing to prevSurface content
   190   //               could be used for partial render of layer to topLevel context
   191   // @param newSurface - remotable surface
   192   // @param prevSurface - if the previous surface was shared-memory, returns
   193   //                      the shmem for reuse
   194   sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
   195     returns (SurfaceDescriptor prevSurface);
   197   async PPluginSurface(WindowsSharedMemoryHandle handle,
   198                        gfxIntSize size,
   199                        bool transparent);
   201   intr NPN_PushPopupsEnabledState(bool aState);
   203   intr NPN_PopPopupsEnabledState();
   205   intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
   206     returns (nsCString value, NPError result);
   208   intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
   209                          nsCString value)
   210     returns (NPError result);
   212   intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
   213                                 int32_t port, nsCString scheme,
   214                                 nsCString realm)
   215     returns (nsCString username, nsCString password, NPError result);
   217   intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
   218                        NPCoordinateSpace destSpace)
   219     returns (double destX, double destY, bool result);
   221   async RedrawPlugin();
   223   intr NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format)
   224     returns (NPRemoteAsyncSurface surfData, bool result);
   226   // Send notification that a plugin tried to negotiate Carbon NPAPI so that
   227   // users can be notified that restarting the browser in i386 mode may allow
   228   // them to use the plugin.
   229   sync NegotiatedCarbon();
   231   // Notifies us we can release a Async Surface DXGI texture.
   232   async ReleaseDXGISharedSurface(DXGISharedSurfaceHandle handle);
   234 both:
   235   async PPluginScriptableObject();
   237 child:
   238   /* NPP_NewStream */
   239   intr PBrowserStream(nsCString url,
   240                      uint32_t length,
   241                      uint32_t lastmodified,
   242                      nullable PStreamNotify notifyData,
   243                      nsCString headers,
   244                      nsCString mimeType,
   245                      bool seekable)
   246     returns (NPError rv,
   247              uint16_t stype);
   249 parent:
   250   /* NPN_NewStream */
   251   intr PPluginStream(nsCString mimeType,
   252                     nsCString target)
   253     returns (NPError result);
   255 parent:
   256   intr PluginFocusChange(bool gotFocus);
   258 child:
   259   intr SetPluginFocus();
   260   intr UpdateWindow();
   262   async PPluginBackgroundDestroyer();
   263 };
   265 } // namespace plugins
   266 } // namespace mozilla

mercurial