Can list UWP applications

Before the CL [1] https://webrtc-review.googlesource.com/c/src/+/144960
the UWP applications could not be captured so they were filtered out.

Another reason of this previous filter was because otherwise some
'ghost windows' are listed too. These 'ghost windows' are prelaunched
UWP apps whose windows are created in a hidden/cloaked state to improve
perceived performance of launching these apps later, see:
[2] https://docs.microsoft.com/en-us/windows/uwp/launch-resume/handle-app-prelaunch

They can be filtered out using the new API merged recently
'webrtc::WindowCaptureHelperWin::IsWindowCloaked, see:
[3] https://webrtc-review.googlesource.com/c/src/+/143980

This patch allows non-cloaked UWP apps to be listed by taking advantage
of CL [3]. So that user can select them with the app window picker and can
then share them thanks to [1].

Bug: chromium:700037
Change-Id: I4b41bb764ebbd6e2f164f036a63a4b1cd06c3f2f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160021
Reviewed-by: Jamie Walch <jamiewalch@chromium.org>
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#29868}
This commit is contained in:
Julien Isorce 2019-11-20 10:04:51 -08:00 committed by Commit Bot
parent b0df593e56
commit 0174ffe700

View File

@ -66,16 +66,6 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
if (wcscmp(class_name, L"Progman") == 0 || wcscmp(class_name, L"Button") == 0)
return TRUE;
// Windows 8 introduced a "Modern App" identified by their class name being
// either ApplicationFrameWindow or windows.UI.Core.coreWindow. The
// associated windows cannot be captured, so we skip them.
// http://crbug.com/526883.
if (rtc::IsWindows8OrLater() &&
(wcscmp(class_name, L"ApplicationFrameWindow") == 0 ||
wcscmp(class_name, L"Windows.UI.Core.CoreWindow") == 0)) {
return TRUE;
}
DesktopCapturer::Source window;
window.id = reinterpret_cast<WindowId>(hwnd);
@ -208,7 +198,7 @@ bool WindowCapturerWin::GetSourceList(SourceList* sources) {
return false;
for (auto it = result.begin(); it != result.end();) {
if (!window_capture_helper_.IsWindowOnCurrentDesktop(
if (!window_capture_helper_.IsWindowVisibleOnCurrentDesktop(
reinterpret_cast<HWND>(it->id))) {
it = result.erase(it);
} else {