Chromium Code Reviews| Index: chrome/browser/ui/views/tabs/window_finder_mac.mm |
| diff --git a/chrome/browser/ui/views/tabs/window_finder_mac.mm b/chrome/browser/ui/views/tabs/window_finder_mac.mm |
| index 8c1a344f1348ac4adbdf94bd1358c51bd3ca2dab..9f8b7f2f5393e28715edcc8e91f7046f3d213e67 100644 |
| --- a/chrome/browser/ui/views/tabs/window_finder_mac.mm |
| +++ b/chrome/browser/ui/views/tabs/window_finder_mac.mm |
| @@ -4,9 +4,34 @@ |
| #include "chrome/browser/ui/views/tabs/window_finder.h" |
| +#import <AppKit/AppKit.h> |
| + |
| +#include "ui/gfx/geometry/point.h" |
| +#import "ui/gfx/mac/coordinate_conversion.h" |
| + |
| gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( |
| const gfx::Point& screen_point, |
| const std::set<gfx::NativeWindow>& ignore) { |
| - NOTIMPLEMENTED(); |
| - return NULL; |
| + NSPoint ns_point = gfx::ScreenPointToNSPoint(screen_point); |
| + |
| + // Note: [NSApp orderedWindows] doesn't include NSPanels. |
| + for (NSWindow* window : [NSApp orderedWindows]) { |
| + if (ignore.count(window)) |
| + continue; |
| + |
| + if (![window isOnActiveSpace]) |
| + continue; |
| + |
| + // NativeWidgetMac::Close() calls -orderOut: on NSWindows before actually |
| + // closing them. |
| + if (![window isVisible]) { |
|
tapted
2016/04/06 09:38:51
nit: no curlies
themblsha
2016/04/06 17:54:11
Done.
|
| + continue; |
| + } |
| + |
| + if (NSPointInRect(ns_point, [window frame])) { |
|
tapted
2016/04/06 09:38:51
nit: no curlies
themblsha
2016/04/06 17:54:11
Done.
|
| + return window; |
| + } |
| + } |
| + |
| + return nil; |
| } |