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 <shobjidl.h> | 7 #include <shobjidl.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/win/scoped_gdi_object.h" | 10 #include "base/win/scoped_gdi_object.h" |
11 #include "base/win/windows_version.h" | 11 #include "base/win/windows_version.h" |
12 #include "ui/aura/window.h" | 12 #include "ui/aura/window.h" |
13 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
14 #include "ui/gfx/win/dpi.h" | 14 #include "ui/gfx/screen_win.h" |
15 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 15 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
16 #include "ui/views/win/hwnd_util.h" | 16 #include "ui/views/win/hwnd_util.h" |
17 | 17 |
18 #if defined(USE_ASH) | 18 #if defined(USE_ASH) |
19 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( | 19 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( |
20 const gfx::Point& screen_point, | 20 const gfx::Point& screen_point, |
21 const std::set<gfx::NativeWindow>& ignore); | 21 const std::set<gfx::NativeWindow>& ignore); |
22 #endif | 22 #endif |
23 | 23 |
24 namespace { | 24 namespace { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 private: | 127 private: |
128 TopMostFinder(HWND window, | 128 TopMostFinder(HWND window, |
129 const gfx::Point& screen_loc, | 129 const gfx::Point& screen_loc, |
130 const std::set<HWND>& ignore) | 130 const std::set<HWND>& ignore) |
131 : BaseWindowFinder(ignore), | 131 : BaseWindowFinder(ignore), |
132 target_(window), | 132 target_(window), |
133 is_top_most_(false), | 133 is_top_most_(false), |
134 tmp_region_(CreateRectRgn(0, 0, 0, 0)) { | 134 tmp_region_(CreateRectRgn(0, 0, 0, 0)) { |
135 screen_loc_ = gfx::win::DIPToScreenPoint(screen_loc); | 135 screen_loc_ = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
136 EnumWindows(WindowCallbackProc, as_lparam()); | 136 EnumWindows(WindowCallbackProc, as_lparam()); |
137 } | 137 } |
138 | 138 |
139 // The window we're looking for. | 139 // The window we're looking for. |
140 HWND target_; | 140 HWND target_; |
141 | 141 |
142 // Location of window to find in pixel coordinates. | 142 // Location of window to find in pixel coordinates. |
143 gfx::Point screen_loc_; | 143 gfx::Point screen_loc_; |
144 | 144 |
145 // Is target_ the top most window? This is initially false but set to true | 145 // Is target_ the top most window? This is initially false but set to true |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 | 202 |
203 private: | 203 private: |
204 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 204 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
205 const std::set<HWND>& ignore) | 205 const std::set<HWND>& ignore) |
206 : BaseWindowFinder(ignore), | 206 : BaseWindowFinder(ignore), |
207 result_(NULL) { | 207 result_(NULL) { |
208 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { | 208 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
209 CHECK(SUCCEEDED(virtual_desktop_manager_.CreateInstance( | 209 CHECK(SUCCEEDED(virtual_desktop_manager_.CreateInstance( |
210 __uuidof(VirtualDesktopManager)))); | 210 __uuidof(VirtualDesktopManager)))); |
211 } | 211 } |
212 screen_loc_ = gfx::win::DIPToScreenPoint(screen_loc); | 212 screen_loc_ = gfx::ScreenWin::DIPToScreenPoint(screen_loc); |
213 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); | 213 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); |
214 } | 214 } |
215 | 215 |
216 // Position of the mouse in pixel coordinates. | 216 // Position of the mouse in pixel coordinates. |
217 gfx::Point screen_loc_; | 217 gfx::Point screen_loc_; |
218 | 218 |
219 // The resulting window. This is initially null but set to true in | 219 // The resulting window. This is initially null but set to true in |
220 // ShouldStopIterating if an appropriate window is found. | 220 // ShouldStopIterating if an appropriate window is found. |
221 HWND result_; | 221 HWND result_; |
222 | 222 |
(...skipping 20 matching lines...) Expand all Loading... |
243 chrome::HostDesktopType host_desktop_type, | 243 chrome::HostDesktopType host_desktop_type, |
244 const gfx::Point& screen_point, | 244 const gfx::Point& screen_point, |
245 const std::set<gfx::NativeWindow>& ignore) { | 245 const std::set<gfx::NativeWindow>& ignore) { |
246 #if defined(USE_ASH) | 246 #if defined(USE_ASH) |
247 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 247 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
248 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 248 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
249 #endif | 249 #endif |
250 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 250 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
251 screen_point, RemapIgnoreSet(ignore)); | 251 screen_point, RemapIgnoreSet(ignore)); |
252 } | 252 } |
OLD | NEW |