Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(767)

Unified Diff: webrtc/modules/desktop_capture/window_capturer_win.cc

Issue 1371383003: WebRtc Win Desktop capture: ignore Win8+ Modern Apps' windows. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: review4 Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/desktop_capture/window_capturer_win.cc
diff --git a/webrtc/modules/desktop_capture/window_capturer_win.cc b/webrtc/modules/desktop_capture/window_capturer_win.cc
index ba45eaa9d18a78d15ee3ed0c6c285e76bf089eb1..322a5340c9e48c500de94a758c2790723a304a2d 100644
--- a/webrtc/modules/desktop_capture/window_capturer_win.cc
+++ b/webrtc/modules/desktop_capture/window_capturer_win.cc
@@ -13,6 +13,7 @@
#include <assert.h>
#include "webrtc/base/scoped_ptr.h"
+#include "webrtc/base/checks.h"
#include "webrtc/base/win32.h"
#include "webrtc/modules/desktop_capture/desktop_frame_win.h"
#include "webrtc/modules/desktop_capture/win/window_capture_utils.h"
@@ -39,13 +40,26 @@ BOOL CALLBACK WindowsEnumerationHandler(HWND hwnd, LPARAM param) {
// Skip the Program Manager window and the Start button.
const size_t kClassLength = 256;
WCHAR class_name[kClassLength];
- GetClassName(hwnd, class_name, kClassLength);
+ const int class_name_length = GetClassName(hwnd, class_name, kClassLength);
+ RTC_DCHECK(class_name_length)
+ << "Error retrieving the application's class name";
+
// Skip Program Manager window and the Start button. This is the same logic
// that's used in Win32WindowPicker in libjingle. Consider filtering other
// windows as well (e.g. toolbars).
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;
+ }
+
WindowCapturer::Window window;
window.id = reinterpret_cast<WindowCapturer::WindowId>(hwnd);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698