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