michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: include protocol PPluginBackgroundDestroyer; michael@0: include protocol PPluginModule; michael@0: include protocol PPluginScriptableObject; michael@0: include protocol PBrowserStream; michael@0: include protocol PPluginStream; michael@0: include protocol PStreamNotify; michael@0: include protocol PPluginSurface; michael@0: michael@0: include "mozilla/GfxMessageUtils.h"; michael@0: michael@0: using NPError from "npapi.h"; michael@0: using struct mozilla::plugins::NPRemoteWindow from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using struct mozilla::plugins::NPRemoteEvent from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using NPRect from "npapi.h"; michael@0: using NPImageFormat from "npapi.h"; michael@0: using NPNURLVariable from "npapi.h"; michael@0: using NPCoordinateSpace from "npapi.h"; michael@0: using NPNVariable from "npapi.h"; michael@0: using mozilla::plugins::NativeWindowHandle from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using gfxSurfaceType from "gfxTypes.h"; michael@0: using gfxIntSize from "nsSize.h"; michael@0: using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; michael@0: using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using mozilla::plugins::DXGISharedSurfaceHandle from "mozilla/plugins/PluginMessageUtils.h"; michael@0: using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h"; michael@0: using struct SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h"; michael@0: using struct nsIntRect from "nsRect.h"; michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: struct IOSurfaceDescriptor { michael@0: uint32_t surfaceId; michael@0: double contentsScaleFactor; michael@0: }; michael@0: michael@0: union SurfaceDescriptor { michael@0: Shmem; michael@0: SurfaceDescriptorX11; michael@0: PPluginSurface; // used on Windows michael@0: IOSurfaceDescriptor; // used on OSX 10.5+ michael@0: // Descriptor can be null here in case michael@0: // 1) of first Show call (prevSurface is null) michael@0: // 2) when child is going to destroy michael@0: // and it just want to grab prevSurface michael@0: // back without giving new surface michael@0: null_t; michael@0: }; michael@0: michael@0: union OptionalShmem { michael@0: Shmem; michael@0: null_t; michael@0: }; michael@0: michael@0: union AsyncSurfaceDescriptor { michael@0: Shmem; michael@0: DXGISharedSurfaceHandle; michael@0: }; michael@0: michael@0: struct NPRemoteAsyncSurface michael@0: { michael@0: uint32_t version; michael@0: gfxIntSize size; michael@0: NPImageFormat format; michael@0: uint32_t stride; michael@0: AsyncSurfaceDescriptor data; michael@0: uintptr_t hostPtr; michael@0: }; michael@0: michael@0: intr protocol PPluginInstance michael@0: { michael@0: manager PPluginModule; michael@0: michael@0: manages PPluginBackgroundDestroyer; michael@0: manages PPluginScriptableObject; michael@0: manages PBrowserStream; michael@0: manages PPluginStream; michael@0: manages PStreamNotify; michael@0: manages PPluginSurface; michael@0: michael@0: child: michael@0: intr __delete__(); michael@0: michael@0: intr NPP_SetWindow(NPRemoteWindow window); michael@0: michael@0: intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams() michael@0: returns (bool value, NPError result); michael@0: michael@0: // this message is not used on non-X platforms michael@0: intr NPP_GetValue_NPPVpluginNeedsXEmbed() michael@0: returns (bool value, NPError result); michael@0: michael@0: intr NPP_GetValue_NPPVpluginScriptableNPObject() michael@0: returns (nullable PPluginScriptableObject value, NPError result); michael@0: michael@0: intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result); michael@0: intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId() michael@0: returns (nsCString plug_id, NPError result); michael@0: michael@0: intr NPP_HandleEvent(NPRemoteEvent event) michael@0: returns (int16_t handled); michael@0: // special cases where we need to a shared memory buffer michael@0: intr NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer) michael@0: returns (int16_t handled, Shmem rtnbuffer); michael@0: // special cases where we need an iosurface michael@0: intr NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid) michael@0: returns (int16_t handled); michael@0: // special cases of HandleEvent to make mediating races simpler michael@0: intr Paint(NPRemoteEvent event) michael@0: returns (int16_t handled); michael@0: // this is only used on windows to forward WM_WINDOWPOSCHANGE michael@0: async WindowPosChanged(NPRemoteEvent event); michael@0: // used on OS X to tell the child the contents scale factor michael@0: // of its parent has changed michael@0: async ContentsScaleFactorChanged(double aContentsScaleFactor); michael@0: michael@0: // ********************** Async plugins rendering michael@0: // see https://wiki.mozilla.org/Gecko:AsyncPluginPainting michael@0: // ********************** michael@0: michael@0: // Async version of SetWindow call michael@0: // @param surfaceType - gfxASurface::gfxSurfaceType michael@0: // plugin child must create offscreen buffer michael@0: // with type equals to surfaceType michael@0: async AsyncSetWindow(gfxSurfaceType surfaceType, NPRemoteWindow window); michael@0: michael@0: // There is now an opaque background behind this instance (or the michael@0: // background was updated). The changed area is |rect|. The michael@0: // browser owns the background surface, and it's read-only from michael@0: // within the plugin process. |background| is either null_t to michael@0: // refer to the existing background or a fresh descriptor. michael@0: async UpdateBackground(SurfaceDescriptor background, nsIntRect rect); michael@0: michael@0: async NPP_DidComposite(); michael@0: michael@0: intr NPP_Destroy() michael@0: returns (NPError rv); michael@0: michael@0: parent: michael@0: intr NPN_GetValue_NPNVWindowNPObject() michael@0: returns (nullable PPluginScriptableObject value, NPError result); michael@0: intr NPN_GetValue_NPNVPluginElementNPObject() michael@0: returns (nullable PPluginScriptableObject value, NPError result); michael@0: intr NPN_GetValue_NPNVprivateModeBool() michael@0: returns (bool value, NPError result); michael@0: intr NPN_GetValue_NPNVnetscapeWindow() michael@0: returns (NativeWindowHandle value, NPError result); michael@0: intr NPN_GetValue_NPNVdocumentOrigin() michael@0: returns (nsCString value, NPError result); michael@0: intr NPN_GetValue_DrawingModelSupport(NPNVariable model) michael@0: returns (bool value); michael@0: michael@0: intr NPN_SetValue_NPPVpluginWindow(bool windowed) michael@0: returns (NPError result); michael@0: intr NPN_SetValue_NPPVpluginTransparent(bool transparent) michael@0: returns (NPError result); michael@0: intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor) michael@0: returns (NPError result); michael@0: intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel) michael@0: returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result); michael@0: intr NPN_SetValue_NPPVpluginEventModel(int eventModel) michael@0: returns (NPError result); michael@0: michael@0: intr NPN_GetURL(nsCString url, nsCString target) michael@0: returns (NPError result); michael@0: intr NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file) michael@0: returns (NPError result); michael@0: michael@0: /** michael@0: * Covers both NPN_GetURLNotify and NPN_PostURLNotify. michael@0: * @TODO This would be more readable as an overloaded method, michael@0: * but IPDL doesn't allow that for constructors. michael@0: */ michael@0: intr PStreamNotify(nsCString url, nsCString target, bool post, michael@0: nsCString buffer, bool file) michael@0: returns (NPError result); michael@0: michael@0: async NPN_InvalidateRect(NPRect rect); michael@0: michael@0: // Give |newSurface|, containing this instance's updated pixels, to michael@0: // the browser for compositing. When this method returns, any surface michael@0: // previously passed to Show may be destroyed. michael@0: // michael@0: // @param rect - actually updated rectangle, comparing to prevSurface content michael@0: // could be used for partial render of layer to topLevel context michael@0: // @param newSurface - remotable surface michael@0: // @param prevSurface - if the previous surface was shared-memory, returns michael@0: // the shmem for reuse michael@0: sync Show(NPRect updatedRect, SurfaceDescriptor newSurface) michael@0: returns (SurfaceDescriptor prevSurface); michael@0: michael@0: async PPluginSurface(WindowsSharedMemoryHandle handle, michael@0: gfxIntSize size, michael@0: bool transparent); michael@0: michael@0: intr NPN_PushPopupsEnabledState(bool aState); michael@0: michael@0: intr NPN_PopPopupsEnabledState(); michael@0: michael@0: intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url) michael@0: returns (nsCString value, NPError result); michael@0: michael@0: intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url, michael@0: nsCString value) michael@0: returns (NPError result); michael@0: michael@0: intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host, michael@0: int32_t port, nsCString scheme, michael@0: nsCString realm) michael@0: returns (nsCString username, nsCString password, NPError result); michael@0: michael@0: intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace, michael@0: NPCoordinateSpace destSpace) michael@0: returns (double destX, double destY, bool result); michael@0: michael@0: async RedrawPlugin(); michael@0: michael@0: intr NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format) michael@0: returns (NPRemoteAsyncSurface surfData, bool result); michael@0: michael@0: // Send notification that a plugin tried to negotiate Carbon NPAPI so that michael@0: // users can be notified that restarting the browser in i386 mode may allow michael@0: // them to use the plugin. michael@0: sync NegotiatedCarbon(); michael@0: michael@0: // Notifies us we can release a Async Surface DXGI texture. michael@0: async ReleaseDXGISharedSurface(DXGISharedSurfaceHandle handle); michael@0: michael@0: both: michael@0: async PPluginScriptableObject(); michael@0: michael@0: child: michael@0: /* NPP_NewStream */ michael@0: intr PBrowserStream(nsCString url, michael@0: uint32_t length, michael@0: uint32_t lastmodified, michael@0: nullable PStreamNotify notifyData, michael@0: nsCString headers, michael@0: nsCString mimeType, michael@0: bool seekable) michael@0: returns (NPError rv, michael@0: uint16_t stype); michael@0: michael@0: parent: michael@0: /* NPN_NewStream */ michael@0: intr PPluginStream(nsCString mimeType, michael@0: nsCString target) michael@0: returns (NPError result); michael@0: michael@0: parent: michael@0: intr PluginFocusChange(bool gotFocus); michael@0: michael@0: child: michael@0: intr SetPluginFocus(); michael@0: intr UpdateWindow(); michael@0: michael@0: async PPluginBackgroundDestroyer(); michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla