1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 : * vim: sw=4 ts=4 et :
3 : * ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is Mozilla Foundation.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Josh Aas <josh@mozilla.com>
20 : * Portions created by the Initial Developer are Copyright (C) 2009
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : *
25 : * Alternatively, the contents of this file may be used under the terms of
26 : * either the GNU General Public License Version 2 or later (the "GPL"), or
27 : * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 : * in which case the provisions of the GPL or the LGPL are applicable instead
29 : * of those above. If you wish to allow use of your version of this file only
30 : * under the terms of either the GPL or the LGPL, and not to allow others to
31 : * use your version of this file under the terms of the MPL, indicate your
32 : * decision by deleting the provisions above and replace them with the notice
33 : * and other provisions required by the GPL or the LGPL. If you do not delete
34 : * the provisions above, a recipient may use your version of this file under
35 : * the terms of any one of the MPL, the GPL or the LGPL.
36 : *
37 : * ***** END LICENSE BLOCK ***** */
38 :
39 : #ifndef mozilla_PluginLibrary_h
40 : #define mozilla_PluginLibrary_h 1
41 :
42 : #include "prlink.h"
43 : #include "npapi.h"
44 : #include "npfunctions.h"
45 : #include "nscore.h"
46 : #include "nsTArray.h"
47 : #include "nsPluginError.h"
48 :
49 : class gfxASurface;
50 : class gfxContext;
51 : class nsCString;
52 : struct nsIntRect;
53 : struct nsIntSize;
54 : class nsNPAPIPlugin;
55 : class nsGUIEvent;
56 :
57 : namespace mozilla {
58 : namespace layers {
59 : class Image;
60 : class ImageContainer;
61 : }
62 : }
63 :
64 : using namespace mozilla::layers;
65 :
66 : namespace mozilla {
67 :
68 : class PluginLibrary
69 0 : {
70 : public:
71 0 : virtual ~PluginLibrary() { }
72 :
73 : /**
74 : * Inform this library about the nsNPAPIPlugin which owns it. This
75 : * object will hold a weak pointer to the plugin.
76 : */
77 : virtual void SetPlugin(nsNPAPIPlugin* plugin) = 0;
78 :
79 : virtual bool HasRequiredFunctions() = 0;
80 :
81 : #if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
82 : virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
83 : #else
84 : virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;
85 : #endif
86 : virtual nsresult NP_Shutdown(NPError* error) = 0;
87 : virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
88 : virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
89 : void *aValue, NPError* error) = 0;
90 : #if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
91 : virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
92 : #endif
93 : virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
94 : uint16_t mode, int16_t argc, char* argn[],
95 : char* argv[], NPSavedData* saved,
96 : NPError* error) = 0;
97 :
98 : virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
99 : uint64_t maxAge) = 0;
100 : virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& aResult) = 0;
101 :
102 : virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
103 : virtual nsresult GetImageContainer(NPP instance, ImageContainer** aContainer) = 0;
104 : virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
105 : virtual bool UseAsyncPainting() = 0;
106 : #if defined(XP_MACOSX)
107 : virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
108 : #endif
109 :
110 : /**
111 : * The next three methods are the third leg in the trip to
112 : * PluginInstanceParent. They approximately follow the ReadbackSink
113 : * API.
114 : */
115 : virtual nsresult SetBackgroundUnknown(NPP instance) = 0;
116 : virtual nsresult BeginUpdateBackground(NPP instance,
117 : const nsIntRect&, gfxContext**) = 0;
118 : virtual nsresult EndUpdateBackground(NPP instance,
119 : gfxContext*, const nsIntRect&) = 0;
120 : #if defined(MOZ_WIDGET_QT) && (MOZ_PLATFORM_MAEMO == 6)
121 : virtual nsresult HandleGUIEvent(NPP instance, const nsGUIEvent&, bool*) = 0;
122 : #endif
123 : };
124 :
125 :
126 : } // namespace mozilla
127 :
128 : #endif // ifndef mozilla_PluginLibrary_h
|