Back to index

lightning-sunbird  0.9+nobinonly
nsSoftwareUpdate.h
Go to the documentation of this file.
00001 
00002 #ifndef nsSoftwareUpdate_h___
00003 #define nsSoftwareUpdate_h___
00004 
00005 #include "nsSoftwareUpdateIIDs.h"
00006 #include "nsISoftwareUpdate.h"
00007 
00008 #include "nscore.h"
00009 #include "nsIFactory.h"
00010 #include "nsISupports.h"
00011 #include "nsString.h"
00012 #include "nsVoidArray.h"
00013 #include "prlock.h"
00014 //#include "mozreg.h"
00015 #include "NSReg.h"
00016 #include "nsCOMPtr.h"
00017 
00018 class nsInstallInfo;
00019 class nsIPrincipal;
00020 
00021 #include "nsIScriptExternalNameSet.h"
00022 #include "nsIObserver.h"
00023 #include "nsPIXPIStubHook.h"
00024 #include "nsTopProgressNotifier.h"
00025 
00026 class nsSoftwareUpdate: public nsISoftwareUpdate,
00027                         public nsPIXPIStubHook,
00028                         public nsIObserver
00029 {
00030     public:
00031 
00032         NS_DEFINE_STATIC_CID_ACCESSOR( NS_SoftwareUpdate_CID );
00033 
00034         static nsSoftwareUpdate *GetInstance();
00035 
00040         static nsIFile* GetProgramDirectory() { return mProgramDir; }
00041 
00045         static char*    GetLogName() { return mLogName; }
00046 
00047         static void     NeedCleanup() { mNeedCleanup = PR_TRUE; }
00048 
00049         NS_DECL_ISUPPORTS
00050         NS_DECL_NSPIXPISTUBHOOK
00051         NS_DECL_NSIOBSERVER
00052 
00053         NS_IMETHOD InstallJar( nsIFile* localFile,
00054                                const PRUnichar* URL,
00055                                const PRUnichar* arguments,
00056                                nsIPrincipal* principal = nsnull,
00057                                PRUint32 flags = 0,
00058                                nsIXPIListener* aListener = 0);
00059 
00060         NS_IMETHOD InstallChrome( PRUint32 aType,
00061                                   nsIFile* aFile,
00062                                   const PRUnichar* URL,
00063                                   const PRUnichar* aName,
00064                                   PRBool aSelect,
00065                                   nsIXPIListener* aListener = 0);
00066 
00067         NS_IMETHOD RegisterListener(nsIXPIListener *aListener);
00068 
00069         NS_IMETHOD InstallJarCallBack();
00070         NS_IMETHOD GetMasterListener(nsIXPIListener **aListener);
00071         NS_IMETHOD SetActiveListener(nsIXPIListener *aListener);
00072 
00073         nsSoftwareUpdate();
00074         virtual ~nsSoftwareUpdate();
00075 
00076         static   PRBool             mNeedCleanup;
00077 
00078     private:
00079         static   nsSoftwareUpdate*  mInstance;
00080         static   nsCOMPtr<nsIFile>  mProgramDir;
00081         static   char*              mLogName;
00082 
00083         nsresult RunNextInstall();
00084         nsresult RegisterNameset();
00085         void     CreateMasterListener();
00086         void     Shutdown();
00087 
00088         PRLock*               mLock;
00089         PRBool                mInstalling;
00090         nsVoidArray           mJarInstallQueue;
00091         nsTopProgressListener *mMasterListener;
00092 
00093         HREG                  mReg;
00094 };
00095 
00096 
00097 class nsSoftwareUpdateNameSet : public nsIScriptExternalNameSet
00098 {
00099     public:
00100         nsSoftwareUpdateNameSet();
00101         virtual ~nsSoftwareUpdateNameSet();
00102 
00103         // nsISupports
00104         NS_DECL_ISUPPORTS
00105 
00106         // nsIScriptExternalNameSet
00107         NS_IMETHOD InitializeNameSet(nsIScriptContext* aScriptContext);
00108 };
00109 #endif