Line data Source code
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 : #include "nsSize.h"
18 : #include "nsRect.h"
19 :
20 : class nsCString;
21 : class nsNPAPIPlugin;
22 :
23 : namespace mozilla {
24 : namespace gfx {
25 : class DrawTarget;
26 : }
27 : namespace layers {
28 : class Image;
29 : class ImageContainer;
30 : } // namespace layers
31 : } // namespace mozilla
32 :
33 : class nsIClearSiteDataCallback;
34 :
35 : #define nsIGetSitesWithDataCallback_CID {0xd0028b83, 0xfdf9, 0x4c53, {0xb7, 0xbb, 0x47, 0x46, 0x0f, 0x6b, 0x83, 0x6c}}
36 0 : class nsIGetSitesWithDataCallback : public nsISupports {
37 : public:
38 : NS_IMETHOD SitesWithData(InfallibleTArray<nsCString>& result) = 0;
39 : NS_DECLARE_STATIC_IID_ACCESSOR(nsIGetSitesWithDataCallback_CID)
40 : };
41 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIGetSitesWithDataCallback, nsIGetSitesWithDataCallback_CID)
42 :
43 : namespace mozilla {
44 :
45 0 : class PluginLibrary
46 : {
47 : public:
48 : typedef mozilla::gfx::DrawTarget DrawTarget;
49 :
50 0 : virtual ~PluginLibrary() { }
51 :
52 : /**
53 : * Inform this library about the nsNPAPIPlugin which owns it. This
54 : * object will hold a weak pointer to the plugin.
55 : */
56 : virtual void SetPlugin(nsNPAPIPlugin* plugin) = 0;
57 :
58 : virtual bool HasRequiredFunctions() = 0;
59 :
60 : #if defined(XP_UNIX) && !defined(XP_MACOSX) && !defined(MOZ_WIDGET_GONK)
61 : virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs, NPError* error) = 0;
62 : #else
63 : virtual nsresult NP_Initialize(NPNetscapeFuncs* bFuncs, NPError* error) = 0;
64 : #endif
65 : virtual nsresult NP_Shutdown(NPError* error) = 0;
66 : virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
67 : virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
68 : void *aValue, NPError* error) = 0;
69 : #if defined(XP_WIN) || defined(XP_MACOSX)
70 : virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
71 : #endif
72 : virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
73 : int16_t argc, char* argn[],
74 : char* argv[], NPSavedData* saved,
75 : NPError* error) = 0;
76 :
77 : virtual nsresult NPP_ClearSiteData(const char* site, uint64_t flags,
78 : uint64_t maxAge, nsCOMPtr<nsIClearSiteDataCallback> callback) = 0;
79 : virtual nsresult NPP_GetSitesWithData(nsCOMPtr<nsIGetSitesWithDataCallback> callback) = 0;
80 :
81 : virtual nsresult AsyncSetWindow(NPP instance, NPWindow* window) = 0;
82 : virtual nsresult GetImageContainer(NPP instance, mozilla::layers::ImageContainer** aContainer) = 0;
83 : virtual nsresult GetImageSize(NPP instance, nsIntSize* aSize) = 0;
84 : virtual void DidComposite(NPP instance) = 0;
85 : virtual bool IsOOP() = 0;
86 : #if defined(XP_MACOSX)
87 : virtual nsresult IsRemoteDrawingCoreAnimation(NPP instance, bool *aDrawing) = 0;
88 : #endif
89 : #if defined(XP_MACOSX) || defined(XP_WIN)
90 : virtual nsresult ContentsScaleFactorChanged(NPP instance, double aContentsScaleFactor) = 0;
91 : #endif
92 : #if defined(XP_WIN)
93 : virtual nsresult GetScrollCaptureContainer(NPP aInstance, mozilla::layers::ImageContainer** aContainer) = 0;
94 : #endif
95 : virtual nsresult HandledWindowedPluginKeyEvent(
96 : NPP aInstance,
97 : const mozilla::NativeEventData& aNativeKeyData,
98 : bool aIsCOnsumed) = 0;
99 :
100 : /**
101 : * The next three methods are the third leg in the trip to
102 : * PluginInstanceParent. They approximately follow the ReadbackSink
103 : * API.
104 : */
105 : virtual nsresult SetBackgroundUnknown(NPP instance) = 0;
106 : virtual nsresult BeginUpdateBackground(NPP instance,
107 : const nsIntRect&, DrawTarget**) = 0;
108 : virtual nsresult EndUpdateBackground(NPP instance, const nsIntRect&) = 0;
109 : virtual nsresult GetRunID(uint32_t* aRunID) = 0;
110 : virtual void SetHasLocalInstance() = 0;
111 : };
112 :
113 : } // namespace mozilla
114 :
115 : #endif // ifndef mozilla_PluginLibrary_h
|