1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/PPluginInstance.ipdl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,266 @@ 1.4 +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +include protocol PPluginBackgroundDestroyer; 1.10 +include protocol PPluginModule; 1.11 +include protocol PPluginScriptableObject; 1.12 +include protocol PBrowserStream; 1.13 +include protocol PPluginStream; 1.14 +include protocol PStreamNotify; 1.15 +include protocol PPluginSurface; 1.16 + 1.17 +include "mozilla/GfxMessageUtils.h"; 1.18 + 1.19 +using NPError from "npapi.h"; 1.20 +using struct mozilla::plugins::NPRemoteWindow from "mozilla/plugins/PluginMessageUtils.h"; 1.21 +using struct mozilla::plugins::NPRemoteEvent from "mozilla/plugins/PluginMessageUtils.h"; 1.22 +using NPRect from "npapi.h"; 1.23 +using NPImageFormat from "npapi.h"; 1.24 +using NPNURLVariable from "npapi.h"; 1.25 +using NPCoordinateSpace from "npapi.h"; 1.26 +using NPNVariable from "npapi.h"; 1.27 +using mozilla::plugins::NativeWindowHandle from "mozilla/plugins/PluginMessageUtils.h"; 1.28 +using gfxSurfaceType from "gfxTypes.h"; 1.29 +using gfxIntSize from "nsSize.h"; 1.30 +using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; 1.31 +using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h"; 1.32 +using mozilla::plugins::DXGISharedSurfaceHandle from "mozilla/plugins/PluginMessageUtils.h"; 1.33 +using mozilla::CrossProcessMutexHandle from "mozilla/ipc/CrossProcessMutex.h"; 1.34 +using struct SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h"; 1.35 +using struct nsIntRect from "nsRect.h"; 1.36 + 1.37 +namespace mozilla { 1.38 +namespace plugins { 1.39 + 1.40 +struct IOSurfaceDescriptor { 1.41 + uint32_t surfaceId; 1.42 + double contentsScaleFactor; 1.43 +}; 1.44 + 1.45 +union SurfaceDescriptor { 1.46 + Shmem; 1.47 + SurfaceDescriptorX11; 1.48 + PPluginSurface; // used on Windows 1.49 + IOSurfaceDescriptor; // used on OSX 10.5+ 1.50 + // Descriptor can be null here in case 1.51 + // 1) of first Show call (prevSurface is null) 1.52 + // 2) when child is going to destroy 1.53 + // and it just want to grab prevSurface 1.54 + // back without giving new surface 1.55 + null_t; 1.56 +}; 1.57 + 1.58 +union OptionalShmem { 1.59 + Shmem; 1.60 + null_t; 1.61 +}; 1.62 + 1.63 +union AsyncSurfaceDescriptor { 1.64 + Shmem; 1.65 + DXGISharedSurfaceHandle; 1.66 +}; 1.67 + 1.68 +struct NPRemoteAsyncSurface 1.69 +{ 1.70 + uint32_t version; 1.71 + gfxIntSize size; 1.72 + NPImageFormat format; 1.73 + uint32_t stride; 1.74 + AsyncSurfaceDescriptor data; 1.75 + uintptr_t hostPtr; 1.76 +}; 1.77 + 1.78 +intr protocol PPluginInstance 1.79 +{ 1.80 + manager PPluginModule; 1.81 + 1.82 + manages PPluginBackgroundDestroyer; 1.83 + manages PPluginScriptableObject; 1.84 + manages PBrowserStream; 1.85 + manages PPluginStream; 1.86 + manages PStreamNotify; 1.87 + manages PPluginSurface; 1.88 + 1.89 +child: 1.90 + intr __delete__(); 1.91 + 1.92 + intr NPP_SetWindow(NPRemoteWindow window); 1.93 + 1.94 + intr NPP_GetValue_NPPVpluginWantsAllNetworkStreams() 1.95 + returns (bool value, NPError result); 1.96 + 1.97 + // this message is not used on non-X platforms 1.98 + intr NPP_GetValue_NPPVpluginNeedsXEmbed() 1.99 + returns (bool value, NPError result); 1.100 + 1.101 + intr NPP_GetValue_NPPVpluginScriptableNPObject() 1.102 + returns (nullable PPluginScriptableObject value, NPError result); 1.103 + 1.104 + intr NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result); 1.105 + intr NPP_GetValue_NPPVpluginNativeAccessibleAtkPlugId() 1.106 + returns (nsCString plug_id, NPError result); 1.107 + 1.108 + intr NPP_HandleEvent(NPRemoteEvent event) 1.109 + returns (int16_t handled); 1.110 + // special cases where we need to a shared memory buffer 1.111 + intr NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer) 1.112 + returns (int16_t handled, Shmem rtnbuffer); 1.113 + // special cases where we need an iosurface 1.114 + intr NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid) 1.115 + returns (int16_t handled); 1.116 + // special cases of HandleEvent to make mediating races simpler 1.117 + intr Paint(NPRemoteEvent event) 1.118 + returns (int16_t handled); 1.119 + // this is only used on windows to forward WM_WINDOWPOSCHANGE 1.120 + async WindowPosChanged(NPRemoteEvent event); 1.121 + // used on OS X to tell the child the contents scale factor 1.122 + // of its parent has changed 1.123 + async ContentsScaleFactorChanged(double aContentsScaleFactor); 1.124 + 1.125 + // ********************** Async plugins rendering 1.126 + // see https://wiki.mozilla.org/Gecko:AsyncPluginPainting 1.127 + // ********************** 1.128 + 1.129 + // Async version of SetWindow call 1.130 + // @param surfaceType - gfxASurface::gfxSurfaceType 1.131 + // plugin child must create offscreen buffer 1.132 + // with type equals to surfaceType 1.133 + async AsyncSetWindow(gfxSurfaceType surfaceType, NPRemoteWindow window); 1.134 + 1.135 + // There is now an opaque background behind this instance (or the 1.136 + // background was updated). The changed area is |rect|. The 1.137 + // browser owns the background surface, and it's read-only from 1.138 + // within the plugin process. |background| is either null_t to 1.139 + // refer to the existing background or a fresh descriptor. 1.140 + async UpdateBackground(SurfaceDescriptor background, nsIntRect rect); 1.141 + 1.142 + async NPP_DidComposite(); 1.143 + 1.144 + intr NPP_Destroy() 1.145 + returns (NPError rv); 1.146 + 1.147 +parent: 1.148 + intr NPN_GetValue_NPNVWindowNPObject() 1.149 + returns (nullable PPluginScriptableObject value, NPError result); 1.150 + intr NPN_GetValue_NPNVPluginElementNPObject() 1.151 + returns (nullable PPluginScriptableObject value, NPError result); 1.152 + intr NPN_GetValue_NPNVprivateModeBool() 1.153 + returns (bool value, NPError result); 1.154 + intr NPN_GetValue_NPNVnetscapeWindow() 1.155 + returns (NativeWindowHandle value, NPError result); 1.156 + intr NPN_GetValue_NPNVdocumentOrigin() 1.157 + returns (nsCString value, NPError result); 1.158 + intr NPN_GetValue_DrawingModelSupport(NPNVariable model) 1.159 + returns (bool value); 1.160 + 1.161 + intr NPN_SetValue_NPPVpluginWindow(bool windowed) 1.162 + returns (NPError result); 1.163 + intr NPN_SetValue_NPPVpluginTransparent(bool transparent) 1.164 + returns (NPError result); 1.165 + intr NPN_SetValue_NPPVpluginUsesDOMForCursor(bool useDOMForCursor) 1.166 + returns (NPError result); 1.167 + intr NPN_SetValue_NPPVpluginDrawingModel(int drawingModel) 1.168 + returns (OptionalShmem remoteImageData, CrossProcessMutexHandle mutex, NPError result); 1.169 + intr NPN_SetValue_NPPVpluginEventModel(int eventModel) 1.170 + returns (NPError result); 1.171 + 1.172 + intr NPN_GetURL(nsCString url, nsCString target) 1.173 + returns (NPError result); 1.174 + intr NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file) 1.175 + returns (NPError result); 1.176 + 1.177 + /** 1.178 + * Covers both NPN_GetURLNotify and NPN_PostURLNotify. 1.179 + * @TODO This would be more readable as an overloaded method, 1.180 + * but IPDL doesn't allow that for constructors. 1.181 + */ 1.182 + intr PStreamNotify(nsCString url, nsCString target, bool post, 1.183 + nsCString buffer, bool file) 1.184 + returns (NPError result); 1.185 + 1.186 + async NPN_InvalidateRect(NPRect rect); 1.187 + 1.188 + // Give |newSurface|, containing this instance's updated pixels, to 1.189 + // the browser for compositing. When this method returns, any surface 1.190 + // previously passed to Show may be destroyed. 1.191 + // 1.192 + // @param rect - actually updated rectangle, comparing to prevSurface content 1.193 + // could be used for partial render of layer to topLevel context 1.194 + // @param newSurface - remotable surface 1.195 + // @param prevSurface - if the previous surface was shared-memory, returns 1.196 + // the shmem for reuse 1.197 + sync Show(NPRect updatedRect, SurfaceDescriptor newSurface) 1.198 + returns (SurfaceDescriptor prevSurface); 1.199 + 1.200 + async PPluginSurface(WindowsSharedMemoryHandle handle, 1.201 + gfxIntSize size, 1.202 + bool transparent); 1.203 + 1.204 + intr NPN_PushPopupsEnabledState(bool aState); 1.205 + 1.206 + intr NPN_PopPopupsEnabledState(); 1.207 + 1.208 + intr NPN_GetValueForURL(NPNURLVariable variable, nsCString url) 1.209 + returns (nsCString value, NPError result); 1.210 + 1.211 + intr NPN_SetValueForURL(NPNURLVariable variable, nsCString url, 1.212 + nsCString value) 1.213 + returns (NPError result); 1.214 + 1.215 + intr NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host, 1.216 + int32_t port, nsCString scheme, 1.217 + nsCString realm) 1.218 + returns (nsCString username, nsCString password, NPError result); 1.219 + 1.220 + intr NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace, 1.221 + NPCoordinateSpace destSpace) 1.222 + returns (double destX, double destY, bool result); 1.223 + 1.224 + async RedrawPlugin(); 1.225 + 1.226 + intr NPN_InitAsyncSurface(gfxIntSize size, NPImageFormat format) 1.227 + returns (NPRemoteAsyncSurface surfData, bool result); 1.228 + 1.229 + // Send notification that a plugin tried to negotiate Carbon NPAPI so that 1.230 + // users can be notified that restarting the browser in i386 mode may allow 1.231 + // them to use the plugin. 1.232 + sync NegotiatedCarbon(); 1.233 + 1.234 + // Notifies us we can release a Async Surface DXGI texture. 1.235 + async ReleaseDXGISharedSurface(DXGISharedSurfaceHandle handle); 1.236 + 1.237 +both: 1.238 + async PPluginScriptableObject(); 1.239 + 1.240 +child: 1.241 + /* NPP_NewStream */ 1.242 + intr PBrowserStream(nsCString url, 1.243 + uint32_t length, 1.244 + uint32_t lastmodified, 1.245 + nullable PStreamNotify notifyData, 1.246 + nsCString headers, 1.247 + nsCString mimeType, 1.248 + bool seekable) 1.249 + returns (NPError rv, 1.250 + uint16_t stype); 1.251 + 1.252 +parent: 1.253 + /* NPN_NewStream */ 1.254 + intr PPluginStream(nsCString mimeType, 1.255 + nsCString target) 1.256 + returns (NPError result); 1.257 + 1.258 +parent: 1.259 + intr PluginFocusChange(bool gotFocus); 1.260 + 1.261 +child: 1.262 + intr SetPluginFocus(); 1.263 + intr UpdateWindow(); 1.264 + 1.265 + async PPluginBackgroundDestroyer(); 1.266 +}; 1.267 + 1.268 +} // namespace plugins 1.269 +} // namespace mozilla