| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_mus.h" | |
| 6 | |
| 7 #include "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 8 #include "ui/views/mus/native_widget_mus.h" | 6 #include "ui/views/mus/native_widget_mus.h" |
| 9 #include "ui/views/mus/window_manager_connection.h" | 7 #include "ui/views/mus/window_manager_connection.h" |
| 10 | 8 |
| 11 WindowFinderMus::WindowFinderMus() {} | 9 gfx::NativeWindow GetLocalProcessWindowAtPointMus( |
| 12 | |
| 13 WindowFinderMus::~WindowFinderMus() {} | |
| 14 | |
| 15 gfx::NativeWindow WindowFinderMus::GetLocalProcessWindowAtPoint( | |
| 16 const gfx::Point& screen_point, | 10 const gfx::Point& screen_point, |
| 17 const std::set<gfx::NativeWindow>& ignore) { | 11 const std::set<gfx::NativeWindow>& ignore) { |
| 18 std::set<ui::Window*> mus_windows = | 12 std::set<ui::Window*> mus_windows = |
| 19 views::WindowManagerConnection::Get()->GetRoots(); | 13 views::WindowManagerConnection::Get()->GetRoots(); |
| 20 // TODO(erg): Needs to deal with stacking order here. | 14 // TODO(erg): Needs to deal with stacking order here. |
| 21 | 15 |
| 22 // For every mus window, look at the associated aura window and see if we're | 16 // For every mus window, look at the associated aura window and see if we're |
| 23 // in that. | 17 // in that. |
| 24 for (ui::Window* mus : mus_windows) { | 18 for (ui::Window* mus : mus_windows) { |
| 25 views::Widget* widget = views::NativeWidgetMus::GetWidgetForWindow(mus); | 19 views::Widget* widget = views::NativeWidgetMus::GetWidgetForWindow(mus); |
| 26 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) { | 20 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) { |
| 27 aura::Window* content_window = widget->GetNativeWindow(); | 21 aura::Window* content_window = widget->GetNativeWindow(); |
| 28 | 22 |
| 29 // If we were instructed to ignore this window, ignore it. | 23 // If we were instructed to ignore this window, ignore it. |
| 30 if (base::ContainsKey(ignore, content_window)) | 24 if (base::ContainsKey(ignore, content_window)) |
| 31 continue; | 25 continue; |
| 32 | 26 |
| 33 return content_window; | 27 return content_window; |
| 34 } | 28 } |
| 35 } | 29 } |
| 36 | 30 |
| 37 return nullptr; | 31 return nullptr; |
| 38 } | 32 } |
| OLD | NEW |