Back to index

lightning-sunbird  0.9+nobinonly
nsUpdateNotification.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; 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 Communicator client code, released
00016  * March 31, 1998.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998-1999
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Doug Turner <dougt@netscape.com>
00025  *   Pierre Phaneuf <pp@ludusdesign.com>
00026  *
00027  * Alternatively, the contents of this file may be used under the terms of
00028  * either of the GNU General Public License Version 2 or later (the "GPL"),
00029  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00030  * in which case the provisions of the GPL or the LGPL are applicable instead
00031  * of those above. If you wish to allow use of your version of this file only
00032  * under the terms of either the GPL or the LGPL, and not to allow others to
00033  * use your version of this file under the terms of the MPL, indicate your
00034  * decision by deleting the provisions above and replace them with the notice
00035  * and other provisions required by the GPL or the LGPL. If you do not delete
00036  * the provisions above, a recipient may use your version of this file under
00037  * the terms of any one of the MPL, the GPL or the LGPL.
00038  *
00039  * ***** END LICENSE BLOCK ***** */
00040 
00041 
00042 #include "nsCOMPtr.h"
00043 
00044 #include "nsIRDFDataSource.h"
00045 #include "nsRDFCID.h"
00046 #include "nsIRDFXMLSink.h"
00047 #include "nsIRDFResource.h"
00048 #include "nsIRDFService.h"
00049 
00050 #include "VerReg.h"
00051 
00052 #include "nsIUpdateNotification.h"
00053 
00054 #define NS_XPI_UPDATE_NOTIFIER_DATASOURCE_CID \
00055 { 0x69fdc800, 0x4050, 0x11d3, { 0xbe, 0x2f, 0x0, 0x10, 0x4b, 0xde, 0x60, 0x48 } }
00056 
00057 #define NS_XPI_UPDATE_NOTIFIER_CID \
00058 { 0x68a24e36, 0x042d, 0x11d4, { 0xac, 0x85, 0x0, 0xc0, 0x4f, 0xa0, 0xd2, 0x6b } }
00059 
00060 #define NS_XPI_UPDATE_NOTIFIER_CONTRACTID "@mozilla.org/xpinstall/notifier;1"
00061 
00062 #define BASE_DATASOURCE_URL "chrome://communicator/content/xpinstall/SoftwareUpdates.rdf"
00063 
00064 
00065 
00066 class nsXPINotifierImpl : public nsIUpdateNotification, public nsIRDFXMLSinkObserver
00067 {
00068 
00069 public:
00070     static NS_IMETHODIMP New(nsISupports* aOuter, REFNSIID aIID, void** aResult);
00071     
00072     NS_DECL_ISUPPORTS
00073     NS_DECL_NSIRDFXMLSINKOBSERVER
00074     NS_DECL_NSIUPDATENOTIFICATION    
00075 
00076 protected:
00077     
00078     nsXPINotifierImpl();
00079     virtual ~nsXPINotifierImpl();
00080 
00081     nsresult NotificationEnabled(PRBool* aReturn);
00082     nsresult Init();
00083     nsresult OpenRemoteDataSource(const char* aURL, PRBool blocking, nsIRDFDataSource** aResult);
00084     
00085     PRBool IsNewerOrUninstalled(const char* regKey, const char* versionString);
00086     PRInt32 CompareVersions(VERSION *oldversion, VERSION *newVersion);
00087     void   StringToVersionNumbers(const nsString& version, int32 *aMajor, int32 *aMinor, int32 *aRelease, int32 *aBuild);
00088     
00089     nsCOMPtr<nsISupports> mNotifications;
00090     nsIRDFService* mRDF;
00091 
00092     PRUint32 mPendingRefreshes;
00093 
00094     static nsIRDFResource* kXPI_NotifierSources;
00095     static nsIRDFResource* kXPI_NotifierPackages;
00096     static nsIRDFResource* kXPI_NotifierPackage_Title;
00097     static nsIRDFResource* kXPI_NotifierPackage_Version;
00098     static nsIRDFResource* kXPI_NotifierPackage_Description;
00099     static nsIRDFResource* kXPI_NotifierPackage_RegKey;
00100 
00101     static nsIRDFResource* kNC_NotificationRoot;
00102     static nsIRDFResource* kNC_Source;
00103        static nsIRDFResource* kNC_Name;
00104        static nsIRDFResource* kNC_URL;
00105        static nsIRDFResource* kNC_Child;
00106        
00107 };