| 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/gfx/geometry/point_conversions.h" | 7 #include "ui/gfx/geometry/point_conversions.h" |
| 8 #include "ui/gfx/screen.h" | 8 #include "ui/gfx/screen.h" |
| 9 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 9 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 float GetDeviceScaleFactor() { | 13 float GetDeviceScaleFactor() { |
| 14 gfx::Display display = gfx::Screen::GetNativeScreen()->GetPrimaryDisplay(); | 14 return gfx::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor(); |
| 15 return display.device_scale_factor(); | |
| 16 } | 15 } |
| 17 | 16 |
| 18 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { | 17 gfx::Point DIPToPixelPoint(const gfx::Point& dip_point) { |
| 19 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); | 18 return gfx::ScaleToFlooredPoint(dip_point, GetDeviceScaleFactor()); |
| 20 } | 19 } |
| 21 | 20 |
| 22 } // anonymous namespace | 21 } // anonymous namespace |
| 23 | 22 |
| 24 #if defined(USE_ASH) | 23 #if defined(USE_ASH) |
| 25 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( | 24 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( |
| 26 const gfx::Point& screen_point, | 25 const gfx::Point& screen_point, |
| 27 const std::set<gfx::NativeWindow>& ignore); | 26 const std::set<gfx::NativeWindow>& ignore); |
| 28 #endif | 27 #endif |
| 29 | 28 |
| 30 gfx::NativeWindow GetLocalProcessWindowAtPoint( | 29 gfx::NativeWindow GetLocalProcessWindowAtPoint( |
| 31 chrome::HostDesktopType host_desktop_type, | 30 chrome::HostDesktopType host_desktop_type, |
| 32 const gfx::Point& screen_point, | 31 const gfx::Point& screen_point, |
| 33 const std::set<gfx::NativeWindow>& ignore) { | 32 const std::set<gfx::NativeWindow>& ignore) { |
| 34 #if defined(USE_ASH) | 33 #if defined(USE_ASH) |
| 35 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 34 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
| 36 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 35 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
| 37 #endif | 36 #endif |
| 38 | 37 |
| 39 // The X11 server is the canonical state of what the window stacking order | 38 // The X11 server is the canonical state of what the window stacking order |
| 40 // is. | 39 // is. |
| 41 views::X11TopmostWindowFinder finder; | 40 views::X11TopmostWindowFinder finder; |
| 42 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); | 41 return finder.FindLocalProcessWindowAt(DIPToPixelPoint(screen_point), ignore); |
| 43 } | 42 } |
| OLD | NEW |