| 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 "ui/aura/root_window.h" | 7 #include "ui/aura/root_window.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 #include "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
| 10 #include "ui/views/widget/desktop_native_widget_helper_aura.h" | 10 #include "ui/views/widget/desktop_native_widget_helper_aura.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Window is topmost, stop iterating. | 72 // Window is topmost, stop iterating. |
| 73 is_top_most_ = true; | 73 is_top_most_ = true; |
| 74 return true; | 74 return true; |
| 75 } | 75 } |
| 76 | 76 |
| 77 if (!ui::IsWindowVisible(window)) { | 77 if (!ui::IsWindowVisible(window)) { |
| 78 // The window isn't visible, keep iterating. | 78 // The window isn't visible, keep iterating. |
| 79 return false; | 79 return false; |
| 80 } | 80 } |
| 81 | 81 |
| 82 gfx::Rect rect; | 82 // At this point we haven't found our target window, so this window is |
| 83 if (ui::GetWindowRect(window, &rect) && rect.Contains(screen_loc_)) { | 83 // higher in the z-order than the target window. If this window contains |
| 84 // At this point we haven't found our target window, so this window is | 84 // the point, then we can stop the search now because this window is |
| 85 // higher in the z-order than the target window. If this window contains | 85 // obscuring the target window at this point. |
| 86 // the point, then we can stop the search now because this window is | 86 return ui::WindowContainsPoint(window, screen_loc_); |
| 87 // obscuring the target window at this point. | |
| 88 return true; | |
| 89 } | |
| 90 | |
| 91 return false; | |
| 92 } | 87 } |
| 93 | 88 |
| 94 private: | 89 private: |
| 95 TopMostFinder(XID window, | 90 TopMostFinder(XID window, |
| 96 const gfx::Point& screen_loc, | 91 const gfx::Point& screen_loc, |
| 97 const std::set<aura::Window*>& ignore) | 92 const std::set<aura::Window*>& ignore) |
| 98 : BaseWindowFinder(ignore), | 93 : BaseWindowFinder(ignore), |
| 99 target_(window), | 94 target_(window), |
| 100 screen_loc_(screen_loc), | 95 screen_loc_(screen_loc), |
| 101 is_top_most_(false) { | 96 is_top_most_(false) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 if (BaseWindowFinder::ShouldIgnoreWindow(window)) | 135 if (BaseWindowFinder::ShouldIgnoreWindow(window)) |
| 141 return false; | 136 return false; |
| 142 | 137 |
| 143 // Check if this window is in our process. | 138 // Check if this window is in our process. |
| 144 if (!aura::RootWindow::GetForAcceleratedWidget(window)) | 139 if (!aura::RootWindow::GetForAcceleratedWidget(window)) |
| 145 return false; | 140 return false; |
| 146 | 141 |
| 147 if (!ui::IsWindowVisible(window)) | 142 if (!ui::IsWindowVisible(window)) |
| 148 return false; | 143 return false; |
| 149 | 144 |
| 150 gfx::Rect rect; | 145 if (ui::WindowContainsPoint(window, screen_loc_)) { |
| 151 if (ui::GetWindowRect(window, &rect) && rect.Contains(screen_loc_)) { | |
| 152 result_ = window; | 146 result_ = window; |
| 153 return true; | 147 return true; |
| 154 } | 148 } |
| 155 | 149 |
| 156 return false; | 150 return false; |
| 157 } | 151 } |
| 158 | 152 |
| 159 private: | 153 private: |
| 160 LocalProcessWindowFinder(const gfx::Point& screen_loc, | 154 LocalProcessWindowFinder(const gfx::Point& screen_loc, |
| 161 const std::set<aura::Window*>& ignore) | 155 const std::set<aura::Window*>& ignore) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 return false; | 205 return false; |
| 212 *bounds = window_->bounds(); | 206 *bounds = window_->bounds(); |
| 213 return true; | 207 return true; |
| 214 } | 208 } |
| 215 | 209 |
| 216 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { | 210 void DockInfo::SizeOtherWindowTo(const gfx::Rect& bounds) const { |
| 217 window_->SetBounds(bounds); | 211 window_->SetBounds(bounds); |
| 218 } | 212 } |
| 219 | 213 |
| 220 #endif | 214 #endif |
| OLD | NEW |