Back to index

lightning-sunbird  0.9+nobinonly
nsXPInstallManager.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is Mozilla Communicator client code, released
00015  * March 31, 1998.
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  *   Daniel Veditz <dveditz@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef _NS_XPINSTALLMANAGER_H
00040 #define _NS_XPINSTALLMANAGER_H
00041 
00042 #include "nsInstall.h"
00043 
00044 #include "nscore.h"
00045 #include "nsISupports.h"
00046 #include "nsString.h"
00047 
00048 #include "nsIURL.h"
00049 #include "nsIInputStream.h"
00050 #include "nsIStreamListener.h"
00051 #include "nsIXPINotifier.h"
00052 #include "nsIXPInstallManager.h"
00053 #include "nsIXPIDialogService.h"
00054 #include "nsXPITriggerInfo.h"
00055 #include "nsIXPIProgressDialog.h"
00056 #include "nsIChromeRegistry.h"
00057 #include "nsIDOMWindowInternal.h"
00058 #include "nsIObserver.h"
00059 
00060 #include "nsISoftwareUpdate.h"
00061 
00062 #include "nsCOMPtr.h"
00063 
00064 #include "nsIProgressEventSink.h"
00065 #include "nsIInterfaceRequestor.h"
00066 #include "nsIInterfaceRequestorUtils.h"
00067 
00068 #include "nsIDialogParamBlock.h"
00069 
00070 #include "nsPICertNotification.h"
00071 
00072 #include "nsWeakReference.h"
00073 
00074 #define NS_XPIDIALOGSERVICE_CONTRACTID "@mozilla.org/embedui/xpinstall-dialog-service;1"
00075 #define NS_XPINSTALLMANAGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/install-manager;1"
00076 #define XPI_PROGRESS_TOPIC "xpinstall-progress"
00077 
00078 class nsXPInstallManager : public nsIXPIListener,
00079                            public nsIXPIDialogService,
00080                            public nsIXPInstallManager,
00081                            public nsIObserver,
00082                            public nsIStreamListener,
00083                            public nsIProgressEventSink,
00084                            public nsIInterfaceRequestor,
00085                            public nsPICertNotification,
00086                            public nsSupportsWeakReference
00087 {
00088     public:
00089         nsXPInstallManager();
00090         virtual ~nsXPInstallManager();
00091 
00092         NS_DECL_ISUPPORTS
00093         NS_DECL_NSIXPILISTENER
00094         NS_DECL_NSIXPIDIALOGSERVICE
00095         NS_DECL_NSIXPINSTALLMANAGER
00096         NS_DECL_NSIOBSERVER
00097         NS_DECL_NSISTREAMLISTENER
00098         NS_DECL_NSIPROGRESSEVENTSINK
00099         NS_DECL_NSIREQUESTOBSERVER
00100         NS_DECL_NSIINTERFACEREQUESTOR
00101         NS_DECL_NSPICERTNOTIFICATION
00102 
00103         NS_IMETHOD InitManager(nsIScriptGlobalObject* aGlobalObject, nsXPITriggerInfo* aTrigger, PRUint32 aChromeType );
00104 
00105     private:
00106         nsresult    InitManagerInternal();
00107         NS_IMETHOD  DownloadNext();
00108         void        Shutdown();
00109         NS_IMETHOD  GetDestinationFile(nsString& url, nsILocalFile* *file);
00110         NS_IMETHOD  LoadParams(PRUint32 aCount, const PRUnichar** aPackageList, nsIDialogParamBlock** aParams);
00111 #ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
00112         PRBool      ConfirmChromeInstall(nsIDOMWindowInternal* aParentWindow, const PRUnichar** aPackage);
00113 #endif
00114         PRBool      TimeToUpdate(PRTime now);
00115         PRBool      VerifyHash(nsXPITriggerItem* aItem);
00116         PRInt32     GetIndexFromURL(const PRUnichar* aUrl);
00117 
00118         nsXPITriggerInfo*   mTriggers;
00119         nsXPITriggerItem*   mItem;
00120         PRTime              mLastUpdate;
00121         PRUint32            mNextItem;
00122         PRInt32             mNumJars;
00123         PRUint32            mChromeType;
00124         PRInt32             mContentLength;
00125         PRInt32             mOutstandingCertLoads;
00126         PRBool              mDialogOpen;
00127         PRBool              mCancelled;
00128         PRBool              mSelectChrome;
00129         PRBool              mNeedsShutdown;
00130   
00131         nsCOMPtr<nsIXPIProgressDialog>  mDlg;
00132         nsCOMPtr<nsISoftwareUpdate>     mInstallSvc;
00133 
00134         nsCOMPtr<nsIDOMWindowInternal>  mParentWindow;
00135 };
00136 
00137 #endif