| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/views/tabs/window_finder_impl.h" | |
| 6 | |
| 7 #include "ui/aura/client/screen_position_client.h" | |
| 8 #include "ui/aura/window.h" | |
| 9 #include "ui/aura/window_event_dispatcher.h" | |
| 10 #include "ui/compositor/layer.h" | |
| 11 #include "ui/wm/core/window_util.h" | |
| 12 | |
| 13 gfx::NativeWindow GetLocalProcessWindowAtPointImpl( | |
| 14 const gfx::Point& screen_point, | |
| 15 const std::set<gfx::NativeWindow>& ignore, | |
| 16 const std::set<int>& ignore_ids, | |
| 17 gfx::NativeWindow window) { | |
| 18 if (ignore.find(window) != ignore.end()) | |
| 19 return nullptr; | |
| 20 | |
| 21 if (!window->IsVisible()) | |
| 22 return nullptr; | |
| 23 | |
| 24 if (ignore_ids.find(window->id()) != ignore_ids.end()) | |
| 25 return nullptr; | |
| 26 | |
| 27 if (window->layer()->type() == ui::LAYER_TEXTURED) { | |
| 28 // Returns the window that has visible layer and can hit the | |
| 29 // |screen_point|, because we want to detach the tab as soon as | |
| 30 // the dragging mouse moved over to the window that can hide the | |
| 31 // moving tab. | |
| 32 aura::client::ScreenPositionClient* client = | |
| 33 aura::client::GetScreenPositionClient(window->GetRootWindow()); | |
| 34 gfx::Point local_point = screen_point; | |
| 35 client->ConvertPointFromScreen(window, &local_point); | |
| 36 return window->GetEventHandlerForPoint(local_point) ? window : nullptr; | |
| 37 } | |
| 38 | |
| 39 for (aura::Window::Windows::const_reverse_iterator i = | |
| 40 window->children().rbegin(); | |
| 41 i != window->children().rend(); ++i) { | |
| 42 gfx::NativeWindow result = | |
| 43 GetLocalProcessWindowAtPointImpl(screen_point, ignore, ignore_ids, *i); | |
| 44 if (result) | |
| 45 return result; | |
| 46 } | |
| 47 return nullptr; | |
| 48 } | |
| OLD | NEW |