From 060fc194ba98b42f19fcfae6c1411a8028103265 Mon Sep 17 00:00:00 2001 From: "Brian R. Bondy" Date: Thu, 14 Feb 2013 16:44:20 -0500 Subject: [PATCH] Bug 841197 - Upgrading from older nightly that has been set as default browser now shows metro tile. r=jimm --- browser/installer/windows/nsis/shared.nsh | 61 ++++++++++++++--------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/browser/installer/windows/nsis/shared.nsh b/browser/installer/windows/nsis/shared.nsh index 56ae4f6b08f6..8a22a0ca57a8 100755 --- a/browser/installer/windows/nsis/shared.nsh +++ b/browser/installer/windows/nsis/shared.nsh @@ -6,6 +6,37 @@ ; to launch the Win8 metro browser or desktop browser. !define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3} +; Does metro registration for the command execute handler +Function RegisterCEH +!ifdef MOZ_METRO + ${If} ${AtLeastWin8} + ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} + ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ + "$INSTDIR\CommandExecuteHandler.exe" \ + $AppUserModelID \ + "FirefoxURL" \ + "FirefoxHTML" + ${EndIf} +!endif +FunctionEnd + +; If MOZ_METRO is defined and we're at least win8, then we should re-create +; the start menu shortcut so that the Metro browser is accessible. +; This is also for zip builds who won't have a start menu shortcut yet. +Function CreateStartMenuTile +!ifdef MOZ_METRO + Delete "$SMPROGRAMS\${BrandFullName}.lnk" + CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" + ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" + ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ + "$INSTDIR" + ${If} "$AppUserModelID" != "" + ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" + ${EndIf} + ${EndIf} +!endif +FunctionEnd + !macro PostUpdate ${CreateShortcutsLog} @@ -23,6 +54,10 @@ ; Win7 taskbar and start menu link maintenance Call FixShortcutAppModelIDs + ; Win8 specific registration + Call RegisterCEH + Call CreateStartMenuTile + ClearErrors WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" ${If} ${Errors} @@ -342,16 +377,7 @@ ${AddDisabledDDEHandlerValues} "FirefoxURL" "$2" "$8,1" "${AppRegName} URL" \ "true" -!ifdef MOZ_METRO - ${If} ${AtLeastWin8} - ${CleanupMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} - ${AddMetroBrowserHandlerValues} ${DELEGATE_EXECUTE_HANDLER_ID} \ - "$INSTDIR\CommandExecuteHandler.exe" \ - $AppUserModelID \ - "FirefoxURL" \ - "FirefoxHTML" - ${EndIf} -!endif + Call RegisterCEH ; An empty string is used for the 4th & 5th params because the following ; protocol handlers already have a display name and the additional keys @@ -1149,20 +1175,7 @@ Function SetAsDefaultAppUserHKCU ${SetStartMenuInternet} "HKCU" ${FixShellIconHandler} "HKCU" ${FixClassKeys} ; Does not use SHCTX -; If MOZ_METRO is defined and we're at least win8, then we should re-create -; the start menu shortcut so that the Metro browser is accessible. -; This is also for zip builds who won't have a start menu shortcut yet. -!ifdef MOZ_METRO - Delete "$SMPROGRAMS\${BrandFullName}.lnk" - CreateShortCut "$SMPROGRAMS\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" - ${If} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk" - ShellLink::SetShortCutWorkingDirectory "$SMPROGRAMS\${BrandFullName}.lnk" \ - "$INSTDIR" - ${If} "$AppUserModelID" != "" - ApplicationID::Set "$SMPROGRAMS\${BrandFullName}.lnk" "$AppUserModelID" "true" - ${EndIf} - ${EndIf} -!endif + Call CreateStartMenuTile ${EndIf} ${SetHandlers}