Back to index

lightning-sunbird  0.9+nobinonly
nsPluginInstancePeer.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 1998
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #ifndef nsPluginInstancePeer_h___
00039 #define nsPluginInstancePeer_h___
00040 
00041 #include "nsIPluginInstancePeer2.h"
00042 #include "nsIWindowlessPlugInstPeer.h"
00043 #include "nsIPluginTagInfo2.h"
00044 #include "nsIPluginInstanceOwner.h"
00045 #ifdef OJI
00046 #include "nsIJVMPluginTagInfo.h"
00047 #endif
00048 #include "nsPIPluginInstancePeer.h"
00049 
00050 class nsPluginInstancePeerImpl : public nsIPluginInstancePeer2,
00051                                  public nsIWindowlessPluginInstancePeer,
00052                                  public nsIPluginTagInfo2,
00053 #ifdef OJI
00054                                  public nsIJVMPluginTagInfo,
00055 #endif
00056                                  public nsPIPluginInstancePeer
00057                                                         
00058 {
00059 public:
00060   nsPluginInstancePeerImpl();
00061   virtual ~nsPluginInstancePeerImpl();
00062 
00063   NS_DECL_ISUPPORTS
00064 
00065   // nsIPluginInstancePeer interface
00066 
00067   NS_IMETHOD
00068   GetValue(nsPluginInstancePeerVariable variable, void *value);
00069 
00070   NS_IMETHOD
00071   GetMIMEType(nsMIMEType *result);
00072 
00073   NS_IMETHOD
00074   GetMode(nsPluginMode *result);
00075 
00076   NS_IMETHOD
00077   NewStream(nsMIMEType type, const char* target, nsIOutputStream* *result);
00078 
00079   NS_IMETHOD
00080   ShowStatus(const char* message);
00081 
00082   NS_IMETHOD
00083   SetWindowSize(PRUint32 width, PRUint32 height);
00084 
00085   // nsIPluginInstancePeer2 interface
00086 
00087   NS_IMETHOD
00088   GetJSWindow(JSObject* *outJSWindow);
00089   
00090   NS_IMETHOD
00091   GetJSThread(PRUint32 *outThreadID);
00092 
00093   NS_IMETHOD
00094   GetJSContext(JSContext* *outContext);
00095 
00096   // nsIWindowlessPluginInstancePeer
00097 
00098   // (Corresponds to NPN_InvalidateRect.)
00099   NS_IMETHOD
00100   InvalidateRect(nsPluginRect *invalidRect);
00101 
00102   // (Corresponds to NPN_InvalidateRegion.)
00103   NS_IMETHOD
00104   InvalidateRegion(nsPluginRegion invalidRegion);
00105 
00106   // (Corresponds to NPN_ForceRedraw.)
00107   NS_IMETHOD
00108   ForceRedraw(void);
00109 
00110   /* The tag info interfaces all pass through calls to the 
00111      nsPluginInstanceOwner (see nsObjectFrame.cpp) */
00112 
00113   //nsIPluginTagInfo interface
00114 
00115   NS_IMETHOD
00116   GetAttributes(PRUint16& n, const char*const*& names, const char*const*& values);
00117 
00118   NS_IMETHOD
00119   GetAttribute(const char* name, const char* *result);
00120 
00121   NS_IMETHOD
00122   GetDOMElement(nsIDOMElement* *result);
00123 
00124   //nsIPluginTagInfo2 interface
00125 
00126   NS_IMETHOD
00127   GetTagType(nsPluginTagType *result);
00128 
00129   NS_IMETHOD
00130   GetTagText(const char* *result);
00131 
00132   NS_IMETHOD
00133   GetParameters(PRUint16& n, const char*const*& names, const char*const*& values);
00134 
00135   NS_IMETHOD
00136   GetParameter(const char* name, const char* *result);
00137   
00138   NS_IMETHOD
00139   GetDocumentBase(const char* *result);
00140   
00141   NS_IMETHOD
00142   GetDocumentEncoding(const char* *result);
00143   
00144   NS_IMETHOD
00145   GetAlignment(const char* *result);
00146   
00147   NS_IMETHOD
00148   GetWidth(PRUint32 *result);
00149   
00150   NS_IMETHOD
00151   GetHeight(PRUint32 *result);
00152   
00153   NS_IMETHOD
00154   GetBorderVertSpace(PRUint32 *result);
00155   
00156   NS_IMETHOD
00157   GetBorderHorizSpace(PRUint32 *result);
00158 
00159   NS_IMETHOD
00160   GetUniqueID(PRUint32 *result);
00161 
00162   //nsIJVMPluginTagInfo interface
00163 
00164   NS_IMETHOD
00165   GetCode(const char* *result);
00166 
00167   NS_IMETHOD
00168   GetCodeBase(const char* *result);
00169 
00170   NS_IMETHOD
00171   GetArchive(const char* *result);
00172 
00173   NS_IMETHOD
00174   GetName(const char* *result);
00175 
00176   NS_IMETHOD
00177   GetMayScript(PRBool *result);
00178 
00179   // nsPIPluginInstancePeer interface
00180 
00181   NS_IMETHOD
00182   GetOwner(nsIPluginInstanceOwner **aOwner);
00183 
00184   //locals
00185 
00186   nsresult Initialize(nsIPluginInstanceOwner *aOwner,
00187                       const nsMIMEType aMimeType);
00188 
00189   nsresult SetOwner(nsIPluginInstanceOwner *aOwner);
00190 
00191 private:
00192   nsIPluginInstance       *mInstance; //we don't add a ref to this
00193   nsIPluginInstanceOwner  *mOwner;    //we don't add a ref to this
00194   nsMIMEType              mMIMEType;
00195   PRUint32                mThreadID;
00196   PRBool                  mStopped;
00197 };
00198 
00199 #endif