diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:37 +0000 |
commit | a90a5cba08fdf6c0ceb95101c275108a152a3aed (patch) | |
tree | 532507288f3defd7f4dcf1af49698bcb76034855 /browser/components/shell/nsWindowsShellService.cpp | |
parent | Adding debian version 126.0.1-1. (diff) | |
download | firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/components/shell/nsWindowsShellService.cpp')
-rw-r--r-- | browser/components/shell/nsWindowsShellService.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 86c7694bf8..f7bca95b09 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -39,6 +39,7 @@ #include "nsIXULAppInfo.h" #include "nsINIParser.h" #include "nsNativeAppSupportWin.h" +#include "Windows11TaskbarPinning.h" #include <windows.h> #include <shellapi.h> @@ -1626,7 +1627,7 @@ nsWindowsShellService::GetTaskbarTabPins(nsTArray<nsString>& aShortcutPaths) { static nsresult PinCurrentAppToTaskbarWin10(bool aCheckOnly, const nsAString& aAppUserModelId, - nsAutoString aShortcutPath) { + const nsAString& aShortcutPath) { // The behavior here is identical if we're only checking or if we try to pin // but the app is already pinned so we update the variable accordingly. if (!aCheckOnly) { @@ -1695,6 +1696,28 @@ static nsresult PinCurrentAppToTaskbarImpl( } } + auto pinWithWin11TaskbarAPIResults = + PinCurrentAppToTaskbarWin11(aCheckOnly, aAppUserModelId, shortcutPath); + switch (pinWithWin11TaskbarAPIResults.result) { + case Win11PinToTaskBarResultStatus::NotSupported: + // Fall through to the win 10 mechanism + break; + + case Win11PinToTaskBarResultStatus::Success: + case Win11PinToTaskBarResultStatus::AlreadyPinned: + return NS_OK; + + case Win11PinToTaskBarResultStatus::NotCurrentlyAllowed: + case Win11PinToTaskBarResultStatus::Failed: + // return NS_ERROR_FAILURE; + + // Fall through to the old mechanism for now + // In future, we should be sending telemetry for when + // an error occurs or for when pinning is not allowed + // with the Win 11 APIs. + break; + } + return PinCurrentAppToTaskbarWin10(aCheckOnly, aAppUserModelId, shortcutPath); } @@ -1720,7 +1743,7 @@ static nsresult PinCurrentAppToTaskbarAsyncImpl(bool aCheckOnly, } nsAutoString aumid; - if (NS_WARN_IF(!mozilla::widget::WinTaskbar::GenerateAppUserModelID( + if (NS_WARN_IF(!mozilla::widget::WinTaskbar::GetAppUserModelID( aumid, aPrivateBrowsing))) { return NS_ERROR_FAILURE; } |