| 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 "ash/mus/bridge/wm_root_window_controller_mus.h" | 5 #include "ash/mus/bridge/wm_root_window_controller_mus.h" |
| 6 | 6 |
| 7 #include "ash/mus/bridge/wm_shelf_mus.h" | 7 #include "ash/mus/bridge/wm_shelf_mus.h" |
| 8 #include "ash/mus/bridge/wm_shell_mus.h" | 8 #include "ash/mus/bridge/wm_shell_mus.h" |
| 9 #include "ash/mus/bridge/wm_window_mus.h" | 9 #include "ash/mus/bridge/wm_window_mus.h" |
| 10 #include "ash/mus/root_window_controller.h" | 10 #include "ash/mus/root_window_controller.h" |
| 11 #include "ash/mus/window_manager.h" | 11 #include "ash/mus/window_manager.h" |
| 12 #include "ui/aura/mus/window_mus.h" | 12 #include "ui/aura/mus/window_mus.h" |
| 13 #include "ui/aura/mus/window_tree_client.h" | 13 #include "ui/aura/mus/window_tree_client.h" |
| 14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 15 #include "ui/aura/window_property.h" | 15 #include "ui/aura/window_property.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/views/widget/native_widget_aura.h" | |
| 18 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 19 | 18 |
| 20 DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmRootWindowControllerMus*); | 19 DECLARE_WINDOW_PROPERTY_TYPE(ash::mus::WmRootWindowControllerMus*); |
| 21 | 20 |
| 22 namespace { | 21 namespace { |
| 23 | 22 |
| 24 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::WmRootWindowControllerMus*, | 23 DEFINE_LOCAL_WINDOW_PROPERTY_KEY(ash::mus::WmRootWindowControllerMus*, |
| 25 kWmRootWindowControllerKey, | 24 kWmRootWindowControllerKey, |
| 26 nullptr); | 25 nullptr); |
| 27 | 26 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 95 } |
| 97 | 96 |
| 98 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer( | 97 void WmRootWindowControllerMus::ConfigureWidgetInitParamsForContainer( |
| 99 views::Widget* widget, | 98 views::Widget* widget, |
| 100 int shell_container_id, | 99 int shell_container_id, |
| 101 views::Widget::InitParams* init_params) { | 100 views::Widget::InitParams* init_params) { |
| 102 init_params->parent = WmWindowMus::GetAuraWindow( | 101 init_params->parent = WmWindowMus::GetAuraWindow( |
| 103 WmWindowMus::Get(root_window_controller_->root()) | 102 WmWindowMus::Get(root_window_controller_->root()) |
| 104 ->GetChildByShellWindowId(shell_container_id)); | 103 ->GetChildByShellWindowId(shell_container_id)); |
| 105 DCHECK(init_params->parent); | 104 DCHECK(init_params->parent); |
| 106 views::NativeWidgetAura* native_widget_aura = | |
| 107 new views::NativeWidgetAura(widget); | |
| 108 init_params->native_widget = native_widget_aura; | |
| 109 WmWindowMus::Get(native_widget_aura->GetNativeView()) | |
| 110 ->set_widget(widget, WmWindowMus::WidgetCreationType::INTERNAL); | |
| 111 } | 105 } |
| 112 | 106 |
| 113 WmWindow* WmRootWindowControllerMus::FindEventTarget( | 107 WmWindow* WmRootWindowControllerMus::FindEventTarget( |
| 114 const gfx::Point& location_in_screen) { | 108 const gfx::Point& location_in_screen) { |
| 115 NOTIMPLEMENTED(); | 109 NOTIMPLEMENTED(); |
| 116 return nullptr; | 110 return nullptr; |
| 117 } | 111 } |
| 118 | 112 |
| 119 gfx::Point WmRootWindowControllerMus::GetLastMouseLocationInRoot() { | 113 gfx::Point WmRootWindowControllerMus::GetLastMouseLocationInRoot() { |
| 120 gfx::Point location = root_window_controller_->window_manager() | 114 gfx::Point location = root_window_controller_->window_manager() |
| 121 ->window_tree_client() | 115 ->window_tree_client() |
| 122 ->GetCursorScreenPoint(); | 116 ->GetCursorScreenPoint(); |
| 123 location -= | 117 location -= |
| 124 root_window_controller_->display().bounds().origin().OffsetFromOrigin(); | 118 root_window_controller_->display().bounds().origin().OffsetFromOrigin(); |
| 125 return location; | 119 return location; |
| 126 } | 120 } |
| 127 | 121 |
| 128 bool WmRootWindowControllerMus::ShouldDestroyWindowInCloseChildWindows( | 122 bool WmRootWindowControllerMus::ShouldDestroyWindowInCloseChildWindows( |
| 129 WmWindow* window) { | 123 WmWindow* window) { |
| 130 aura::WindowTreeClient* window_tree_client = | 124 aura::WindowTreeClient* window_tree_client = |
| 131 root_window_controller_->window_manager()->window_tree_client(); | 125 root_window_controller_->window_manager()->window_tree_client(); |
| 132 aura::Window* aura_window = WmWindowMus::GetAuraWindow(window); | 126 aura::Window* aura_window = WmWindowMus::GetAuraWindow(window); |
| 133 aura::WindowMus* window_mus = aura::WindowMus::Get(aura_window); | 127 aura::WindowMus* window_mus = aura::WindowMus::Get(aura_window); |
| 134 return window_tree_client->WasCreatedByThisClient(window_mus) || | 128 return window_tree_client->WasCreatedByThisClient(window_mus) || |
| 135 window_tree_client->IsRoot(window_mus); | 129 window_tree_client->IsRoot(window_mus); |
| 136 } | 130 } |
| 137 | 131 |
| 138 } // namespace mus | 132 } // namespace mus |
| 139 } // namespace ash | 133 } // namespace ash |
| OLD | NEW |