Commit 933cf169 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Commit Bot

Win Native Notifications: Fix window activation.

This fixes the issue with window activation not functioning correctly
when notifications are activated while Chrome is running but in the
background.

Bug: 837796, 734095
Change-Id: I8eac14403850a13d60e7a50c3c795fed96205d7e
Reviewed-on: https://chromium-review.googlesource.com/1049984Reviewed-by: default avatarGreg Thompson <grt@chromium.org>
Commit-Queue: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556955}
parent fd312950
......@@ -77,7 +77,8 @@ HRESULT NotificationActivator::Activate(
SHELLEXECUTEINFO info;
memset(&info, 0, sizeof(info));
info.cbSize = sizeof(info);
info.fMask = SEE_MASK_NOASYNC | SEE_MASK_FLAG_LOG_USAGE;
info.fMask =
SEE_MASK_NOASYNC | SEE_MASK_FLAG_LOG_USAGE | SEE_MASK_NOCLOSEPROCESS;
info.lpFile = chrome_exe_path.value().c_str();
info.lpParameters = params.c_str();
info.nShow = SW_SHOWNORMAL;
......@@ -88,6 +89,18 @@ HRESULT NotificationActivator::Activate(
return HRESULT_FROM_WIN32(error_code);
}
if (info.hProcess != NULL) {
DWORD pid = ::GetProcessId(info.hProcess);
if (!::AllowSetForegroundWindow(pid)) {
DWORD error_code = ::GetLastError();
Trace(L"Unable to forward activation privilege; error: 0x%08X\n",
error_code);
return HRESULT_FROM_WIN32(error_code);
}
CloseHandle(info.hProcess);
}
return S_OK;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment