OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "ash/shell_window_ids.h" | |
8 #include "ash/wm/coordinate_conversion.h" | |
9 #include "ui/aura/client/screen_position_client.h" | 7 #include "ui/aura/client/screen_position_client.h" |
10 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
11 #include "ui/aura/window_event_dispatcher.h" | 9 #include "ui/aura/window_event_dispatcher.h" |
10 #include "ui/compositor/layer.h" | |
12 #include "ui/wm/core/window_util.h" | 11 #include "ui/wm/core/window_util.h" |
13 | 12 |
14 namespace { | |
15 | |
16 gfx::NativeWindow GetLocalProcessWindowAtPointImpl( | 13 gfx::NativeWindow GetLocalProcessWindowAtPointImpl( |
17 const gfx::Point& screen_point, | 14 const gfx::Point& screen_point, |
18 const std::set<gfx::NativeWindow>& ignore, | 15 const std::set<gfx::NativeWindow>& ignore, |
19 gfx::NativeWindow window) { | 16 gfx::NativeWindow window) { |
mfomitchev
2015/10/23 18:28:29
Can we give a more descriptive name to "window"? r
bshe
2015/10/30 19:56:23
huh. Just realized the original function is a recu
| |
20 if (ignore.find(window) != ignore.end()) | 17 if (ignore.find(window) != ignore.end()) |
21 return NULL; | 18 return nullptr; |
22 | 19 |
23 if (!window->IsVisible()) | 20 if (!window->IsVisible()) |
24 return NULL; | 21 return nullptr; |
25 | |
26 if (window->id() == ash::kShellWindowId_PhantomWindow || | |
27 window->id() == ash::kShellWindowId_OverlayContainer || | |
28 window->id() == ash::kShellWindowId_MouseCursorContainer) | |
29 return NULL; | |
30 | 22 |
31 if (window->layer()->type() == ui::LAYER_TEXTURED) { | 23 if (window->layer()->type() == ui::LAYER_TEXTURED) { |
32 // Returns the window that has visible layer and can hit the | 24 // Returns the window that has visible layer and can hit the |
33 // |screen_point|, because we want to detach the tab as soon as | 25 // |screen_point|, because we want to detach the tab as soon as |
34 // the dragging mouse moved over to the window that can hide the | 26 // the dragging mouse moved over to the window that can hide the |
35 // moving tab. | 27 // moving tab. |
36 aura::client::ScreenPositionClient* client = | 28 aura::client::ScreenPositionClient* client = |
37 aura::client::GetScreenPositionClient(window->GetRootWindow()); | 29 aura::client::GetScreenPositionClient(window->GetRootWindow()); |
38 gfx::Point local_point = screen_point; | 30 gfx::Point local_point = screen_point; |
39 client->ConvertPointFromScreen(window, &local_point); | 31 client->ConvertPointFromScreen(window, &local_point); |
40 return window->GetEventHandlerForPoint(local_point) ? window : nullptr; | 32 return window->GetEventHandlerForPoint(local_point) ? window : nullptr; |
41 } | 33 } |
42 | 34 |
43 for (aura::Window::Windows::const_reverse_iterator i = | 35 for (aura::Window::Windows::const_reverse_iterator i = |
44 window->children().rbegin(); i != window->children().rend(); ++i) { | 36 window->children().rbegin(); i != window->children().rend(); ++i) { |
45 gfx::NativeWindow result = | 37 gfx::NativeWindow result = |
46 GetLocalProcessWindowAtPointImpl(screen_point, ignore, *i); | 38 GetLocalProcessWindowAtPointImpl(screen_point, ignore, *i); |
47 if (result) | 39 if (result) |
48 return result; | 40 return result; |
49 } | 41 } |
50 return NULL; | 42 return nullptr; |
51 } | 43 } |
52 | |
53 } // namespace | |
54 | |
55 gfx::NativeWindow GetLocalProcessWindowAtPointAsh( | |
56 const gfx::Point& screen_point, | |
57 const std::set<gfx::NativeWindow>& ignore) { | |
58 return GetLocalProcessWindowAtPointImpl( | |
59 screen_point, ignore, ::ash::wm::GetRootWindowAt(screen_point)); | |
60 } | |
OLD | NEW |