1 /* ***** BEGIN LICENSE BLOCK *****
2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 * The contents of this file are subject to the Mozilla Public License Version
5 * 1.1 (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 * http://www.mozilla.org/MPL/
9 * Software distributed under the License is distributed on an "AS IS" basis,
10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11 * for the specific language governing rights and limitations under the
14 * The Original Code is Mozilla Communicator client code, released
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
23 * Daniel Veditz <dveditz@netscape.com>
24 * Dave Townsend <dtownsend@oxymoronical.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef _NS_XPINSTALLMANAGER_H
41 #define _NS_XPINSTALLMANAGER_H
43 #include "nsInstall.h"
46 #include "nsISupports.h"
50 #include "nsIInputStream.h"
51 #include "nsIStreamListener.h"
52 #include "nsIXPInstallManager.h"
53 #include "nsIXPIDialogService.h"
54 #include "nsXPITriggerInfo.h"
55 #include "nsIXPIProgressDialog.h"
56 #include "nsIChromeRegistry.h"
57 #include "nsIDOMWindowInternal.h"
58 #include "nsIObserver.h"
59 #include "nsIBadCertListener2.h"
60 #include "nsISSLErrorListener.h"
61 #include "nsIChannelEventSink.h"
62 #include "nsIZipReader.h"
63 #include "nsIXPIInstallInfo.h"
64 #include "nsILoadGroup.h"
68 #include "nsIProgressEventSink.h"
69 #include "nsIInterfaceRequestor.h"
70 #include "nsIInterfaceRequestorUtils.h"
72 #include "nsIDialogParamBlock.h"
74 #include "nsPICertNotification.h"
76 #include "nsWeakReference.h"
78 #define NS_XPIDIALOGSERVICE_CONTRACTID "@mozilla.org/embedui/xpinstall-dialog-service;1"
79 #define NS_XPINSTALLMANAGERCOMPONENT_CONTRACTID "@mozilla.org/xpinstall/install-manager;1"
80 #define XPI_PROGRESS_TOPIC "xpinstall-progress"
82 class nsXPInstallManager
: public nsIXPIDialogService
,
83 public nsIXPInstallManager
,
85 public nsIStreamListener
,
86 public nsIProgressEventSink
,
87 public nsIInterfaceRequestor
,
88 public nsPICertNotification
,
89 public nsIBadCertListener2
,
90 public nsISSLErrorListener
,
91 public nsIChannelEventSink
,
92 public nsSupportsWeakReference
96 virtual ~nsXPInstallManager();
99 NS_DECL_NSIXPIDIALOGSERVICE
100 NS_DECL_NSIXPINSTALLMANAGER
102 NS_DECL_NSISTREAMLISTENER
103 NS_DECL_NSIPROGRESSEVENTSINK
104 NS_DECL_NSIREQUESTOBSERVER
105 NS_DECL_NSIINTERFACEREQUESTOR
106 NS_DECL_NSPICERTNOTIFICATION
107 NS_DECL_NSIBADCERTLISTENER2
108 NS_DECL_NSISSLERRORLISTENER
109 NS_DECL_NSICHANNELEVENTSINK
111 NS_IMETHOD
InitManager(nsIDOMWindowInternal
* aParentWindow
, nsXPITriggerInfo
* aTrigger
, PRUint32 aChromeType
);
114 nsresult
InitManagerInternal();
115 nsresult
InstallItems();
116 NS_IMETHOD
DownloadNext();
117 void Shutdown(PRInt32 status
= nsInstall::USER_CANCELLED
);
118 NS_IMETHOD
GetDestinationFile(nsString
& url
, nsILocalFile
* *file
);
119 NS_IMETHOD
LoadParams(PRUint32 aCount
, const PRUnichar
** aPackageList
, nsIDialogParamBlock
** aParams
);
120 #ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI
121 PRBool
ConfirmChromeInstall(nsIDOMWindowInternal
* aParentWindow
, const PRUnichar
** aPackage
);
123 PRBool
VerifyHash(nsXPITriggerItem
* aItem
);
124 PRInt32
GetIndexFromURL(const PRUnichar
* aUrl
);
125 nsresult
CheckCert(nsIChannel
* aChannel
);
127 nsXPITriggerInfo
* mTriggers
;
128 nsXPITriggerItem
* mItem
;
130 PRUint32 mChromeType
;
131 PRInt32 mContentLength
;
132 PRInt32 mOutstandingCertLoads
;
135 PRBool mNeedsShutdown
;
138 nsCOMPtr
<nsIXPIProgressDialog
> mDlg
;
140 nsCOMPtr
<nsIDOMWindowInternal
> mParentWindow
;
141 nsCOMPtr
<nsILoadGroup
> mLoadGroup
;