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

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: formatting 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
« no previous file with comments | « webrtc/modules/desktop_capture/mac/window_list_utils.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 and not full screen.
114 if (IsWindowMinimized(id) &&
115 !IsWindowFullScreen(desktop_config, window)) { continue;}
Sergey Ulanov 2016/01/20 00:16:25 nit: move continue to a separate line. It's allowe
116
111 WindowCapturer::Window window; 117 WindowCapturer::Window window;
112 window.id = id; 118 window.id = id;
113 if (!rtc::ToUtf8(window_title, &(window.title)) || 119 if (!rtc::ToUtf8(window_title, &(window.title)) ||
114 window.title.empty()) { 120 window.title.empty()) {
115 continue; 121 continue;
116 } 122 }
117 windows->push_back(window); 123 windows->push_back(window);
118 } 124 }
119 } 125 }
120 126
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 } 238 }
233 239
234 } // namespace 240 } // namespace
235 241
236 // static 242 // static
237 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { 243 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) {
238 return new WindowCapturerMac(options.full_screen_chrome_window_detector()); 244 return new WindowCapturerMac(options.full_screen_chrome_window_detector());
239 } 245 }
240 246
241 } // namespace webrtc 247 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/desktop_capture/mac/window_list_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698