diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:34:42 +0000 |
commit | da4c7e7ed675c3bf405668739c3012d140856109 (patch) | |
tree | cdd868dba063fecba609a1d819de271f0d51b23e /uriloader/exthandler/win/nsMIMEInfoWin.cpp | |
parent | Adding upstream version 125.0.3. (diff) | |
download | firefox-da4c7e7ed675c3bf405668739c3012d140856109.tar.xz firefox-da4c7e7ed675c3bf405668739c3012d140856109.zip |
Adding upstream version 126.0.upstream/126.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'uriloader/exthandler/win/nsMIMEInfoWin.cpp')
-rw-r--r-- | uriloader/exthandler/win/nsMIMEInfoWin.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index 758b2018a7..24044c5f25 100644 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -9,6 +9,7 @@ #include "nsCOMArray.h" #include "nsLocalFile.h" #include "nsMIMEInfoWin.h" +#include "nsLocalHandlerAppWin.h" #include "nsIMIMEService.h" #include "nsNetUtil.h" #include <windows.h> @@ -221,6 +222,16 @@ nsMIMEInfoWin::GetHasDefaultHandler(bool* _retval) { return NS_OK; } +NS_IMETHODIMP nsMIMEInfoWin::GetDefaultExecutable(nsIFile** aExecutable) { + nsCOMPtr<nsIFile> defaultApp = GetDefaultApplication(); + if (defaultApp) { + defaultApp.forget(aExecutable); + return NS_OK; + } + + return NS_ERROR_FAILURE; +} + NS_IMETHODIMP nsMIMEInfoWin::GetEnumerator(nsISimpleEnumerator** _retval) { nsCOMArray<nsIVariant> properties; @@ -554,6 +565,7 @@ bool nsMIMEInfoWin::GetProgIDVerbCommandHandler(const nsAString& appProgIDName, // entries to lower case and stores them in the trackList array. void nsMIMEInfoWin::ProcessPath(nsCOMPtr<nsIMutableArray>& appList, nsTArray<nsString>& trackList, + const nsAutoString& appIdOrName, const nsAString& appFilesystemCommand) { nsAutoString lower(appFilesystemCommand); ToLowerCase(lower); @@ -569,6 +581,9 @@ void nsMIMEInfoWin::ProcessPath(nsCOMPtr<nsIMutableArray>& appList, nsCOMPtr<nsILocalHandlerApp> aApp; if (!GetLocalHandlerApp(appFilesystemCommand, aApp)) return; + // Track the app id so that the pretty name can be determined later + (static_cast<nsLocalHandlerAppWin*>(aApp.get()))->SetAppIdOrName(appIdOrName); + // Save in our main tracking arrays appList->AppendElement(aApp); trackList.AppendElement(lower); @@ -673,7 +688,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { if (GetProgIDVerbCommandHandler(appProgId, appFilesystemCommand, false) && !IsPathInList(appFilesystemCommand, trackList)) { - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appProgId, appFilesystemCommand); } } } @@ -701,7 +716,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appName, appFilesystemCommand); } } regKey->Close(); @@ -729,7 +744,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appProgId, appFilesystemCommand); } } regKey->Close(); @@ -762,7 +777,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appValue, appFilesystemCommand); } } } @@ -791,7 +806,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appProgId, appFilesystemCommand); } } regKey->Close(); @@ -829,7 +844,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appName, appFilesystemCommand); } } } @@ -857,7 +872,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { if (!GetAppsVerbCommandHandler(appName, appFilesystemCommand, false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appName, appFilesystemCommand); } } regKey->Close(); @@ -882,7 +897,7 @@ nsMIMEInfoWin::GetPossibleLocalHandlers(nsIArray** _retval) { if (!GetAppsVerbCommandHandler(appName, appFilesystemCommand, false) || IsPathInList(appFilesystemCommand, trackList)) continue; - ProcessPath(appList, trackList, appFilesystemCommand); + ProcessPath(appList, trackList, appName, appFilesystemCommand); } } } |