| 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 "ui/display/display.h" | 7 #include "ui/display/display.h" |
| 8 #include "ui/display/screen.h" | 8 #include "ui/display/screen.h" |
| 9 #include "ui/gfx/geometry/point_conversions.h" | 9 #include "ui/gfx/geometry/point_conversions.h" |
| 10 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 10 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 float GetDeviceScaleFactor() { | 14 float GetDeviceScaleFactor() { |
| 15 return display::Screen::GetScreen() | 15 return display::Screen::GetScreen() |
| 16 ->GetPrimaryDisplay() | 16 ->GetPrimaryDisplay() |
| 17 .device_scale_factor(); | 17 .device_scale_factor(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { | 20 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { |
| 21 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); | 21 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); |
| 22 } | 22 } |
| 23 | 23 |
| 24 } // anonymous namespace | 24 } // anonymous namespace |
| 25 | 25 |
| 26 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( | 26 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPointImpl( |
| 27 const gfx::Point& screen_point, | 27 const gfx::Point& screen_point, |
| 28 const std::set<gfx::NativeWindow>& ignore) { | 28 const std::set<gfx::NativeWindow>& ignore) { |
| 29 // The X11 server is the canonical state of what the window stacking order | 29 // The X11 server is the canonical state of what the window stacking order is. |
| 30 // is. | |
| 31 views::X11TopmostWindowFinder finder; | 30 views::X11TopmostWindowFinder finder; |
| 32 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); | 31 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); |
| 33 } | 32 } |
| OLD | NEW |