summaryrefslogtreecommitdiffstats
path: root/widget/windows
diff options
context:
space:
mode:
Diffstat (limited to 'widget/windows')
-rw-r--r--widget/windows/WinTaskbar.cpp47
1 files changed, 4 insertions, 43 deletions
diff --git a/widget/windows/WinTaskbar.cpp b/widget/windows/WinTaskbar.cpp
index a2c553dea..530cfd5b9 100644
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -34,8 +34,6 @@
#include <propkey.h>
#include <shellapi.h>
-const wchar_t kShellLibraryName[] = L"shell32.dll";
-
static NS_DEFINE_CID(kJumpListBuilderCID, NS_WIN_JUMPLISTBUILDER_CID);
namespace {
@@ -77,30 +75,14 @@ SetWindowAppUserModelProp(mozIDOMWindow *aParent,
if (!toplevelHWND)
return NS_ERROR_INVALID_ARG;
- typedef HRESULT (WINAPI * SHGetPropertyStoreForWindowPtr)
- (HWND hwnd, REFIID riid, void** ppv);
- SHGetPropertyStoreForWindowPtr funcGetProStore = nullptr;
-
- HMODULE hDLL = ::LoadLibraryW(kShellLibraryName);
- funcGetProStore = (SHGetPropertyStoreForWindowPtr)
- GetProcAddress(hDLL, "SHGetPropertyStoreForWindow");
-
- if (!funcGetProStore) {
- FreeLibrary(hDLL);
- return NS_ERROR_NO_INTERFACE;
- }
-
- IPropertyStore* pPropStore;
- if (FAILED(funcGetProStore(toplevelHWND,
- IID_PPV_ARGS(&pPropStore)))) {
- FreeLibrary(hDLL);
+ RefPtr<IPropertyStore> pPropStore;
+ if (FAILED(SHGetPropertyStoreForWindow(toplevelHWND, IID_IPropertyStore,
+ getter_AddRefs(pPropStore)))) {
return NS_ERROR_INVALID_ARG;
}
PROPVARIANT pv;
if (FAILED(InitPropVariantFromString(aIdentifier.get(), &pv))) {
- pPropStore->Release();
- FreeLibrary(hDLL);
return NS_ERROR_UNEXPECTED;
}
@@ -111,8 +93,6 @@ SetWindowAppUserModelProp(mozIDOMWindow *aParent,
}
PropVariantClear(&pv);
- pPropStore->Release();
- FreeLibrary(hDLL);
return rv;
}
@@ -339,30 +319,11 @@ WinTaskbar::GetDefaultGroupId(nsAString & aDefaultGroupId) {
// (static) Called from AppShell
bool
WinTaskbar::RegisterAppUserModelID() {
- SetCurrentProcessExplicitAppUserModelIDPtr funcAppUserModelID = nullptr;
- bool retVal = false;
-
nsAutoString uid;
if (!GetAppUserModelID(uid))
return false;
- HMODULE hDLL = ::LoadLibraryW(kShellLibraryName);
-
- funcAppUserModelID = (SetCurrentProcessExplicitAppUserModelIDPtr)
- GetProcAddress(hDLL, "SetCurrentProcessExplicitAppUserModelID");
-
- if (!funcAppUserModelID) {
- ::FreeLibrary(hDLL);
- return false;
- }
-
- if (SUCCEEDED(funcAppUserModelID(uid.get())))
- retVal = true;
-
- if (hDLL)
- ::FreeLibrary(hDLL);
-
- return retVal;
+ return SUCCEEDED(SetCurrentProcessExplicitAppUserModelID(uid.get()));
}
NS_IMETHODIMP