Index: webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.cc |
diff --git a/webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.cc b/webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.cc |
index 84579c4149d0790b6be4ba454e9321ddefe1300d..c6dffa8facb734d9cb62e6766056731c0b04b6dc 100644 |
--- a/webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.cc |
+++ b/webrtc/modules/desktop_capture/mac/full_screen_chrome_window_detector.cc |
@@ -15,7 +15,6 @@ |
#include <string> |
#include "webrtc/base/macutils.h" |
-#include "webrtc/modules/desktop_capture/mac/desktop_configuration.h" |
#include "webrtc/modules/desktop_capture/mac/window_list_utils.h" |
#include "webrtc/system_wrappers/include/logging.h" |
@@ -26,56 +25,6 @@ namespace { |
const int64_t kUpdateIntervalMs = 500; |
-// Returns true if the window is minimized. |
-bool IsWindowMinimized(CGWindowID id) { |
- CFArrayRef window_id_array = |
- CFArrayCreate(NULL, reinterpret_cast<const void **>(&id), 1, NULL); |
- CFArrayRef window_array = |
- CGWindowListCreateDescriptionFromArray(window_id_array); |
- bool minimized = false; |
- |
- if (window_array && CFArrayGetCount(window_array)) { |
- CFDictionaryRef window = reinterpret_cast<CFDictionaryRef>( |
- CFArrayGetValueAtIndex(window_array, 0)); |
- CFBooleanRef on_screen = reinterpret_cast<CFBooleanRef>( |
- CFDictionaryGetValue(window, kCGWindowIsOnscreen)); |
- |
- minimized = !on_screen; |
- } |
- |
- CFRelease(window_id_array); |
- CFRelease(window_array); |
- |
- return minimized; |
-} |
- |
-// Returns true if the window is occupying a full screen. |
-bool IsWindowFullScreen(const MacDesktopConfiguration& desktop_config, |
- CFDictionaryRef window) { |
- bool fullscreen = false; |
- |
- CFDictionaryRef bounds_ref = reinterpret_cast<CFDictionaryRef>( |
- CFDictionaryGetValue(window, kCGWindowBounds)); |
- |
- CGRect bounds; |
- if (bounds_ref && |
- CGRectMakeWithDictionaryRepresentation(bounds_ref, &bounds)) { |
- for (MacDisplayConfigurations::const_iterator it = |
- desktop_config.displays.begin(); |
- it != desktop_config.displays.end(); ++it) { |
- if (it->bounds.equals(DesktopRect::MakeXYWH(bounds.origin.x, |
- bounds.origin.y, |
- bounds.size.width, |
- bounds.size.height))) { |
- fullscreen = true; |
- break; |
- } |
- } |
- } |
- |
- return fullscreen; |
-} |
- |
std::string GetWindowTitle(CGWindowID id) { |
CFArrayRef window_id_array = |
CFArrayCreate(NULL, reinterpret_cast<const void **>(&id), 1, NULL); |
@@ -167,7 +116,8 @@ CGWindowID FindFullScreenWindowWithSamePidAndTitle(CGWindowID id) { |
CGWindowID window_id; |
CFNumberGetValue(window_id_ref, kCFNumberIntType, &window_id); |
- if (IsWindowFullScreen(desktop_config, window)) { |
+ if (FullScreenChromeWindowDetector::IsWindowFullScreen(desktop_config, |
+ window)) { |
full_screen_window = window_id; |
break; |
} |
@@ -222,6 +172,57 @@ CGWindowID FullScreenChromeWindowDetector::FindFullScreenWindow( |
return full_screen_window_id; |
} |
+// Returns true if the window is occupying a full screen. |
+bool FullScreenChromeWindowDetector::IsWindowFullScreen( |
+ const MacDesktopConfiguration& desktop_config, |
+ CFDictionaryRef window) { |
+ bool fullscreen = false; |
+ CFDictionaryRef bounds_ref = reinterpret_cast<CFDictionaryRef>( |
+ CFDictionaryGetValue(window, kCGWindowBounds)); |
+ |
+ CGRect bounds; |
+ if (bounds_ref && |
+ CGRectMakeWithDictionaryRepresentation(bounds_ref, &bounds)) { |
+ for (MacDisplayConfigurations::const_iterator it = |
+ desktop_config.displays.begin(); |
+ it != desktop_config.displays.end(); ++it) { |
+ if (it->bounds.equals(DesktopRect::MakeXYWH(bounds.origin.x, |
+ bounds.origin.y, |
+ bounds.size.width, |
+ bounds.size.height))) { |
+ fullscreen = true; |
+ break; |
+ } |
+ } |
+ } |
+ |
+ return fullscreen; |
+} |
+ |
+// Returns true if the window is minimized. |
+bool FullScreenChromeWindowDetector::IsWindowMinimized(CGWindowID id) { |
+ CFArrayRef window_id_array = |
+ CFArrayCreate(NULL, reinterpret_cast<const void **>(&id), 1, NULL); |
+ CFArrayRef window_array = |
+ CGWindowListCreateDescriptionFromArray(window_id_array); |
+ bool minimized = false; |
+ |
+ if (window_array && CFArrayGetCount(window_array)) { |
+ CFDictionaryRef window = reinterpret_cast<CFDictionaryRef>( |
+ CFArrayGetValueAtIndex(window_array, 0)); |
+ CFBooleanRef on_screen = reinterpret_cast<CFBooleanRef>( |
+ CFDictionaryGetValue(window, kCGWindowIsOnscreen)); |
+ |
+ minimized = !on_screen; |
+ } |
+ |
+ CFRelease(window_id_array); |
+ CFRelease(window_array); |
+ |
+ return minimized; |
+} |
+ |
+ |
void FullScreenChromeWindowDetector::UpdateWindowListIfNeeded( |
CGWindowID original_window) { |
if (IsChromeWindow(original_window) && |