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

Side by Side Diff: webrtc/modules/desktop_capture/window_capturer_mac.mm

Issue 1579213007: Enable fullscreen windows to be shown in mac window share picker (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added missing comment Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 window_id_(0), 75 window_id_(0),
76 full_screen_chrome_window_detector_(full_screen_chrome_window_detector) { 76 full_screen_chrome_window_detector_(full_screen_chrome_window_detector) {
77 } 77 }
78 78
79 WindowCapturerMac::~WindowCapturerMac() { 79 WindowCapturerMac::~WindowCapturerMac() {
80 } 80 }
81 81
82 bool WindowCapturerMac::GetWindowList(WindowList* windows) { 82 bool WindowCapturerMac::GetWindowList(WindowList* windows) {
83 // Only get on screen, non-desktop windows. 83 // Only get on screen, non-desktop windows.
84 CFArrayRef window_array = CGWindowListCopyWindowInfo( 84 CFArrayRef window_array = CGWindowListCopyWindowInfo(
85 kCGWindowListOptionOnScreenOnly | kCGWindowListExcludeDesktopElements, 85 kCGWindowListOptionAll | kCGWindowListExcludeDesktopElements,
86 kCGNullWindowID); 86 kCGNullWindowID);
87 if (!window_array) 87 if (!window_array)
88 return false; 88 return false;
89 89 MacDesktopConfiguration desktop_config = MacDesktopConfiguration::GetCurrent(
90 MacDesktopConfiguration::TopLeftOrigin);
90 // Check windows to make sure they have an id, title, and use window layer 91 // Check windows to make sure they have an id, title, and use window layer
91 // other than 0. 92 // other than 0.
92 CFIndex count = CFArrayGetCount(window_array); 93 CFIndex count = CFArrayGetCount(window_array);
93 for (CFIndex i = 0; i < count; ++i) { 94 for (CFIndex i = 0; i < count; ++i) {
94 CFDictionaryRef window = reinterpret_cast<CFDictionaryRef>( 95 CFDictionaryRef window = reinterpret_cast<CFDictionaryRef>(
95 CFArrayGetValueAtIndex(window_array, i)); 96 CFArrayGetValueAtIndex(window_array, i));
96 CFStringRef window_title = reinterpret_cast<CFStringRef>( 97 CFStringRef window_title = reinterpret_cast<CFStringRef>(
97 CFDictionaryGetValue(window, kCGWindowName)); 98 CFDictionaryGetValue(window, kCGWindowName));
98 CFNumberRef window_id = reinterpret_cast<CFNumberRef>( 99 CFNumberRef window_id = reinterpret_cast<CFNumberRef>(
99 CFDictionaryGetValue(window, kCGWindowNumber)); 100 CFDictionaryGetValue(window, kCGWindowNumber));
100 CFNumberRef window_layer = reinterpret_cast<CFNumberRef>( 101 CFNumberRef window_layer = reinterpret_cast<CFNumberRef>(
101 CFDictionaryGetValue(window, kCGWindowLayer)); 102 CFDictionaryGetValue(window, kCGWindowLayer));
102 if (window_title && window_id && window_layer) { 103 if (window_title && window_id && window_layer) {
103 // Skip windows with layer=0 (menu, dock). 104 // Skip windows with layer=0 (menu, dock).
104 int layer; 105 int layer;
105 CFNumberGetValue(window_layer, kCFNumberIntType, &layer); 106 CFNumberGetValue(window_layer, kCFNumberIntType, &layer);
106 if (layer != 0) 107 if (layer != 0)
107 continue; 108 continue;
108 109
109 int id; 110 int id;
110 CFNumberGetValue(window_id, kCFNumberIntType, &id); 111 CFNumberGetValue(window_id, kCFNumberIntType, &id);
112
113 // Skip windows that are minimized.
114 bool fullScreen = FullScreenChromeWindowDetector::IsWindowFullScreen(
115 desktop_config,
116 window);
117 bool minimized = FullScreenChromeWindowDetector::IsWindowMinimized(id);
118 if (!fullScreen && minimized) {
119 continue;
GeorgeZ 2016/01/13 21:35:31 My understanding is that when a window is full scr
niklas.enbom 2016/01/13 21:56:45 Acknowledged.
120 }
121
111 WindowCapturer::Window window; 122 WindowCapturer::Window window;
112 window.id = id; 123 window.id = id;
113 if (!rtc::ToUtf8(window_title, &(window.title)) || 124 if (!rtc::ToUtf8(window_title, &(window.title)) ||
114 window.title.empty()) { 125 window.title.empty()) {
115 continue; 126 continue;
116 } 127 }
117 windows->push_back(window); 128 windows->push_back(window);
118 } 129 }
119 } 130 }
120 131
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 243 }
233 244
234 } // namespace 245 } // namespace
235 246
236 // static 247 // static
237 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { 248 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) {
238 return new WindowCapturerMac(options.full_screen_chrome_window_detector()); 249 return new WindowCapturerMac(options.full_screen_chrome_window_detector());
239 } 250 }
240 251
241 } // namespace webrtc 252 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698