summaryrefslogtreecommitdiffstats
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/components/alerts/nsAlertsService.cpp23
-rw-r--r--toolkit/components/alerts/nsAlertsService.h17
-rw-r--r--toolkit/xre/nsEmbedFunctions.cpp24
3 files changed, 10 insertions, 54 deletions
diff --git a/toolkit/components/alerts/nsAlertsService.cpp b/toolkit/components/alerts/nsAlertsService.cpp
index 35418dd17..dd67ad983 100644
--- a/toolkit/components/alerts/nsAlertsService.cpp
+++ b/toolkit/components/alerts/nsAlertsService.cpp
@@ -22,6 +22,10 @@
#include "nsIFaviconService.h"
#endif // MOZ_PLACES
+#ifdef XP_WIN
+#include <shellapi.h>
+#endif
+
using namespace mozilla;
using mozilla::dom::ContentChild;
@@ -154,23 +158,12 @@ bool nsAlertsService::ShouldShowAlert()
bool result = true;
#ifdef XP_WIN
- HMODULE shellDLL = ::LoadLibraryW(L"shell32.dll");
- if (!shellDLL)
- return result;
-
- SHQueryUserNotificationStatePtr pSHQueryUserNotificationState =
- (SHQueryUserNotificationStatePtr) ::GetProcAddress(shellDLL, "SHQueryUserNotificationState");
-
- if (pSHQueryUserNotificationState) {
- MOZ_QUERY_USER_NOTIFICATION_STATE qstate;
- if (SUCCEEDED(pSHQueryUserNotificationState(&qstate))) {
- if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
- result = false;
- }
+ QUERY_USER_NOTIFICATION_STATE qstate;
+ if (SUCCEEDED(SHQueryUserNotificationState(&qstate))) {
+ if (qstate != QUNS_ACCEPTS_NOTIFICATIONS) {
+ result = false;
}
}
-
- ::FreeLibrary(shellDLL);
#endif
return result;
diff --git a/toolkit/components/alerts/nsAlertsService.h b/toolkit/components/alerts/nsAlertsService.h
index 3f23eaabf..d2b2e1e6c 100644
--- a/toolkit/components/alerts/nsAlertsService.h
+++ b/toolkit/components/alerts/nsAlertsService.h
@@ -10,23 +10,6 @@
#include "nsCOMPtr.h"
#include "nsXULAlerts.h"
-#ifdef XP_WIN
-typedef enum tagMOZ_QUERY_USER_NOTIFICATION_STATE {
- QUNS_NOT_PRESENT = 1,
- QUNS_BUSY = 2,
- QUNS_RUNNING_D3D_FULL_SCREEN = 3,
- QUNS_PRESENTATION_MODE = 4,
- QUNS_ACCEPTS_NOTIFICATIONS = 5,
- QUNS_QUIET_TIME = 6,
- QUNS_IMMERSIVE = 7
-} MOZ_QUERY_USER_NOTIFICATION_STATE;
-
-extern "C" {
-// This function is Windows Vista or later
-typedef HRESULT (__stdcall *SHQueryUserNotificationStatePtr)(MOZ_QUERY_USER_NOTIFICATION_STATE *pquns);
-}
-#endif // defined(XP_WIN)
-
class nsAlertsService : public nsIAlertsService,
public nsIAlertsDoNotDisturb
{
diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp
index 0e85532b9..1e67ea7ce 100644
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -24,6 +24,7 @@
#ifdef XP_WIN
#include <process.h>
+#include <shobjidl.h>
#include "mozilla/ipc/WindowsMessageLoop.h"
#endif
@@ -119,10 +120,6 @@ using mozilla::startup::sChildProcessType;
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
-#ifdef XP_WIN
-static const wchar_t kShellLibraryName[] = L"shell32.dll";
-#endif
-
nsresult
XRE_LockProfileDirectory(nsIFile* aDirectory,
nsISupports* *aLockObject)
@@ -270,26 +267,9 @@ XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
void
SetTaskbarGroupId(const nsString& aId)
{
- typedef HRESULT (WINAPI * SetCurrentProcessExplicitAppUserModelIDPtr)(PCWSTR AppID);
-
- SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr;
-
- HMODULE hDLL = ::LoadLibraryW(kShellLibraryName);
-
- funcAppUserModelID = (SetCurrentProcessExplicitAppUserModelIDPtr)
- GetProcAddress(hDLL, "SetCurrentProcessExplicitAppUserModelID");
-
- if (!funcAppUserModelID) {
- ::FreeLibrary(hDLL);
- return;
- }
-
- if (FAILED(funcAppUserModelID(aId.get()))) {
+ if (FAILED(SetCurrentProcessExplicitAppUserModelID(aId.get()))) {
NS_WARNING("SetCurrentProcessExplicitAppUserModelID failed for child process.");
}
-
- if (hDLL)
- ::FreeLibrary(hDLL);
}
#endif