| 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" | 5 #include "chrome/browser/ui/views/tabs/window_finder_mus.h" |
| 6 | 6 |
| 7 #include "content/public/common/service_manager_connection.h" // nogncheck | 7 #include "content/public/common/service_manager_connection.h" // nogncheck |
| 8 #include "services/service_manager/runner/common/client_util.h" // nogncheck | 8 #include "services/service_manager/runner/common/client_util.h" // nogncheck |
| 9 #include "ui/aura/mus/window_tree_client.h" | |
| 10 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
| 11 #include "ui/views/mus/mus_client.h" | 10 #include "ui/views/mus/native_widget_mus.h" |
| 11 #include "ui/views/mus/window_manager_connection.h" |
| 12 | 12 |
| 13 bool GetLocalProcessWindowAtPointMus( | 13 bool GetLocalProcessWindowAtPointMus( |
| 14 const gfx::Point& screen_point, | 14 const gfx::Point& screen_point, |
| 15 const std::set<gfx::NativeWindow>& ignore, | 15 const std::set<gfx::NativeWindow>& ignore, |
| 16 gfx::NativeWindow* mus_result) { | 16 gfx::NativeWindow* mus_result) { |
| 17 *mus_result = nullptr; | 17 *mus_result = nullptr; |
| 18 content::ServiceManagerConnection* service_manager_connection = | 18 content::ServiceManagerConnection* service_manager_connection = |
| 19 content::ServiceManagerConnection::GetForProcess(); | 19 content::ServiceManagerConnection::GetForProcess(); |
| 20 if (!service_manager_connection || !service_manager::ServiceManagerIsRemote()) | 20 if (!service_manager_connection || !service_manager::ServiceManagerIsRemote()) |
| 21 return false; | 21 return false; |
| 22 | 22 |
| 23 std::set<aura::Window*> root_windows = | 23 std::set<ui::Window*> mus_windows = |
| 24 views::MusClient::Get()->window_tree_client()->GetRoots(); | 24 views::WindowManagerConnection::Get()->GetRoots(); |
| 25 // TODO(erg): Needs to deal with stacking order here. | 25 // TODO(erg): Needs to deal with stacking order here. |
| 26 | 26 |
| 27 // For every mus window, look at the associated aura window and see if we're | 27 // For every mus window, look at the associated aura window and see if we're |
| 28 // in that. | 28 // in that. |
| 29 for (aura::Window* root : root_windows) { | 29 for (ui::Window* mus : mus_windows) { |
| 30 views::Widget* widget = views::Widget::GetWidgetForNativeView(root); | 30 views::Widget* widget = views::NativeWidgetMus::GetWidgetForWindow(mus); |
| 31 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) { | 31 if (widget && widget->GetWindowBoundsInScreen().Contains(screen_point)) { |
| 32 aura::Window* content_window = widget->GetNativeWindow(); | 32 aura::Window* content_window = widget->GetNativeWindow(); |
| 33 | 33 |
| 34 // If we were instructed to ignore this window, ignore it. | 34 // If we were instructed to ignore this window, ignore it. |
| 35 if (base::ContainsKey(ignore, content_window)) | 35 if (base::ContainsKey(ignore, content_window)) |
| 36 continue; | 36 continue; |
| 37 | 37 |
| 38 *mus_result = content_window; | 38 *mus_result = content_window; |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 return true; | 43 return true; |
| 44 } | 44 } |
| OLD | NEW |