Chromium Code Reviews| 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/views/widget/desktop_aura/desktop_window_tree_host_win.h" | 12 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h" |
| 12 #include "ui/views/win/hwnd_util.h" | 13 #include "ui/views/win/hwnd_util.h" |
| 13 | 14 |
| 14 #if defined(USE_ASH) | 15 #if defined(USE_ASH) |
| 15 aura::Window* GetLocalProcessWindowAtPointAsh( | 16 aura::Window* GetLocalProcessWindowAtPointAsh( |
| 16 const gfx::Point& screen_point, | 17 const gfx::Point& screen_point, |
| 17 const std::set<aura::Window*>& ignore); | 18 const std::set<aura::Window*>& ignore); |
| 18 #endif | 19 #endif |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 | 152 |
| 152 // Helper class to determine if a particular point contains a window from our | 153 // Helper class to determine if a particular point contains a window from our |
| 153 // process. | 154 // process. |
| 154 class LocalProcessWindowFinder : public BaseWindowFinder { | 155 class LocalProcessWindowFinder : public BaseWindowFinder { |
| 155 public: | 156 public: |
| 156 // Returns the hwnd from our process at screen_loc that is not obscured by | 157 // Returns the hwnd from our process at screen_loc that is not obscured by |
| 157 // another window. Returns NULL otherwise. | 158 // another window. Returns NULL otherwise. |
| 158 static gfx::NativeWindow GetProcessWindowAtPoint( | 159 static gfx::NativeWindow GetProcessWindowAtPoint( |
| 159 const gfx::Point& screen_loc, | 160 const gfx::Point& screen_loc, |
| 160 const std::set<HWND>& ignore) { | 161 const std::set<HWND>& ignore) { |
| 161 LocalProcessWindowFinder finder(screen_loc, ignore); | 162 gfx::Point screen_loc_in_pixels = gfx::win::DIPToScreenPoint(screen_loc); |
| 163 LocalProcessWindowFinder finder(screen_loc_in_pixels, ignore); | |
|
sky
2014/04/28 13:44:48
Can we make LocalProcessWindowFinder and TopMostFi
ananta
2014/04/28 18:13:08
Done. Changed to continue passing in screen coordi
| |
| 162 // Windows 8 has a window that appears first in the list of iterated | 164 // Windows 8 has a window that appears first in the list of iterated |
| 163 // windows, yet is not visually on top of everything. | 165 // windows, yet is not visually on top of everything. |
| 164 // TODO(sky): figure out a better way to ignore this window. | 166 // TODO(sky): figure out a better way to ignore this window. |
| 165 if (finder.result_ && | 167 if (finder.result_ && |
| 166 ((base::win::OSInfo::GetInstance()->version() >= | 168 ((base::win::OSInfo::GetInstance()->version() >= |
| 167 base::win::VERSION_WIN8) || | 169 base::win::VERSION_WIN8) || |
| 168 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, screen_loc, | 170 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, |
| 171 screen_loc_in_pixels, | |
| 169 ignore))) { | 172 ignore))) { |
| 170 return views::DesktopWindowTreeHostWin::GetContentWindowForHWND( | 173 return views::DesktopWindowTreeHostWin::GetContentWindowForHWND( |
| 171 finder.result_); | 174 finder.result_); |
| 172 } | 175 } |
| 173 return NULL; | 176 return NULL; |
| 174 } | 177 } |
| 175 | 178 |
| 176 protected: | 179 protected: |
| 177 virtual bool ShouldStopIterating(HWND hwnd) { | 180 virtual bool ShouldStopIterating(HWND hwnd) { |
| 178 RECT r; | 181 RECT r; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 chrome::HostDesktopType host_desktop_type, | 223 chrome::HostDesktopType host_desktop_type, |
| 221 const gfx::Point& screen_point, | 224 const gfx::Point& screen_point, |
| 222 const std::set<aura::Window*>& ignore) { | 225 const std::set<aura::Window*>& ignore) { |
| 223 #if defined(USE_ASH) | 226 #if defined(USE_ASH) |
| 224 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) | 227 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) |
| 225 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); | 228 return GetLocalProcessWindowAtPointAsh(screen_point, ignore); |
| 226 #endif | 229 #endif |
| 227 return LocalProcessWindowFinder::GetProcessWindowAtPoint( | 230 return LocalProcessWindowFinder::GetProcessWindowAtPoint( |
| 228 screen_point, RemapIgnoreSet(ignore)); | 231 screen_point, RemapIgnoreSet(ignore)); |
| 229 } | 232 } |
| OLD | NEW |