| 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/wm/aura/wm_root_window_controller_aura.h" | 5 #include "ash/wm/aura/wm_root_window_controller_aura.h" |
| 6 | 6 |
| 7 #include "ash/display/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shelf/shelf.h" | 9 #include "ash/shelf/shelf.h" |
| 10 #include "ash/shelf/shelf_widget.h" | 10 #include "ash/shelf/shelf_widget.h" |
| 11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/aura/wm_globals_aura.h" | 12 #include "ash/wm/aura/wm_globals_aura.h" |
| 13 #include "ash/wm/aura/wm_shelf_aura.h" | 13 #include "ash/wm/aura/wm_shelf_aura.h" |
| 14 #include "ash/wm/aura/wm_window_aura.h" | 14 #include "ash/wm/aura/wm_window_aura.h" |
| 15 #include "ash/wm/common/wm_root_window_controller_observer.h" | 15 #include "ash/wm/common/wm_root_window_controller_observer.h" |
| 16 #include "ash/wm/workspace_controller.h" | 16 #include "ash/wm/workspace_controller.h" |
| 17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
| 18 #include "ui/aura/window_property.h" | 18 #include "ui/aura/window_property.h" |
| 19 #include "ui/events/event_targeter.h" |
| 20 #include "ui/events/event_utils.h" |
| 19 | 21 |
| 20 DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WmRootWindowControllerAura*); | 22 DECLARE_WINDOW_PROPERTY_TYPE(ash::wm::WmRootWindowControllerAura*); |
| 21 | 23 |
| 22 namespace ash { | 24 namespace ash { |
| 23 namespace wm { | 25 namespace wm { |
| 24 | 26 |
| 25 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. | 27 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. |
| 26 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::wm::WmRootWindowControllerAura, | 28 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::wm::WmRootWindowControllerAura, |
| 27 kWmRootWindowControllerKey, | 29 kWmRootWindowControllerKey, |
| 28 nullptr); | 30 nullptr); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 96 } |
| 95 | 97 |
| 96 void WmRootWindowControllerAura::ConfigureWidgetInitParamsForContainer( | 98 void WmRootWindowControllerAura::ConfigureWidgetInitParamsForContainer( |
| 97 views::Widget* widget, | 99 views::Widget* widget, |
| 98 int shell_container_id, | 100 int shell_container_id, |
| 99 views::Widget::InitParams* init_params) { | 101 views::Widget::InitParams* init_params) { |
| 100 init_params->parent = Shell::GetContainer( | 102 init_params->parent = Shell::GetContainer( |
| 101 root_window_controller_->GetRootWindow(), shell_container_id); | 103 root_window_controller_->GetRootWindow(), shell_container_id); |
| 102 } | 104 } |
| 103 | 105 |
| 106 WmWindow* WmRootWindowControllerAura::FindEventTarget( |
| 107 const gfx::Point& location_in_screen) { |
| 108 gfx::Point location_in_root = |
| 109 GetWindow()->ConvertPointFromScreen(location_in_screen); |
| 110 aura::Window* root = root_window_controller_->GetRootWindow(); |
| 111 ui::MouseEvent test_event(ui::ET_MOUSE_MOVED, location_in_root, |
| 112 location_in_root, ui::EventTimeForNow(), |
| 113 ui::EF_NONE, ui::EF_NONE); |
| 114 ui::EventTarget* event_handler = static_cast<ui::EventTarget*>(root) |
| 115 ->GetEventTargeter() |
| 116 ->FindTargetForEvent(root, &test_event); |
| 117 return WmWindowAura::Get(static_cast<aura::Window*>(event_handler)); |
| 118 } |
| 119 |
| 104 void WmRootWindowControllerAura::AddObserver( | 120 void WmRootWindowControllerAura::AddObserver( |
| 105 WmRootWindowControllerObserver* observer) { | 121 WmRootWindowControllerObserver* observer) { |
| 106 observers_.AddObserver(observer); | 122 observers_.AddObserver(observer); |
| 107 } | 123 } |
| 108 | 124 |
| 109 void WmRootWindowControllerAura::RemoveObserver( | 125 void WmRootWindowControllerAura::RemoveObserver( |
| 110 WmRootWindowControllerObserver* observer) { | 126 WmRootWindowControllerObserver* observer) { |
| 111 observers_.RemoveObserver(observer); | 127 observers_.RemoveObserver(observer); |
| 112 } | 128 } |
| 113 | 129 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 130 aura::Window* root_window) { | 146 aura::Window* root_window) { |
| 131 if (root_window != root_window_controller_->GetRootWindow()) | 147 if (root_window != root_window_controller_->GetRootWindow()) |
| 132 return; | 148 return; |
| 133 | 149 |
| 134 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, | 150 FOR_EACH_OBSERVER(WmRootWindowControllerObserver, observers_, |
| 135 OnShelfAlignmentChanged()); | 151 OnShelfAlignmentChanged()); |
| 136 } | 152 } |
| 137 | 153 |
| 138 } // namespace wm | 154 } // namespace wm |
| 139 } // namespace ash | 155 } // namespace ash |
| OLD | NEW |