Back to index

lightning-sunbird  0.9+nobinonly
nsInstallTrigger.h
Go to the documentation of this file.
00001 #ifndef __NS_INSTALLTRIGGER_H__
00002 #define __NS_INSTALLTRIGGER_H__
00003 
00004 #include "nscore.h"
00005 #include "nsString.h"
00006 #include "nsIFactory.h"
00007 #include "nsISupports.h"
00008 #include "nsIScriptObjectOwner.h"
00009 
00010 #include "prtypes.h"
00011 #include "nsHashtable.h"
00012 
00013 #include "nsIDOMInstallTriggerGlobal.h"
00014 #include "nsSoftwareUpdate.h"
00015 #include "nsXPITriggerInfo.h"
00016 
00017 #include "nsIContentHandler.h"
00018 
00019 #define NOT_CHROME          0
00020 #define CHROME_SKIN         1
00021 #define CHROME_LOCALE       2
00022 #define CHROME_SAFEMAX      CHROME_SKIN
00023 #define CHROME_CONTENT      4
00024 #define CHROME_ALL          (CHROME_SKIN | CHROME_LOCALE | CHROME_CONTENT)
00025 #define CHROME_PROFILE      8
00026 #define CHROME_DELAYED      0x10
00027 #define CHROME_SELECT       0x20
00028 
00029 #define XPI_PERMISSION      "install"
00030 
00031 #define XPI_WHITELIST       PR_TRUE
00032 #define XPI_GLOBAL          PR_FALSE
00033 
00034 class nsInstallTrigger: public nsIScriptObjectOwner,
00035                         public nsIDOMInstallTriggerGlobal,
00036                         public nsIContentHandler
00037 {
00038     public:
00039         static const nsIID& IID() { static nsIID iid = NS_SoftwareUpdateInstallTrigger_CID; return iid; }
00040 
00041         nsInstallTrigger();
00042         virtual ~nsInstallTrigger();
00043 
00044         NS_DECL_ISUPPORTS
00045         NS_DECL_NSICONTENTHANDLER
00046 
00047         NS_IMETHOD    GetScriptObject(nsIScriptContext *aContext, void** aScriptObject);
00048         NS_IMETHOD    SetScriptObject(void* aScriptObject);
00049 
00050         NS_IMETHOD    UpdateEnabled(nsIScriptGlobalObject* aGlobalObject, PRBool aUseWhitelist, PRBool* aReturn);
00051         NS_IMETHOD    Install(nsIScriptGlobalObject* aGlobalObject, nsXPITriggerInfo *aInfo, PRBool* aReturn);
00052         NS_IMETHOD    InstallChrome(nsIScriptGlobalObject* aGlobalObject, PRUint32 aType, nsXPITriggerItem* aItem, PRBool* aReturn);
00053         NS_IMETHOD    StartSoftwareUpdate(nsIScriptGlobalObject* aGlobalObject, const nsString& aURL, PRInt32 aFlags, PRInt32* aReturn);
00054         NS_IMETHOD    CompareVersion(const nsString& aRegName, PRInt32 aMajor, PRInt32 aMinor, PRInt32 aRelease, PRInt32 aBuild, PRInt32* aReturn);
00055         NS_IMETHOD    CompareVersion(const nsString& aRegName, const nsString& aVersion, PRInt32* aReturn);
00056         NS_IMETHOD    CompareVersion(const nsString& aRegName, nsIDOMInstallVersion* aVersion, PRInt32* aReturn);
00057         NS_IMETHOD    GetVersion(const nsString& component, nsString& version);
00058 
00059 
00060     private:
00061         PRBool  AllowInstall(nsIURI* aLaunchURI);
00062         void *mScriptObject;
00063 };
00064 
00065 #define NS_INSTALLTRIGGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/installtrigger;1"
00066 #endif