| 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 "base/win/scoped_gdi_object.h" | 7 #include "base/win/scoped_gdi_object.h" |
| 8 #include "base/win/windows_version.h" | 8 #include "base/win/windows_version.h" |
| 9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 10 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
| 11 #include "ui/gfx/win/dpi.h" | 11 #include "ui/gfx/screen_win.h" |
| 12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 13 #include "ui/views/win/hwnd_util.h" | 13 #include "ui/views/win/hwnd_util.h" |
| 14 | 14 |
| 15 #if defined(USE_ASH) | 15 #if defined(USE_ASH) |
| 16 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( | 16 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( |
| 17 const gfx::Point& screen_point, | 17 const gfx::Point& screen_point, |
| 18 const std::set<gfx::NativeWindow>& ignore); | 18 const std::set<gfx::NativeWindow>& ignore); |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 TopMostFinder(HWND window, | 125 TopMostFinder(HWND window, |
| 126 const gfx::Point& screen_loc, | 126 const gfx::Point& screen_loc, |
| 127 const std::set<HWND>& ignore) | 127 const std::set<HWND>& ignore) |
| 128 : BaseWindowFinder(ignore), | 128 : BaseWindowFinder(ignore), |
| 129 target_(window), | 129 target_(window), |
| 130 is_top_most_(false), | 130 is_top_most_(false), |
| 131 tmp_region_(CreateRectRgn(0, 0, 0, 0)) { | 131 tmp_region_(CreateRectRgn(0, 0, 0, 0)) { |
| 132 screen_loc_ = gfx::win::DIPToScreenPoint(screen_loc); | 132 screen_loc_ = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
| 133 EnumWindows(WindowCallbackProc, as_lparam()); | 133 EnumWindows(WindowCallbackProc, as_lparam()); |
| 134 } | 134 } |
| 135 | 135 |
| 136 // The window we're looking for. | 136 // The window we're looking for. |
| 137 HWND target_; | 137 HWND target_; |
| 138 | 138 |
| 139 // Location of window to find in pixel coordinates. | 139 // Location of window to find in pixel coordinates. |
| 140 gfx::Point screen_loc_; | 140 gfx::Point screen_loc_; |
| 141 | 141 |
| 142 // Is target_ the top most window? This is initially false but set to true | 142 // Is target_ the top most window? This is initially false but set to true |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 222 |
| 223 private: | 223 private: |
| 224 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 224 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
| 225 const std::set<HWND>& ignore) | 225 const std::set<HWND>& ignore) |
| 226 : BaseWindowFinder(ignore), | 226 : BaseWindowFinder(ignore), |
| 227 result_(NULL) { | 227 result_(NULL) { |
| 228 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { | 228 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
| 229 CHECK(SUCCEEDED(virtual_desktop_manager_.CreateInstance( | 229 CHECK(SUCCEEDED(virtual_desktop_manager_.CreateInstance( |
| 230 __uuidof(VirtualDesktopManager)))); | 230 __uuidof(VirtualDesktopManager)))); |
| 231 } | 231 } |
| 232 screen_loc_ = gfx::win::DIPToScreenPoint(screen_loc); | 232 screen_loc_ = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
| 233 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); | 233 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 // Position of the mouse in pixel coordinates. | 236 // Position of the mouse in pixel coordinates. |
| 237 gfx::Point screen_loc_; | 237 gfx::Point screen_loc_; |
| 238 | 238 |
| 239 // The resulting window. This is initially null but set to true in | 239 // The resulting window. This is initially null but set to true in |
| 240 // ShouldStopIterating if an appropriate window is found. | 240 // ShouldStopIterating if an appropriate window is found. |
| 241 HWND result_; | 241 HWND result_; |
| 242 | 242 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 263 chrome::HostDesktopType host_desktop_type, | 263 chrome::HostDesktopType host_desktop_type, |
| 264 const gfx::Point& screen_point, | 264 const gfx::Point& screen_point, |
| 265 const std::set<gfx::NativeWindow>& ignore) { | 265 const std::set<gfx::NativeWindow>& ignore) { |
| 266 #if defined(USE_ASH) | 266 #if defined(USE_ASH) |
| 267 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 267 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
| 268 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 268 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
| 269 #endif | 269 #endif |
| 270 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 270 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
| 271 screen_point, RemapIgnoreSet(ignore)); | 271 screen_point, RemapIgnoreSet(ignore)); |
| 272 } | 272 } |
| OLD | NEW |