|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
|
2 * vim: sw=4 ts=4 et : |
|
3 * This Source Code Form is subject to the terms of the Mozilla Public |
|
4 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #ifndef mozilla_PluginLibrary_h |
|
8 #define mozilla_PluginLibrary_h 1 |
|
9 |
|
10 #include "prlink.h" |
|
11 #include "npapi.h" |
|
12 #include "npfunctions.h" |
|
13 #include "nscore.h" |
|
14 #include "nsTArray.h" |
|
15 #include "nsError.h" |
|
16 #include "mozilla/EventForwards.h" |
|
17 |
|
18 class gfxContext; |
|
19 class nsCString; |
|
20 struct nsIntRect; |
|
21 struct nsIntSize; |
|
22 class nsNPAPIPlugin; |
|
23 |
|
24 namespace mozilla { |
|
25 namespace layers { |
|
26 class Image; |
|
27 class ImageContainer; |
|
28 } |
|
29 } |
|
30 |
|
31 |
|
32 namespace mozilla { |
|
33 |
|
34 class PluginLibrary |
|
35 { |
|
36 public: |
|
37 virtual ~PluginLibrary() { } |
|
38 |
|
39 /** |
|
40 * Inform this library about the nsNPAPIPlugin which owns it. This |
|
41 * object will hold a weak pointer to the plugin. |
|
42 */ |
|
43 virtual void SetPlugin(nsNPAPIPlugin* plugin) = 0; |
|
44 |
|
45 virtual bool HasRequiredFunctions() = 0; |
|
46 |
|
47 #if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK) |
|
48 virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0; |
|
49 #else |
|
50 virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0; |
|
51 #endif |
|
52 virtual nsresult NP_Shutdown(NPError* error) = 0; |
|
53 virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0; |
|
54 virtual nsresult NP_GetValue(void *future, NPPVariable aVariable, |
|
55 void *aValue, NPError* error) = 0; |
|
56 #if defined(XP_WIN) || defined(XP_MACOSX) |
|
57 virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0; |
|
58 #endif |
|
59 virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance, |
|
60 uint16_t mode, int16_t argc, char* argn[], |
|
61 char* argv[], NPSavedData* saved, |
|
62 NPError* error) = 0; |
|
63 |
|
64 virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags, |
|
65 uint64_t maxAge) = 0; |
|
66 virtual nsresult NPP_GetSitesWithData(InfallibleTArray<nsCString>& aResult) = 0; |
|
67 |
|
68 virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0; |
|
69 virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer) = 0; |
|
70 virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0; |
|
71 virtual bool IsOOP() = 0; |
|
72 #if defined(XP_MACOSX) |
|
73 virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0; |
|
74 virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0; |
|
75 #endif |
|
76 |
|
77 /** |
|
78 * The next three methods are the third leg in the trip to |
|
79 * PluginInstanceParent. They approximately follow the ReadbackSink |
|
80 * API. |
|
81 */ |
|
82 virtual nsresult SetBackgroundUnknown(NPP instance) = 0; |
|
83 virtual nsresult BeginUpdateBackground(NPP instance, |
|
84 const nsIntRect&, gfxContext**) = 0; |
|
85 virtual nsresult EndUpdateBackground(NPP instance, |
|
86 gfxContext*, const nsIntRect&) = 0; |
|
87 }; |
|
88 |
|
89 |
|
90 } // namespace mozilla |
|
91 |
|
92 #endif // ifndef mozilla_PluginLibrary_h |