Part 3 of bug 472093 -- fix build system to use NTDDI_VERSION instead of random checks -- add MOZ_NTDDI_* defines, switch code over to use these defines.

r=ted for build config parts, r=jmathies for app association and download manager changes, r+sr=bz for helper app service, r=vlad + sr=ted for stock icons.
This commit is contained in:
Siddharth Agarwal 2009-04-12 20:25:29 +05:30
Родитель ab92f14eff
Коммит c61dd94f15
10 изменённых файлов: 30 добавлений и 17 удалений

Просмотреть файл

@ -216,7 +216,7 @@ static SETTING gSettings[] = {
PRBool PRBool
nsWindowsShellService::IsDefaultBrowserVista(PRBool* aIsDefaultBrowser) nsWindowsShellService::IsDefaultBrowserVista(PRBool* aIsDefaultBrowser)
{ {
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
IApplicationAssociationRegistration* pAAR; IApplicationAssociationRegistration* pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration, HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,

Просмотреть файл

@ -732,6 +732,10 @@ EOF
fi fi
AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER) AC_DEFINE_UNQUOTED(MOZ_WINSDK_TARGETVER,0x$MOZ_WINSDK_TARGETVER)
# Definitions matching sdkddkver.h
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WS03, 0x05020000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_LONGHORN, 0x06000000)
AC_DEFINE_UNQUOTED(MOZ_NTDDI_WIN7, 0x06010000)
;; ;;
esac esac

Просмотреть файл

@ -59,7 +59,7 @@
#include "nsCExternalHandlerService.h" #include "nsCExternalHandlerService.h"
#include "nsDirectoryServiceDefs.h" #include "nsDirectoryServiceDefs.h"
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#ifdef _WIN32_WINNT #ifdef _WIN32_WINNT
#undef _WIN32_WINNT #undef _WIN32_WINNT
#endif #endif
@ -89,7 +89,7 @@ struct ICONENTRY {
PRUint32 ieFileOffset; PRUint32 ieFileOffset;
}; };
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
typedef HRESULT (WINAPI*SHGetStockIconInfoPtr) (SHSTOCKICONID siid, UINT uFlags, SHSTOCKICONINFO *psii); typedef HRESULT (WINAPI*SHGetStockIconInfoPtr) (SHSTOCKICONID siid, UINT uFlags, SHSTOCKICONINFO *psii);
// Match stock icons with names // Match stock icons with names
@ -393,7 +393,7 @@ nsresult nsIconChannel::GetHIconFromFile(HICON *hIcon)
#endif #endif
} }
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon) nsresult nsIconChannel::GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -447,7 +447,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
#ifndef WINCE #ifndef WINCE
HICON hIcon = NULL; HICON hIcon = NULL;
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
nsCOMPtr<nsIMozIconURI> iconURI(do_QueryInterface(mUrl, &rv)); nsCOMPtr<nsIMozIconURI> iconURI(do_QueryInterface(mUrl, &rv));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -85,7 +85,7 @@ protected:
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking); nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
// Functions specific to Vista and above // Functions specific to Vista and above
#ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
protected: protected:
nsresult GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon); nsresult GetStockHIcon(nsIMozIconURI *aIconURI, HICON *hIcon);
#endif #endif

Просмотреть файл

@ -75,13 +75,10 @@ CPPSRCS = \
nsDownloadManager.cpp \ nsDownloadManager.cpp \
$(NULL) $(NULL)
ifndef MOZ_DISABLE_VISTA_SDK_REQUIREMENTS
ifndef GNU_CXX ifndef GNU_CXX
ifeq ($(OS_ARCH),WINNT) ifeq ($(OS_ARCH),WINNT)
CPPSRCS += nsDownloadScanner.cpp CPPSRCS += nsDownloadScanner.cpp
REQUIRES += xulapp REQUIRES += xulapp
DEFINES += -DDOWNLOAD_SCANNER
endif
endif endif
endif endif

Просмотреть файл

@ -44,6 +44,10 @@
#ifndef downloadmanager___h___ #ifndef downloadmanager___h___
#define downloadmanager___h___ #define downloadmanager___h___
#if defined(XP_WIN) && (MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN)
#define DOWNLOAD_SCANNER
#endif
#include "nsIDownload.h" #include "nsIDownload.h"
#include "nsIDownloadManager.h" #include "nsIDownloadManager.h"
#include "nsIDownloadProgressListener.h" #include "nsIDownloadProgressListener.h"

Просмотреть файл

@ -36,7 +36,9 @@
* the terms of any one of the MPL, the GPL or the LGPL. * the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#include "nsDownloadScanner.h" #include "nsDownloadScanner.h"
#include <comcat.h> #include <comcat.h>
#include <process.h> #include <process.h>
@ -944,3 +946,5 @@ nsDownloadScannerWatchdog::WatchdogThread(void *p) {
_endthreadex(0); _endthreadex(0);
return 0; return 0;
} }
#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN

Просмотреть файл

@ -1,5 +1,7 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: se cin sw=2 ts=2 et : */ /* vim: se cin sw=2 ts=2 et : */
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
#ifndef nsDownloadScanner_h_ #ifndef nsDownloadScanner_h_
#define nsDownloadScanner_h_ #define nsDownloadScanner_h_
@ -124,3 +126,5 @@ private:
friend class nsDownloadScannerWatchdog; friend class nsDownloadScannerWatchdog;
}; };
#endif #endif
#endif // MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN

Просмотреть файл

@ -68,11 +68,11 @@ static nsresult GetExtensionFromWindowsMimeDatabase(const nsACString& aMimeType,
nsOSHelperAppService::nsOSHelperAppService() : nsOSHelperAppService::nsOSHelperAppService() :
nsExternalHelperAppService() nsExternalHelperAppService()
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
, mAppAssoc(nsnull) , mAppAssoc(nsnull)
#endif #endif
{ {
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
CoInitialize(NULL); CoInitialize(NULL);
CoCreateInstance(CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC, CoCreateInstance(CLSID_ApplicationAssociationRegistration, NULL, CLSCTX_INPROC,
IID_IApplicationAssociationRegistration, (void**)&mAppAssoc); IID_IApplicationAssociationRegistration, (void**)&mAppAssoc);
@ -81,7 +81,7 @@ nsOSHelperAppService::nsOSHelperAppService() :
nsOSHelperAppService::~nsOSHelperAppService() nsOSHelperAppService::~nsOSHelperAppService()
{ {
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
if (mAppAssoc) if (mAppAssoc)
mAppAssoc->Release(); mAppAssoc->Release();
mAppAssoc = nsnull; mAppAssoc = nsnull;
@ -159,7 +159,7 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch
*aHandlerExists = PR_FALSE; *aHandlerExists = PR_FALSE;
if (aProtocolScheme && *aProtocolScheme) if (aProtocolScheme && *aProtocolScheme)
{ {
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
// Vista: use new application association interface // Vista: use new application association interface
if (mAppAssoc) { if (mAppAssoc) {
PRUnichar * pResult = nsnull; PRUnichar * pResult = nsnull;
@ -203,7 +203,7 @@ NS_IMETHODIMP nsOSHelperAppService::GetApplicationDescription(const nsACString&
NS_ConvertASCIItoUTF16 buf(aScheme); NS_ConvertASCIItoUTF16 buf(aScheme);
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
// Vista: use new application association interface // Vista: use new application association interface
if (mAppAssoc) { if (mAppAssoc) {
PRUnichar * pResult = nsnull; PRUnichar * pResult = nsnull;
@ -555,7 +555,7 @@ already_AddRefed<nsMIMEInfoWin> nsOSHelperAppService::GetByExtension(const nsAFl
nsAutoString appInfo; nsAutoString appInfo;
PRBool found; PRBool found;
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
// Retrieve the default application for this extension // Retrieve the default application for this extension
if (mAppAssoc) { if (mAppAssoc) {
// Vista: use the new application association COM interfaces // Vista: use the new application association COM interfaces

Просмотреть файл

@ -93,7 +93,7 @@ protected:
static PRBool typeFromExtEquals(const PRUnichar* aExt, const char *aType); static PRBool typeFromExtEquals(const PRUnichar* aExt, const char *aType);
private: private:
#if !defined(MOZ_DISABLE_VISTA_SDK_REQUIREMENTS) #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
IApplicationAssociationRegistration* mAppAssoc; IApplicationAssociationRegistration* mAppAssoc;
#endif #endif
}; };