OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/tabs/dock_info.h" | 5 #include "chrome/browser/ui/tabs/dock_info.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 "chrome/browser/ui/browser_list.h" | 9 #include "chrome/browser/ui/browser_list.h" |
9 #include "chrome/browser/ui/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
11 #include "chrome/browser/ui/views/tabs/tab.h" | 12 #include "chrome/browser/ui/views/tabs/tab.h" |
12 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // BaseWindowFinder ----------------------------------------------------------- | 17 // BaseWindowFinder ----------------------------------------------------------- |
17 | 18 |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 140 |
140 // Helper class to determine if a particular point contains a window from our | 141 // Helper class to determine if a particular point contains a window from our |
141 // process. | 142 // process. |
142 class LocalProcessWindowFinder : public BaseWindowFinder { | 143 class LocalProcessWindowFinder : public BaseWindowFinder { |
143 public: | 144 public: |
144 // Returns the hwnd from our process at screen_loc that is not obscured by | 145 // Returns the hwnd from our process at screen_loc that is not obscured by |
145 // another window. Returns NULL otherwise. | 146 // another window. Returns NULL otherwise. |
146 static HWND GetProcessWindowAtPoint(const gfx::Point& screen_loc, | 147 static HWND GetProcessWindowAtPoint(const gfx::Point& screen_loc, |
147 const std::set<HWND>& ignore) { | 148 const std::set<HWND>& ignore) { |
148 LocalProcessWindowFinder finder(screen_loc, ignore); | 149 LocalProcessWindowFinder finder(screen_loc, ignore); |
| 150 // Windows 8 has a window that appears first in the list of iterated |
| 151 // windows, yet is not visually on top of everything. |
| 152 // TODO(sky): figure out a better way to ignore this window. |
149 if (finder.result_ && | 153 if (finder.result_ && |
150 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, screen_loc, | 154 ((base::win::OSInfo::GetInstance()->version() >= |
151 ignore)) { | 155 base::win::VERSION_WIN8) || |
| 156 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, screen_loc, |
| 157 ignore))) { |
152 return finder.result_; | 158 return finder.result_; |
153 } | 159 } |
154 return NULL; | 160 return NULL; |
155 } | 161 } |
156 | 162 |
157 protected: | 163 protected: |
158 virtual bool ShouldStopIterating(HWND hwnd) { | 164 virtual bool ShouldStopIterating(HWND hwnd) { |
159 RECT r; | 165 RECT r; |
160 if (IsWindowVisible(hwnd) && GetWindowRect(hwnd, &r) && | 166 if (IsWindowVisible(hwnd) && GetWindowRect(hwnd, &r) && |
161 PtInRect(&r, screen_loc_.ToPOINT())) { | 167 PtInRect(&r, screen_loc_.ToPOINT())) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 321 |
316 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { | 322 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { |
317 if (IsZoomed(window())) { | 323 if (IsZoomed(window())) { |
318 // We're docking relative to another window, we need to make sure the | 324 // We're docking relative to another window, we need to make sure the |
319 // window we're docking to isn't maximized. | 325 // window we're docking to isn't maximized. |
320 ShowWindow(window(), SW_RESTORE | SW_SHOWNA); | 326 ShowWindow(window(), SW_RESTORE | SW_SHOWNA); |
321 } | 327 } |
322 SetWindowPos(window(), HWND_TOP, bounds.x(), bounds.y(), bounds.width(), | 328 SetWindowPos(window(), HWND_TOP, bounds.x(), bounds.y(), bounds.width(), |
323 bounds.height(), SWP_NOACTIVATE | SWP_NOOWNERZORDER); | 329 bounds.height(), SWP_NOACTIVATE | SWP_NOOWNERZORDER); |
324 } | 330 } |
OLD | NEW |