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 <objbase.h> |
7 #include <shobjidl.h> | 8 #include <shobjidl.h> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "base/win/scoped_gdi_object.h" | 11 #include "base/win/scoped_gdi_object.h" |
11 #include "base/win/windows_version.h" | 12 #include "base/win/windows_version.h" |
12 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" | 13 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" |
13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
14 #include "ui/display/win/screen_win.h" | 15 #include "ui/display/win/screen_win.h" |
15 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 16 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
16 #include "ui/views/win/hwnd_util.h" | 17 #include "ui/views/win/hwnd_util.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 } | 194 } |
194 return false; | 195 return false; |
195 } | 196 } |
196 | 197 |
197 private: | 198 private: |
198 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 199 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
199 const std::set<HWND>& ignore) | 200 const std::set<HWND>& ignore) |
200 : BaseWindowFinder(ignore), | 201 : BaseWindowFinder(ignore), |
201 result_(NULL) { | 202 result_(NULL) { |
202 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { | 203 if (base::win::GetVersion() >= base::win::VERSION_WIN10) { |
203 CHECK(SUCCEEDED(virtual_desktop_manager_.CreateInstance( | 204 CHECK(SUCCEEDED(::CoCreateInstance( |
204 __uuidof(VirtualDesktopManager)))); | 205 __uuidof(VirtualDesktopManager), nullptr, CLSCTX_ALL, |
| 206 IID_PPV_ARGS(&virtual_desktop_manager_)))); |
205 } | 207 } |
206 screen_loc_ = display::win::ScreenWin::DIPToScreenPoint(screen_loc); | 208 screen_loc_ = display::win::ScreenWin::DIPToScreenPoint(screen_loc); |
207 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); | 209 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); |
208 } | 210 } |
209 | 211 |
210 // Position of the mouse in pixel coordinates. | 212 // Position of the mouse in pixel coordinates. |
211 gfx::Point screen_loc_; | 213 gfx::Point screen_loc_; |
212 | 214 |
213 // The resulting window. This is initially null but set to true in | 215 // The resulting window. This is initially null but set to true in |
214 // ShouldStopIterating if an appropriate window is found. | 216 // ShouldStopIterating if an appropriate window is found. |
(...skipping 21 matching lines...) Expand all Loading... |
236 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( | 238 gfx::NativeWindow WindowFinder::GetLocalProcessWindowAtPoint( |
237 const gfx::Point& screen_point, | 239 const gfx::Point& screen_point, |
238 const std::set<gfx::NativeWindow>& ignore) { | 240 const std::set<gfx::NativeWindow>& ignore) { |
239 gfx::NativeWindow mus_result = nullptr; | 241 gfx::NativeWindow mus_result = nullptr; |
240 if (GetLocalProcessWindowAtPointMus(screen_point, ignore, &mus_result)) | 242 if (GetLocalProcessWindowAtPointMus(screen_point, ignore, &mus_result)) |
241 return mus_result; | 243 return mus_result; |
242 | 244 |
243 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 245 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
244 screen_point, RemapIgnoreSet(ignore)); | 246 screen_point, RemapIgnoreSet(ignore)); |
245 } | 247 } |
OLD | NEW |