diff options
Diffstat (limited to 'browser/components/shell/nsWindowsShellService.cpp')
-rw-r--r-- | browser/components/shell/nsWindowsShellService.cpp | 81 |
1 files changed, 39 insertions, 42 deletions
diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 416e00cbc..879b0c7f0 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -12,7 +12,6 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLImageElement.h" #include "nsIImageLoadingContent.h" -#include "nsIOutputStream.h" #include "nsIPrefService.h" #include "nsIPrefLocalizedString.h" #include "nsIServiceManager.h" @@ -102,18 +101,18 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey) // .htm .html .shtml .xht .xhtml // are mapped like so: // -// HKCU\SOFTWARE\Classes\.<ext>\ (default) REG_SZ FirefoxHTML +// HKCU\SOFTWARE\Classes\.<ext>\ (default) REG_SZ BasiliskHTML // // as aliases to the class: // -// HKCU\SOFTWARE\Classes\FirefoxHTML\ +// HKCU\SOFTWARE\Classes\BasiliskHTML\ // DefaultIcon (default) REG_SZ <apppath>,1 // shell\open\command (default) REG_SZ <apppath> -osint -url "%1" // shell\open\ddeexec (default) REG_SZ <empty string> // // - Windows Vista and above Protocol Handler // -// HKCU\SOFTWARE\Classes\FirefoxURL\ (default) REG_SZ <appname> URL +// HKCU\SOFTWARE\Classes\BasiliskURL\ (default) REG_SZ <appname> URL // EditFlags REG_DWORD 2 // FriendlyTypeName REG_SZ <appname> URL // DefaultIcon (default) REG_SZ <apppath>,1 @@ -133,10 +132,10 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey) // // - Windows Start Menu (XP SP1 and newer) // ------------------------------------------------- -// The following keys are set to make Firefox appear in the Start Menu as the +// The following keys are set to make Basilisk appear in the Start Menu as the // browser: // -// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\ +// HKCU\SOFTWARE\Clients\StartMenuInternet\BASILISK.EXE\ // (default) REG_SZ <appname> // DefaultIcon (default) REG_SZ <apppath>,0 // InstallInfo HideIconsCommand REG_SZ <uninstpath> /HideShortcuts @@ -157,7 +156,7 @@ typedef struct { const char* oldValueData; } SETTING; -#define APP_REG_NAME L"Firefox" +#define APP_REG_NAME L"Basilisk" #define VAL_FILE_ICON "%APPPATH%,1" #define VAL_OPEN "\"%APPPATH%\" -osint -url \"%1\"" #define OLD_VAL_OPEN "\"%APPPATH%\" -requestPending -osint -url \"%1\"" @@ -171,11 +170,11 @@ typedef struct { PREFIX MID // The DefaultIcon registry key value should never be used when checking if -// Firefox is the default browser for file handlers since other applications +// Basilisk is the default browser for file handlers since other applications // (e.g. MS Office) may modify the DefaultIcon registry key value to add Icon // Handlers. see http://msdn2.microsoft.com/en-us/library/aa969357.aspx for // more info. The FTP protocol is not checked so advanced users can set the FTP -// handler to another application and still have Firefox check if it is the +// handler to another application and still have Basilisk check if it is the // default HTTP and HTTPS handler. // *** Do not add additional checks here unless you skip them when aForAllTypes // is false below***. @@ -183,10 +182,10 @@ static SETTING gSettings[] = { // File Handler Class // ***keep this as the first entry because when aForAllTypes is not set below // it will skip over this check.*** - { MAKE_KEY_NAME1("FirefoxHTML", SOC), VAL_OPEN, OLD_VAL_OPEN }, + { MAKE_KEY_NAME1("BasiliskHTML", SOC), VAL_OPEN, OLD_VAL_OPEN }, // Protocol Handler Class - for Vista and above - { MAKE_KEY_NAME1("FirefoxURL", SOC), VAL_OPEN, OLD_VAL_OPEN }, + { MAKE_KEY_NAME1("BasiliskURL", SOC), VAL_OPEN, OLD_VAL_OPEN }, // Protocol Handlers { MAKE_KEY_NAME1("HTTP", DI), VAL_FILE_ICON }, @@ -196,14 +195,14 @@ static SETTING gSettings[] = { }; // The settings to disable DDE are separate from the default browser settings -// since they are only checked when Firefox is the default browser and if they +// since they are only checked when Basilisk is the default browser and if they // are incorrect they are fixed without notifying the user. static SETTING gDDESettings[] = { // File Handler Class - { MAKE_KEY_NAME1("Software\\Classes\\FirefoxHTML", SOD) }, + { MAKE_KEY_NAME1("Software\\Classes\\BasiliskHTML", SOD) }, // Protocol Handler Class - for Vista and above - { MAKE_KEY_NAME1("Software\\Classes\\FirefoxURL", SOD) }, + { MAKE_KEY_NAME1("Software\\Classes\\BasiliskURL", SOD) }, // Protocol Handlers { MAKE_KEY_NAME1("Software\\Classes\\FTP", SOD) }, @@ -340,7 +339,7 @@ IsAARDefault(const RefPtr<IApplicationAssociationRegistration>& pAAR, return false; } - LPCWSTR progID = isProtocol ? L"FirefoxURL" : L"FirefoxHTML"; + LPCWSTR progID = isProtocol ? L"BasiliskURL" : L"BasiliskHTML"; bool isDefault = !wcsicmp(registeredApp, progID); CoTaskMemFree(registeredApp); @@ -372,9 +371,9 @@ IsDefaultBrowserWin8(bool aCheckAllTypes, bool* aIsDefaultBrowser) /* * Query's the AAR for the default status. - * This only checks for FirefoxURL and if aCheckAllTypes is set, then - * it also checks for FirefoxHTML. Note that those ProgIDs are shared - * by all Firefox browsers. + * This only checks for BasiliskURL and if aCheckAllTypes is set, then + * it also checks for BasiliskHTML. Note that those ProgIDs are shared + * by all Basilisk browsers. */ bool nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes, @@ -417,7 +416,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_ERROR_FAILURE; // Convert the path to a long path since GetModuleFileNameW returns the path - // that was used to launch Firefox which is not necessarily a long path. + // that was used to launch Basilisk which is not necessarily a long path. if (!::GetLongPathNameW(exePath, exePath, MAX_BUF)) return NS_ERROR_FAILURE; @@ -466,31 +465,32 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } - res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName.get(), + res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, PromiseFlatString(keyName).get(), 0, KEY_SET_VALUE, &theKey); if (REG_FAILED(res)) { // If updating the open command fails try to update it using the helper - // application when setting Firefox as the default browser. + // application when setting Basilisk as the default browser. *aIsDefaultBrowser = false; return NS_OK; } + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); if (REG_FAILED(res)) { // If updating the open command fails try to update it using the helper - // application when setting Firefox as the default browser. + // application when setting Basilisk as the default browser. *aIsDefaultBrowser = false; return NS_OK; } } } - // Only check if Firefox is the default browser on Vista and above if the - // previous checks show that Firefox is the default browser. + // Only check if Basilisk is the default browser on Vista and above if the + // previous checks show that Basilisk is the default browser. if (*aIsDefaultBrowser) { IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser); if (IsWin8OrLater()) { @@ -499,9 +499,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, } // To handle the case where DDE isn't disabled due for a user because there - // account didn't perform a Firefox update this will check if Firefox is the + // account didn't perform a Basilisk update this will check if Basilisk is the // default browser and if dde is disabled for each handler - // and if it isn't disable it. When Firefox is not the default browser the + // and if it isn't disable it. When Basilisk is not the default browser the // helper application will disable dde for each handler. if (*aIsDefaultBrowser && aForAllTypes) { // Check ftp settings @@ -515,7 +515,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, if (NS_FAILED(rv)) { ::RegCloseKey(theKey); // If disabling DDE fails try to disable it using the helper - // application when setting Firefox as the default browser. + // application when setting Basilisk as the default browser. *aIsDefaultBrowser = false; return NS_OK; } @@ -529,13 +529,14 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, if (REG_FAILED(res) || char16_t('\0') != *currValue) { // Key wasn't set or was set to something other than our registry entry. // Delete the key along with all of its childrean and then recreate it. - ::SHDeleteKeyW(HKEY_CURRENT_USER, keyName.get()); - res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, nullptr, + const nsString &flatName = PromiseFlatString(keyName); + ::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get()); + res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nullptr, &theKey, nullptr); if (REG_FAILED(res)) { // If disabling DDE fails try to disable it using the helper - // application when setting Firefox as the default browser. + // application when setting Basilisk as the default browser. *aIsDefaultBrowser = false; return NS_OK; } @@ -546,7 +547,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, ::RegCloseKey(theKey); if (REG_FAILED(res)) { // If disabling DDE fails try to disable it using the helper - // application when setting Firefox as the default browser. + // application when setting Basilisk as the default browser. *aIsDefaultBrowser = false; return NS_OK; } @@ -582,13 +583,14 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, NS_ConvertUTF8toUTF16 valueData(VAL_OPEN); valueData.Replace(offset, 9, appLongPath); + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); // If updating the FTP protocol handlers shell open command fails try to - // update it using the helper application when setting Firefox as the + // update it using the helper application when setting Basilisk as the // default browser. if (REG_FAILED(res)) { *aIsDefaultBrowser = false; @@ -646,11 +648,6 @@ nsWindowsShellService::LaunchControlPanelDefaultsSelectionUI() nsresult nsWindowsShellService::LaunchControlPanelDefaultPrograms() { - // This Default Programs feature is Win7+ only. - if (!IsWin7OrLater()) { - return NS_ERROR_FAILURE; - } - // Build the path control.exe path safely WCHAR controlEXEPath[MAX_PATH + 1] = { '\0' }; if (!GetSystemDirectoryW(controlEXEPath, MAX_PATH)) { @@ -1005,7 +1002,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement, getter_AddRefs(file)); NS_ENSURE_SUCCESS(rv, rv); - // eventually, the path is "%APPDATA%\Mozilla\Firefox\Desktop Background.bmp" + // eventually, the path is "%APPDATA%\Mozilla\Basilisk\Desktop Background.bmp" rv = file->Append(fileLeafName); NS_ENSURE_SUCCESS(rv, rv); |