| 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/aura/wm_root_window_controller_aura.h" | 5 #include "ash/aura/wm_root_window_controller_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/wm_shell_aura.h" | 7 #include "ash/aura/wm_shell_aura.h" |
| 8 #include "ash/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
| 9 #include "ash/common/shelf/shelf_widget.h" | 9 #include "ash/common/shelf/shelf_widget.h" |
| 10 #include "ash/common/shelf/wm_shelf.h" | 10 #include "ash/common/shelf/wm_shelf.h" |
| 11 #include "ash/display/window_tree_host_manager.h" | 11 #include "ash/display/window_tree_host_manager.h" |
| 12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ui/aura/env.h" | 14 #include "ui/aura/env.h" |
| 15 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
| 16 #include "ui/aura/window_event_dispatcher.h" | |
| 17 #include "ui/aura/window_property.h" | 16 #include "ui/aura/window_property.h" |
| 18 #include "ui/aura/window_tree_host.h" | |
| 19 #include "ui/events/event_targeter.h" | |
| 20 #include "ui/events/event_utils.h" | |
| 21 | 17 |
| 22 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*); | 18 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmRootWindowControllerAura*); |
| 23 | 19 |
| 24 namespace ash { | 20 namespace ash { |
| 25 | 21 |
| 26 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. | 22 // TODO(sky): it likely makes more sense to hang this off RootWindowSettings. |
| 27 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura, | 23 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmRootWindowControllerAura, |
| 28 kWmRootWindowControllerKey, | 24 kWmRootWindowControllerKey, |
| 29 nullptr); | 25 nullptr); |
| 30 | 26 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 66 } |
| 71 | 67 |
| 72 WmShelf* WmRootWindowControllerAura::GetShelf() { | 68 WmShelf* WmRootWindowControllerAura::GetShelf() { |
| 73 return root_window_controller_->wm_shelf(); | 69 return root_window_controller_->wm_shelf(); |
| 74 } | 70 } |
| 75 | 71 |
| 76 WmWindow* WmRootWindowControllerAura::GetWindow() { | 72 WmWindow* WmRootWindowControllerAura::GetWindow() { |
| 77 return WmWindowAura::Get(root_window_controller_->GetRootWindow()); | 73 return WmWindowAura::Get(root_window_controller_->GetRootWindow()); |
| 78 } | 74 } |
| 79 | 75 |
| 80 void WmRootWindowControllerAura::ConfigureWidgetInitParamsForContainer( | |
| 81 views::Widget* widget, | |
| 82 int shell_container_id, | |
| 83 views::Widget::InitParams* init_params) { | |
| 84 init_params->parent = Shell::GetContainer( | |
| 85 root_window_controller_->GetRootWindow(), shell_container_id); | |
| 86 } | |
| 87 | |
| 88 WmWindow* WmRootWindowControllerAura::FindEventTarget( | |
| 89 const gfx::Point& location_in_screen) { | |
| 90 gfx::Point location_in_root = | |
| 91 GetWindow()->ConvertPointFromScreen(location_in_screen); | |
| 92 aura::Window* root = root_window_controller_->GetRootWindow(); | |
| 93 ui::MouseEvent test_event(ui::ET_MOUSE_MOVED, location_in_root, | |
| 94 location_in_root, ui::EventTimeForNow(), | |
| 95 ui::EF_NONE, ui::EF_NONE); | |
| 96 ui::EventTarget* event_handler = static_cast<ui::EventTarget*>(root) | |
| 97 ->GetEventTargeter() | |
| 98 ->FindTargetForEvent(root, &test_event); | |
| 99 return WmWindowAura::Get(static_cast<aura::Window*>(event_handler)); | |
| 100 } | |
| 101 | |
| 102 gfx::Point WmRootWindowControllerAura::GetLastMouseLocationInRoot() { | |
| 103 return root_window_controller_->GetHost() | |
| 104 ->dispatcher() | |
| 105 ->GetLastMouseLocationInRoot(); | |
| 106 } | |
| 107 | |
| 108 void WmRootWindowControllerAura::OnInitialWallpaperAnimationStarted() { | 76 void WmRootWindowControllerAura::OnInitialWallpaperAnimationStarted() { |
| 109 root_window_controller_->OnInitialWallpaperAnimationStarted(); | 77 root_window_controller_->OnInitialWallpaperAnimationStarted(); |
| 110 WmRootWindowController::OnInitialWallpaperAnimationStarted(); | 78 WmRootWindowController::OnInitialWallpaperAnimationStarted(); |
| 111 } | 79 } |
| 112 | 80 |
| 113 void WmRootWindowControllerAura::OnWallpaperAnimationFinished( | 81 void WmRootWindowControllerAura::OnWallpaperAnimationFinished( |
| 114 views::Widget* widget) { | 82 views::Widget* widget) { |
| 115 root_window_controller_->OnWallpaperAnimationFinished(widget); | 83 root_window_controller_->OnWallpaperAnimationFinished(widget); |
| 116 WmRootWindowController::OnWallpaperAnimationFinished(widget); | 84 WmRootWindowController::OnWallpaperAnimationFinished(widget); |
| 117 } | 85 } |
| 118 | 86 |
| 119 bool WmRootWindowControllerAura::ShouldDestroyWindowInCloseChildWindows( | 87 bool WmRootWindowControllerAura::ShouldDestroyWindowInCloseChildWindows( |
| 120 WmWindow* window) { | 88 WmWindow* window) { |
| 121 return WmWindowAura::GetAuraWindow(window)->owned_by_parent(); | 89 return WmWindowAura::GetAuraWindow(window)->owned_by_parent(); |
| 122 } | 90 } |
| 123 | 91 |
| 124 } // namespace ash | 92 } // namespace ash |
| OLD | NEW |