1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is Mozilla Plugins.
17 * The Initial Developer of the Original Code is
18 * Chris Jones <jones.chris.g@gmail.com>.
19 * Portions created by the Initial Developer are Copyright (C) 2009
20 * the Initial Developer. All Rights Reserved.
23 * Benjamin Smedberg <benjamin@smedbergs.us>
24 * Ben Turner <bent.mozilla@gmail.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 include protocol PPluginBackgroundDestroyer;
41 include protocol PPluginModule;
42 include protocol PPluginScriptableObject;
43 include protocol PBrowserStream;
44 include protocol PPluginStream;
45 include protocol PStreamNotify;
46 include protocol PPluginSurface;
48 include "mozilla/plugins/PluginMessageUtils.h";
55 using NPCoordinateSpace;
56 using mozilla::plugins::NativeWindowHandle;
57 using mozilla::gfxSurfaceType;
59 using mozilla::null_t;
60 using mozilla::plugins::WindowsSharedMemoryHandle;
66 struct SurfaceDescriptorX11 {
72 union SurfaceDescriptor {
75 PPluginSurface; // used on Windows
76 // Descriptor can be null here in case
77 // 1) of first Show call (prevSurface is null)
78 // 2) when child is going to destroy
79 // and it just want to grab prevSurface
80 // back without giving new surface
84 rpc protocol PPluginInstance
86 manager PPluginModule;
88 manages PPluginBackgroundDestroyer;
89 manages PPluginScriptableObject;
90 manages PBrowserStream;
91 manages PPluginStream;
92 manages PStreamNotify;
93 manages PPluginSurface;
98 rpc NPP_SetWindow(NPRemoteWindow window);
100 // this message is not used on non-X platforms
101 rpc NPP_GetValue_NPPVpluginNeedsXEmbed()
102 returns (bool value, NPError result);
103 rpc NPP_GetValue_NPPVpluginScriptableNPObject()
104 returns (nullable PPluginScriptableObject value, NPError result);
106 rpc NPP_SetValue_NPNVprivateModeBool(bool value) returns (NPError result);
108 rpc NPP_HandleEvent(NPRemoteEvent event)
109 returns (int16_t handled);
110 // special cases where we need to a shared memory buffer
111 rpc NPP_HandleEvent_Shmem(NPRemoteEvent event, Shmem buffer)
112 returns (int16_t handled, Shmem rtnbuffer);
113 // special cases where we need an iosurface
114 rpc NPP_HandleEvent_IOSurface(NPRemoteEvent event, uint32_t surfaceid)
115 returns (int16_t handled);
116 // special cases of HandleEvent to make mediating races simpler
117 rpc Paint(NPRemoteEvent event)
118 returns (int16_t handled);
119 // this is only used on windows to forward WM_WINDOWPOSCHANGE
120 async WindowPosChanged(NPRemoteEvent event);
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);
140 returns (NPError rv);
143 rpc NPN_GetValue_NPNVjavascriptEnabledBool()
144 returns (bool value, NPError result);
145 rpc NPN_GetValue_NPNVisOfflineBool()
146 returns (bool value, NPError result);
147 rpc NPN_GetValue_NPNVWindowNPObject()
148 returns (nullable PPluginScriptableObject value, NPError result);
149 rpc NPN_GetValue_NPNVPluginElementNPObject()
150 returns (nullable PPluginScriptableObject value, NPError result);
151 rpc NPN_GetValue_NPNVprivateModeBool()
152 returns (bool value, NPError result);
153 rpc NPN_GetValue_NPNVnetscapeWindow()
154 returns (NativeWindowHandle value, NPError result);
156 rpc NPN_SetValue_NPPVpluginWindow(bool windowed)
157 returns (NPError result);
158 rpc NPN_SetValue_NPPVpluginTransparent(bool transparent)
159 returns (NPError result);
160 rpc NPN_SetValue_NPPVpluginDrawingModel(int drawingModel)
161 returns (NPError result);
162 rpc NPN_SetValue_NPPVpluginEventModel(int eventModel)
163 returns (NPError result);
165 rpc NPN_GetURL(nsCString url, nsCString target)
166 returns (NPError result);
167 rpc NPN_PostURL(nsCString url, nsCString target, nsCString buffer, bool file)
168 returns (NPError result);
171 * Covers both NPN_GetURLNotify and NPN_PostURLNotify.
172 * @TODO This would be more readable as an overloaded method,
173 * but IPDL doesn't allow that for constructors.
175 rpc PStreamNotify(nsCString url, nsCString target, bool post,
176 nsCString buffer, bool file)
177 returns (NPError result);
179 async NPN_InvalidateRect(NPRect rect);
181 // Give |newSurface|, containing this instance's updated pixels, to
182 // the browser for compositing. When this method returns, any surface
183 // previously passed to Show may be destroyed.
185 // @param rect - actually updated rectangle, comparing to prevSurface content
186 // could be used for partial render of layer to topLevel context
187 // @param newSurface - remotable surface
188 // @param prevSurface - if the previous surface was shared-memory, returns
189 // the shmem for reuse
190 sync Show(NPRect updatedRect, SurfaceDescriptor newSurface)
191 returns (SurfaceDescriptor prevSurface);
193 async PPluginSurface(WindowsSharedMemoryHandle handle,
197 rpc NPN_PushPopupsEnabledState(bool aState);
199 rpc NPN_PopPopupsEnabledState();
201 rpc NPN_GetValueForURL(NPNURLVariable variable, nsCString url)
202 returns (nsCString value, NPError result);
204 rpc NPN_SetValueForURL(NPNURLVariable variable, nsCString url,
206 returns (NPError result);
208 rpc NPN_GetAuthenticationInfo(nsCString protocol_, nsCString host,
209 int32_t port, nsCString scheme,
211 returns (nsCString username, nsCString password, NPError result);
213 rpc NPN_ConvertPoint(double sourceX, bool ignoreDestX, double sourceY, bool ignoreDestY, NPCoordinateSpace sourceSpace,
214 NPCoordinateSpace destSpace)
215 returns (double destX, double destY, bool result);
217 // Send notification that a plugin tried to negotiate Carbon NPAPI so that
218 // users can be notified that restarting the browser in i386 mode may allow
219 // them to use the plugin.
220 sync NegotiatedCarbon();
223 async PPluginScriptableObject();
227 rpc PBrowserStream(nsCString url,
229 uint32_t lastmodified,
230 nullable PStreamNotify notifyData,
239 rpc PPluginStream(nsCString mimeType,
241 returns (NPError result);
244 rpc PluginFocusChange(bool gotFocus);
247 rpc SetPluginFocus();
250 async PPluginBackgroundDestroyer();
253 } // namespace plugins
254 } // namespace mozilla