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> |
| 8 |
7 #include "base/win/scoped_gdi_object.h" | 9 #include "base/win/scoped_gdi_object.h" |
8 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
9 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
10 #include "ui/gfx/screen.h" | 12 #include "ui/gfx/screen.h" |
11 #include "ui/gfx/win/dpi.h" | 13 #include "ui/gfx/win/dpi.h" |
12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 14 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
13 #include "ui/views/win/hwnd_util.h" | 15 #include "ui/views/win/hwnd_util.h" |
14 | 16 |
15 #if defined(USE_ASH) | 17 #if defined(USE_ASH) |
16 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( | 18 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // in ShouldStopIterating if target_ is passed in. | 145 // in ShouldStopIterating if target_ is passed in. |
144 bool is_top_most_; | 146 bool is_top_most_; |
145 | 147 |
146 base::win::ScopedRegion tmp_region_; | 148 base::win::ScopedRegion tmp_region_; |
147 | 149 |
148 DISALLOW_COPY_AND_ASSIGN(TopMostFinder); | 150 DISALLOW_COPY_AND_ASSIGN(TopMostFinder); |
149 }; | 151 }; |
150 | 152 |
151 // LocalProcessWindowFinder --------------------------------------------------- | 153 // LocalProcessWindowFinder --------------------------------------------------- |
152 | 154 |
153 // Copied from ShObjIdl.h in 10.0.10240.0 SDK. This can be removed once we | |
154 // update to the newer SDK. | |
155 #if NTDDI_VERSION < 0x0A000000 | |
156 class DECLSPEC_UUID("aa509086-5ca9-4c25-8f95-589d3c07b48a") | |
157 VirtualDesktopManager; | |
158 | |
159 MIDL_INTERFACE("a5cd92ff-29be-454c-8d04-d82879fb3f1b") | |
160 IVirtualDesktopManager : public IUnknown { | |
161 public: | |
162 virtual HRESULT STDMETHODCALLTYPE IsWindowOnCurrentVirtualDesktop( | |
163 /* [in] */ __RPC__in HWND topLevelWindow, | |
164 /* [out] */ __RPC__out BOOL * onCurrentDesktop) = 0; | |
165 | |
166 virtual HRESULT STDMETHODCALLTYPE GetWindowDesktopId( | |
167 /* [in] */ __RPC__in HWND topLevelWindow, | |
168 /* [out] */ __RPC__out GUID * desktopId) = 0; | |
169 | |
170 virtual HRESULT STDMETHODCALLTYPE MoveWindowToDesktop( | |
171 /* [in] */ __RPC__in HWND topLevelWindow, | |
172 /* [in] */ __RPC__in REFGUID desktopId) = 0; | |
173 }; | |
174 #endif // NTDDI_VERSION < 0x0A000000 | |
175 | |
176 // Helper class to determine if a particular point contains a window from our | 155 // Helper class to determine if a particular point contains a window from our |
177 // process. | 156 // process. |
178 class LocalProcessWindowFinder : public BaseWindowFinder { | 157 class LocalProcessWindowFinder : public BaseWindowFinder { |
179 public: | 158 public: |
180 // Returns the hwnd from our process at screen_loc that is not obscured by | 159 // Returns the hwnd from our process at screen_loc that is not obscured by |
181 // another window. Returns NULL otherwise. | 160 // another window. Returns NULL otherwise. |
182 static gfx::NativeWindow GetProcessWindowAtPoint( | 161 static gfx::NativeWindow GetProcessWindowAtPoint( |
183 const gfx::Point& screen_loc, | 162 const gfx::Point& screen_loc, |
184 const std::set<HWND>& ignore) { | 163 const std::set<HWND>& ignore) { |
185 LocalProcessWindowFinder finder(screen_loc, ignore); | 164 LocalProcessWindowFinder finder(screen_loc, ignore); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 chrome::HostDesktopType host_desktop_type, | 242 chrome::HostDesktopType host_desktop_type, |
264 const gfx::Point& screen_point, | 243 const gfx::Point& screen_point, |
265 const std::set<gfx::NativeWindow>& ignore) { | 244 const std::set<gfx::NativeWindow>& ignore) { |
266 #if defined(USE_ASH) | 245 #if defined(USE_ASH) |
267 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 246 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
268 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 247 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
269 #endif | 248 #endif |
270 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 249 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
271 screen_point, RemapIgnoreSet(ignore)); | 250 screen_point, RemapIgnoreSet(ignore)); |
272 } | 251 } |
OLD | NEW |