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