| 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/dpi.h" |
| 10 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.h" |
| 11 #include "ui/gfx/win/dpi.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 aura::Window* GetLocalProcessWindowAtPointAsh( | 16 aura::Window* GetLocalProcessWindowAtPointAsh( |
| 17 const gfx::Point& screen_point, | 17 const gfx::Point& screen_point, |
| 18 const std::set<aura::Window*>& ignore); | 18 const std::set<aura::Window*>& 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::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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 return true; | 184 return true; |
| 185 } | 185 } |
| 186 return false; | 186 return false; |
| 187 } | 187 } |
| 188 | 188 |
| 189 private: | 189 private: |
| 190 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 190 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
| 191 const std::set<HWND>& ignore) | 191 const std::set<HWND>& ignore) |
| 192 : BaseWindowFinder(ignore), | 192 : BaseWindowFinder(ignore), |
| 193 result_(NULL) { | 193 result_(NULL) { |
| 194 screen_loc_ = gfx::win::DIPToScreenPoint(screen_loc); | 194 screen_loc_ = gfx::DIPToScreenPoint(screen_loc); |
| 195 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); | 195 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); |
| 196 } | 196 } |
| 197 | 197 |
| 198 // Position of the mouse in pixel coordinates. | 198 // Position of the mouse in pixel coordinates. |
| 199 gfx::Point screen_loc_; | 199 gfx::Point screen_loc_; |
| 200 | 200 |
| 201 // The resulting window. This is initially null but set to true in | 201 // The resulting window. This is initially null but set to true in |
| 202 // ShouldStopIterating if an appropriate window is found. | 202 // ShouldStopIterating if an appropriate window is found. |
| 203 HWND result_; | 203 HWND result_; |
| 204 | 204 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 222 chrome::HostDesktopType host_desktop_type, | 222 chrome::HostDesktopType host_desktop_type, |
| 223 const gfx::Point& screen_point, | 223 const gfx::Point& screen_point, |
| 224 const std::set<aura::Window*>& ignore) { | 224 const std::set<aura::Window*>& ignore) { |
| 225 #if defined(USE_ASH) | 225 #if defined(USE_ASH) |
| 226 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 226 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
| 227 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 227 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
| 228 #endif | 228 #endif |
| 229 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 229 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
| 230 screen_point, RemapIgnoreSet(ignore)); | 230 screen_point, RemapIgnoreSet(ignore)); |
| 231 } | 231 } |
| OLD | NEW |