|
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #include "nsISupports.idl" |
|
7 #include "nspluginroot.idl" |
|
8 #include "nsIInputStream.idl" |
|
9 |
|
10 interface nsIDocument; |
|
11 |
|
12 %{C++ |
|
13 #include "npapi.h" |
|
14 #include "mozilla/EventForwards.h" |
|
15 class nsNPAPIPluginInstance; |
|
16 |
|
17 enum nsPluginTagType { |
|
18 nsPluginTagType_Unknown, |
|
19 nsPluginTagType_Embed, |
|
20 nsPluginTagType_Object, |
|
21 nsPluginTagType_Applet |
|
22 }; |
|
23 %} |
|
24 |
|
25 [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance); |
|
26 |
|
27 // Do not make this interface scriptable, because the virtual functions in C++ |
|
28 // blocks will make script call the wrong functions. |
|
29 [uuid(59BE4CA5-3CB0-40E6-A111-9A88C8477610)] |
|
30 interface nsIPluginInstanceOwner : nsISupports |
|
31 { |
|
32 /** |
|
33 * Let the owner know what its instance is |
|
34 */ |
|
35 void setInstance(in nsNPAPIPluginInstancePtr aInstance); |
|
36 |
|
37 /** |
|
38 * Get the instance associated with this owner. |
|
39 */ |
|
40 nsNPAPIPluginInstancePtr getInstance(); |
|
41 |
|
42 /** |
|
43 * Get a handle to the window structure of the owner. |
|
44 * This pointer cannot be made persistent by the caller. |
|
45 */ |
|
46 void getWindow(in NPWindowStarRef aWindow); |
|
47 |
|
48 /** |
|
49 * Get the display mode for the plugin instance. |
|
50 */ |
|
51 readonly attribute int32_t mode; |
|
52 |
|
53 /** |
|
54 * Create a place for the plugin to live in the owner's |
|
55 * environment. this may or may not create a window |
|
56 * depending on the windowless state of the plugin instance. |
|
57 */ |
|
58 void createWidget(); |
|
59 |
|
60 %{C++ |
|
61 /** |
|
62 * Called when there is a valid target so that the proper |
|
63 * frame can be updated with new content. will not be called |
|
64 * with nullptr aTarget. |
|
65 */ |
|
66 NS_IMETHOD |
|
67 GetURL(const char *aURL, const char *aTarget, |
|
68 nsIInputStream *aPostStream, |
|
69 void *aHeadersData, uint32_t aHeadersDataLen) = 0; |
|
70 %} |
|
71 |
|
72 /** |
|
73 * Show a status message in the host environment. |
|
74 */ |
|
75 void showStatus(in string aStatusMsg); |
|
76 |
|
77 %{C++ |
|
78 NS_IMETHOD ShowStatus(const char16_t *aStatusMsg) = 0; |
|
79 %} |
|
80 |
|
81 /** |
|
82 * Get the associated document. |
|
83 */ |
|
84 readonly attribute nsIDocument document; |
|
85 |
|
86 /** |
|
87 * Invalidate the rectangle |
|
88 */ |
|
89 void invalidateRect(in NPRectPtr aRect); |
|
90 |
|
91 /** |
|
92 * Invalidate the region |
|
93 */ |
|
94 void invalidateRegion(in NPRegion aRegion); |
|
95 |
|
96 /** |
|
97 * Have the plugin recomposited. |
|
98 */ |
|
99 void redrawPlugin(); |
|
100 |
|
101 /** |
|
102 * Get NetscapeWindow, corresponds to NPNVnetscapeWindow |
|
103 */ |
|
104 void getNetscapeWindow(in voidPtr aValue); |
|
105 |
|
106 /** |
|
107 * Show native context menu |
|
108 */ |
|
109 %{C++ |
|
110 virtual NPError ShowNativeContextMenu(NPMenu* menu, void* event) = 0; |
|
111 virtual NPBool ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace, |
|
112 double *destX, double *destY, NPCoordinateSpace destSpace) = 0; |
|
113 virtual NPError InitAsyncSurface(NPSize *size, NPImageFormat format, |
|
114 void *initData, NPAsyncSurface *surface) = 0; |
|
115 virtual NPError FinalizeAsyncSurface(NPAsyncSurface *surface) = 0; |
|
116 virtual void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) = 0; |
|
117 %} |
|
118 |
|
119 void setEventModel(in int32_t eventModel); |
|
120 |
|
121 /** |
|
122 * Call NPP_SetWindow on the plugin. |
|
123 */ |
|
124 void callSetWindow(); |
|
125 |
|
126 /** |
|
127 * Get the contents scale factor for the screen the plugin is |
|
128 * drawn on. |
|
129 */ |
|
130 double getContentsScaleFactor(); |
|
131 }; |