| 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_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
| 6 | 6 |
| 7 #include "ash/aura/aura_layout_manager_adapter.h" | 7 #include "ash/aura/aura_layout_manager_adapter.h" |
| 8 #include "ash/aura/wm_root_window_controller_aura.h" | 8 #include "ash/aura/wm_root_window_controller_aura.h" |
| 9 #include "ash/aura/wm_shell_aura.h" | 9 #include "ash/aura/wm_shell_aura.h" |
| 10 #include "ash/common/ash_constants.h" | 10 #include "ash/common/ash_constants.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/wm/window_animations.h" | 22 #include "ash/wm/window_animations.h" |
| 23 #include "ash/wm/window_mirror_view.h" | 23 #include "ash/wm/window_mirror_view.h" |
| 24 #include "ash/wm/window_properties.h" | 24 #include "ash/wm/window_properties.h" |
| 25 #include "ash/wm/window_state_aura.h" | 25 #include "ash/wm/window_state_aura.h" |
| 26 #include "ash/wm/window_util.h" | 26 #include "ash/wm/window_util.h" |
| 27 #include "base/memory/ptr_util.h" | 27 #include "base/memory/ptr_util.h" |
| 28 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 28 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 29 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
| 30 #include "ui/aura/client/focus_client.h" | 30 #include "ui/aura/client/focus_client.h" |
| 31 #include "ui/aura/client/window_parenting_client.h" | 31 #include "ui/aura/client/window_parenting_client.h" |
| 32 #include "ui/aura/env.h" |
| 32 #include "ui/aura/layout_manager.h" | 33 #include "ui/aura/layout_manager.h" |
| 33 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
| 34 #include "ui/aura/window_delegate.h" | 35 #include "ui/aura/window_delegate.h" |
| 35 #include "ui/aura/window_property.h" | 36 #include "ui/aura/window_property.h" |
| 36 #include "ui/base/hit_test.h" | 37 #include "ui/base/hit_test.h" |
| 37 #include "ui/compositor/layer_tree_owner.h" | 38 #include "ui/compositor/layer_tree_owner.h" |
| 38 #include "ui/compositor/scoped_layer_animation_settings.h" | 39 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 39 #include "ui/display/screen.h" | 40 #include "ui/display/screen.h" |
| 40 #include "ui/gfx/geometry/insets.h" | 41 #include "ui/gfx/geometry/insets.h" |
| 41 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 } | 102 } |
| 102 | 103 |
| 103 // static | 104 // static |
| 104 const WmWindow* WmWindowAura::Get(const aura::Window* window) { | 105 const WmWindow* WmWindowAura::Get(const aura::Window* window) { |
| 105 if (!window) | 106 if (!window) |
| 106 return nullptr; | 107 return nullptr; |
| 107 | 108 |
| 108 const WmWindow* wm_window = window->GetProperty(kWmWindowKey); | 109 const WmWindow* wm_window = window->GetProperty(kWmWindowKey); |
| 109 if (wm_window) | 110 if (wm_window) |
| 110 return wm_window; | 111 return wm_window; |
| 112 DCHECK_EQ(aura::Env::Mode::LOCAL, aura::Env::GetInstance()->mode()); |
| 111 // WmWindowAura is owned by the aura::Window. | 113 // WmWindowAura is owned by the aura::Window. |
| 112 // TODO(sky): fix constness. | 114 // TODO(sky): fix constness. |
| 113 return new WmWindowAura(const_cast<aura::Window*>(window)); | 115 return new WmWindowAura(const_cast<aura::Window*>(window)); |
| 114 } | 116 } |
| 115 | 117 |
| 116 // static | 118 // static |
| 117 std::vector<WmWindow*> WmWindowAura::FromAuraWindows( | 119 std::vector<WmWindow*> WmWindowAura::FromAuraWindows( |
| 118 const std::vector<aura::Window*>& aura_windows) { | 120 const std::vector<aura::Window*>& aura_windows) { |
| 119 std::vector<WmWindow*> result(aura_windows.size()); | 121 std::vector<WmWindow*> result(aura_windows.size()); |
| 120 for (size_t i = 0; i < aura_windows.size(); ++i) | 122 for (size_t i = 0; i < aura_windows.size(); ++i) |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 | 833 |
| 832 void WmWindowAura::AddLimitedPreTargetHandler(ui::EventHandler* handler) { | 834 void WmWindowAura::AddLimitedPreTargetHandler(ui::EventHandler* handler) { |
| 833 // This behaves differently from WmWindowMus for child and embedded windows. | 835 // This behaves differently from WmWindowMus for child and embedded windows. |
| 834 window_->AddPreTargetHandler(handler); | 836 window_->AddPreTargetHandler(handler); |
| 835 } | 837 } |
| 836 | 838 |
| 837 void WmWindowAura::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { | 839 void WmWindowAura::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { |
| 838 window_->RemovePreTargetHandler(handler); | 840 window_->RemovePreTargetHandler(handler); |
| 839 } | 841 } |
| 840 | 842 |
| 843 // static |
| 844 bool WmWindowAura::HasInstance(const aura::Window* window) { |
| 845 return window->GetProperty(kWmWindowKey) != nullptr; |
| 846 } |
| 847 |
| 841 void WmWindowAura::OnWindowHierarchyChanging( | 848 void WmWindowAura::OnWindowHierarchyChanging( |
| 842 const HierarchyChangeParams& params) { | 849 const HierarchyChangeParams& params) { |
| 843 WmWindowObserver::TreeChangeParams wm_params; | 850 WmWindowObserver::TreeChangeParams wm_params; |
| 844 wm_params.target = Get(params.target); | 851 wm_params.target = Get(params.target); |
| 845 wm_params.new_parent = Get(params.new_parent); | 852 wm_params.new_parent = Get(params.new_parent); |
| 846 wm_params.old_parent = Get(params.old_parent); | 853 wm_params.old_parent = Get(params.old_parent); |
| 847 for (auto& observer : observers_) | 854 for (auto& observer : observers_) |
| 848 observer.OnWindowTreeChanging(this, wm_params); | 855 observer.OnWindowTreeChanging(this, wm_params); |
| 849 } | 856 } |
| 850 | 857 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 observer.OnTransientChildAdded(this, Get(transient)); | 946 observer.OnTransientChildAdded(this, Get(transient)); |
| 940 } | 947 } |
| 941 | 948 |
| 942 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, | 949 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, |
| 943 aura::Window* transient) { | 950 aura::Window* transient) { |
| 944 for (auto& observer : transient_observers_) | 951 for (auto& observer : transient_observers_) |
| 945 observer.OnTransientChildRemoved(this, Get(transient)); | 952 observer.OnTransientChildRemoved(this, Get(transient)); |
| 946 } | 953 } |
| 947 | 954 |
| 948 } // namespace ash | 955 } // namespace ash |
| OLD | NEW |