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/win/scoped_gdi_object.h" | 9 #include "base/win/scoped_gdi_object.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // WS_EX_LAYERED windows then there are effectively holes on the screen | 102 // WS_EX_LAYERED windows then there are effectively holes on the screen |
103 // that the user can't reattach tabs to. So we ignore them. This is a bit | 103 // that the user can't reattach tabs to. So we ignore them. This is a bit |
104 // problematic in so far as WS_EX_LAYERED windows need not be totally | 104 // problematic in so far as WS_EX_LAYERED windows need not be totally |
105 // transparent in which case we treat chrome windows as not being obscured | 105 // transparent in which case we treat chrome windows as not being obscured |
106 // when they really are, but this is better than not being able to | 106 // when they really are, but this is better than not being able to |
107 // reattach tabs. | 107 // reattach tabs. |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 // hwnd is at the point. Make sure the point is within the windows region. | 111 // hwnd is at the point. Make sure the point is within the windows region. |
112 if (GetWindowRgn(hwnd, tmp_region_.Get()) == ERROR) { | 112 if (GetWindowRgn(hwnd, tmp_region_.get()) == ERROR) { |
113 // There's no region on the window and the window contains the point. Stop | 113 // There's no region on the window and the window contains the point. Stop |
114 // iterating. | 114 // iterating. |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 // The region is relative to the window's rect. | 118 // The region is relative to the window's rect. |
119 BOOL is_point_in_region = PtInRegion(tmp_region_.Get(), | 119 BOOL is_point_in_region = PtInRegion( |
120 screen_loc_.x() - r.left, screen_loc_.y() - r.top); | 120 tmp_region_.get(), screen_loc_.x() - r.left, screen_loc_.y() - r.top); |
121 tmp_region_ = CreateRectRgn(0, 0, 0, 0); | 121 tmp_region_.reset(CreateRectRgn(0, 0, 0, 0)); |
122 // Stop iterating if the region contains the point. | 122 // Stop iterating if the region contains the point. |
123 return !!is_point_in_region; | 123 return !!is_point_in_region; |
124 } | 124 } |
125 | 125 |
126 private: | 126 private: |
127 TopMostFinder(HWND window, | 127 TopMostFinder(HWND window, |
128 const gfx::Point& screen_loc, | 128 const gfx::Point& screen_loc, |
129 const std::set<HWND>& ignore) | 129 const std::set<HWND>& ignore) |
130 : BaseWindowFinder(ignore), | 130 : BaseWindowFinder(ignore), |
131 target_(window), | 131 target_(window), |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 const gfx::Point& screen_point, | 243 const gfx::Point& screen_point, |
244 const std::set<gfx::NativeWindow>& ignore, | 244 const std::set<gfx::NativeWindow>& ignore, |
245 gfx::NativeWindow source) { | 245 gfx::NativeWindow source) { |
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 |