OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/win/windows_version.h" |
9 #include "chrome/browser/ui/ash/tabs/dock_info_ash.h" | 9 #include "chrome/browser/ui/ash/tabs/dock_info_ash.h" |
10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 LocalProcessWindowFinder finder(screen_loc, ignore); | 164 LocalProcessWindowFinder finder(screen_loc, ignore); |
165 // Windows 8 has a window that appears first in the list of iterated | 165 // Windows 8 has a window that appears first in the list of iterated |
166 // windows, yet is not visually on top of everything. | 166 // windows, yet is not visually on top of everything. |
167 // TODO(sky): figure out a better way to ignore this window. | 167 // TODO(sky): figure out a better way to ignore this window. |
168 if (finder.result_ && | 168 if (finder.result_ && |
169 ((base::win::OSInfo::GetInstance()->version() >= | 169 ((base::win::OSInfo::GetInstance()->version() >= |
170 base::win::VERSION_WIN8) || | 170 base::win::VERSION_WIN8) || |
171 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, screen_loc, | 171 TopMostFinder::IsTopMostWindowAtPoint(finder.result_, screen_loc, |
172 ignore))) { | 172 ignore))) { |
173 #if defined(USE_AURA) | 173 #if defined(USE_AURA) |
174 return views::DesktopRootWindowHostWin::GetContentWindowForHWND( | 174 return views::DesktopWindowTreeHostWin::GetContentWindowForHWND( |
175 finder.result_); | 175 finder.result_); |
176 #else | 176 #else |
177 return finder.result_; | 177 return finder.result_; |
178 #endif | 178 #endif |
179 } | 179 } |
180 return NULL; | 180 return NULL; |
181 } | 181 } |
182 | 182 |
183 protected: | 183 protected: |
184 virtual bool ShouldStopIterating(HWND hwnd) { | 184 virtual bool ShouldStopIterating(HWND hwnd) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 ignore)) { | 227 ignore)) { |
228 finder.result_.set_type(DockInfo::NONE); | 228 finder.result_.set_type(DockInfo::NONE); |
229 } | 229 } |
230 return finder.result_; | 230 return finder.result_; |
231 } | 231 } |
232 | 232 |
233 protected: | 233 protected: |
234 virtual bool ShouldStopIterating(HWND hwnd) { | 234 virtual bool ShouldStopIterating(HWND hwnd) { |
235 #if defined(USE_AURA) | 235 #if defined(USE_AURA) |
236 BrowserView* window = BrowserView::GetBrowserViewForNativeWindow( | 236 BrowserView* window = BrowserView::GetBrowserViewForNativeWindow( |
237 views::DesktopRootWindowHostWin::GetContentWindowForHWND(hwnd)); | 237 views::DesktopWindowTreeHostWin::GetContentWindowForHWND(hwnd)); |
238 #else | 238 #else |
239 BrowserView* window = BrowserView::GetBrowserViewForNativeWindow(hwnd); | 239 BrowserView* window = BrowserView::GetBrowserViewForNativeWindow(hwnd); |
240 #endif | 240 #endif |
241 RECT bounds; | 241 RECT bounds; |
242 if (!window || !IsWindowVisible(hwnd) || | 242 if (!window || !IsWindowVisible(hwnd) || |
243 !GetWindowRect(hwnd, &bounds)) { | 243 !GetWindowRect(hwnd, &bounds)) { |
244 return false; | 244 return false; |
245 } | 245 } |
246 | 246 |
247 // Check the three corners we allow docking to. We don't currently allow | 247 // Check the three corners we allow docking to. We don't currently allow |
(...skipping 21 matching lines...) Expand all Loading... |
269 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); | 269 EnumThreadWindows(GetCurrentThreadId(), WindowCallbackProc, as_lparam()); |
270 } | 270 } |
271 } | 271 } |
272 | 272 |
273 bool CheckPoint(HWND hwnd, int x, int y, DockInfo::Type type) { | 273 bool CheckPoint(HWND hwnd, int x, int y, DockInfo::Type type) { |
274 bool in_enable_area; | 274 bool in_enable_area; |
275 if (DockInfo::IsCloseToPoint(screen_loc_, x, y, &in_enable_area)) { | 275 if (DockInfo::IsCloseToPoint(screen_loc_, x, y, &in_enable_area)) { |
276 result_.set_in_enable_area(in_enable_area); | 276 result_.set_in_enable_area(in_enable_area); |
277 #if defined(USE_AURA) | 277 #if defined(USE_AURA) |
278 result_.set_window( | 278 result_.set_window( |
279 views::DesktopRootWindowHostWin::GetContentWindowForHWND(hwnd)); | 279 views::DesktopWindowTreeHostWin::GetContentWindowForHWND(hwnd)); |
280 #else | 280 #else |
281 result_.set_window(hwnd); | 281 result_.set_window(hwnd); |
282 #endif | 282 #endif |
283 result_.set_type(type); | 283 result_.set_type(type); |
284 result_.set_hot_spot(gfx::Point(x, y)); | 284 result_.set_hot_spot(gfx::Point(x, y)); |
285 // Only show the hotspot if the monitor contains the bounds of the popup | 285 // Only show the hotspot if the monitor contains the bounds of the popup |
286 // window. Otherwise we end with a weird situation where the popup window | 286 // window. Otherwise we end with a weird situation where the popup window |
287 // isn't completely visible. | 287 // isn't completely visible. |
288 return result_.monitor_bounds().Contains(result_.GetPopupRect()); | 288 return result_.monitor_bounds().Contains(result_.GetPopupRect()); |
289 } | 289 } |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 SetWindowPos(window(), HWND_TOP, bounds.x(), bounds.y(), bounds.width(), | 396 SetWindowPos(window(), HWND_TOP, bounds.x(), bounds.y(), bounds.width(), |
397 bounds.height(), SWP_NOACTIVATE | SWP_NOOWNERZORDER); | 397 bounds.height(), SWP_NOACTIVATE | SWP_NOOWNERZORDER); |
398 } | 398 } |
399 | 399 |
400 // static | 400 // static |
401 int DockInfo::GetHotSpotDeltaY() { | 401 int DockInfo::GetHotSpotDeltaY() { |
402 return Tab::GetMinimumUnselectedSize().height() - 1; | 402 return Tab::GetMinimumUnselectedSize().height() - 1; |
403 } | 403 } |
404 | 404 |
405 #endif // !USE_AURA | 405 #endif // !USE_AURA |
OLD | NEW |