OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/tabs/window_finder.h" | 5 #include "chrome/browser/ui/views/tabs/window_finder.h" |
6 | 6 |
| 7 #include <AppKit/AppKit.h> |
| 8 |
| 9 #include "ui/gfx/geometry/point.h" |
| 10 |
7 gfx::NativeWindow GetLocalProcessWindowAtPoint( | 11 gfx::NativeWindow GetLocalProcessWindowAtPoint( |
8 const gfx::Point& screen_point, | 12 const gfx::Point& screen_point, |
9 const std::set<gfx::NativeWindow>& ignore) { | 13 const std::set<gfx::NativeWindow>& ignore) { |
10 NOTIMPLEMENTED(); | 14 NSPoint ns_point = NSMakePoint( |
11 return NULL; | 15 screen_point.x(), |
| 16 NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - screen_point.y() |
| 17 ); |
| 18 |
| 19 // Note [NSApp orderedWindows] doesn't include NSPanels. |
| 20 for (NSWindow* window : [NSApp orderedWindows]) { |
| 21 if (ignore.count(window)) |
| 22 continue; |
| 23 |
| 24 if (![window isOnActiveSpace]) |
| 25 continue; |
| 26 |
| 27 if (NSPointInRect(ns_point, [window frame])) { |
| 28 NSLog(@"found: %@ at %@", window, NSStringFromPoint(ns_point)); |
| 29 return window; |
| 30 } |
| 31 } |
| 32 |
| 33 NSLog(@"(nothing at %@)", NSStringFromPoint(ns_point)); |
| 34 return nil; |
12 } | 35 } |
OLD | NEW |