| 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_window.h" | 5 #include "ash/wm_window.h" |
| 6 | 6 |
| 7 #include "ash/ash_constants.h" | 7 #include "ash/ash_constants.h" |
| 8 #include "ash/aura/aura_layout_manager_adapter.h" | |
| 9 #include "ash/public/cpp/config.h" | 8 #include "ash/public/cpp/config.h" |
| 10 #include "ash/public/cpp/shell_window_ids.h" | 9 #include "ash/public/cpp/shell_window_ids.h" |
| 11 #include "ash/public/cpp/window_properties.h" | 10 #include "ash/public/cpp/window_properties.h" |
| 12 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
| 13 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 14 #include "ash/wm/resize_handle_window_targeter.h" | 13 #include "ash/wm/resize_handle_window_targeter.h" |
| 15 #include "ash/wm/resize_shadow_controller.h" | 14 #include "ash/wm/resize_shadow_controller.h" |
| 16 #include "ash/wm/widget_finder.h" | 15 #include "ash/wm/widget_finder.h" |
| 17 #include "ash/wm/window_animations.h" | 16 #include "ash/wm/window_animations.h" |
| 18 #include "ash/wm/window_mirror_view.h" | 17 #include "ash/wm/window_mirror_view.h" |
| 19 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
| 20 #include "ash/wm/window_state.h" | 19 #include "ash/wm/window_state.h" |
| 21 #include "ash/wm/window_state_aura.h" | 20 #include "ash/wm/window_state_aura.h" |
| 22 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
| 23 #include "ash/wm_layout_manager.h" | |
| 24 #include "ash/wm_transient_window_observer.h" | 22 #include "ash/wm_transient_window_observer.h" |
| 25 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
| 26 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" | 24 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" |
| 27 #include "ui/aura/client/aura_constants.h" | 25 #include "ui/aura/client/aura_constants.h" |
| 28 #include "ui/aura/client/focus_client.h" | 26 #include "ui/aura/client/focus_client.h" |
| 29 #include "ui/aura/client/window_parenting_client.h" | 27 #include "ui/aura/client/window_parenting_client.h" |
| 30 #include "ui/aura/layout_manager.h" | 28 #include "ui/aura/layout_manager.h" |
| 31 #include "ui/aura/mus/window_manager_delegate.h" | 29 #include "ui/aura/mus/window_manager_delegate.h" |
| 32 #include "ui/aura/mus/window_mus.h" | 30 #include "ui/aura/mus/window_mus.h" |
| 33 #include "ui/aura/mus/window_tree_client.h" | 31 #include "ui/aura/mus/window_tree_client.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 } | 300 } |
| 303 | 301 |
| 304 std::vector<WmWindow*> WmWindow::GetTransientChildren() { | 302 std::vector<WmWindow*> WmWindow::GetTransientChildren() { |
| 305 return FromAuraWindows(::wm::GetTransientChildren(window_)); | 303 return FromAuraWindows(::wm::GetTransientChildren(window_)); |
| 306 } | 304 } |
| 307 | 305 |
| 308 bool WmWindow::MoveToEventRoot(const ui::Event& event) { | 306 bool WmWindow::MoveToEventRoot(const ui::Event& event) { |
| 309 return ash::wm::MoveWindowToEventRoot(window_, event); | 307 return ash::wm::MoveWindowToEventRoot(window_, event); |
| 310 } | 308 } |
| 311 | 309 |
| 312 void WmWindow::SetLayoutManager( | |
| 313 std::unique_ptr<WmLayoutManager> layout_manager) { | |
| 314 // See ~AuraLayoutManagerAdapter for why SetLayoutManager(nullptr) is called. | |
| 315 window_->SetLayoutManager(nullptr); | |
| 316 if (!layout_manager) | |
| 317 return; | |
| 318 | |
| 319 // |window_| takes ownership of AuraLayoutManagerAdapter. | |
| 320 window_->SetLayoutManager( | |
| 321 new AuraLayoutManagerAdapter(window_, std::move(layout_manager))); | |
| 322 } | |
| 323 | |
| 324 WmLayoutManager* WmWindow::GetLayoutManager() { | |
| 325 AuraLayoutManagerAdapter* adapter = AuraLayoutManagerAdapter::Get(window_); | |
| 326 return adapter ? adapter->wm_layout_manager() : nullptr; | |
| 327 } | |
| 328 | |
| 329 void WmWindow::SetVisibilityChangesAnimated() { | 310 void WmWindow::SetVisibilityChangesAnimated() { |
| 330 ::wm::SetWindowVisibilityChangesAnimated(window_); | 311 ::wm::SetWindowVisibilityChangesAnimated(window_); |
| 331 } | 312 } |
| 332 | 313 |
| 333 void WmWindow::SetVisibilityAnimationType(int type) { | 314 void WmWindow::SetVisibilityAnimationType(int type) { |
| 334 ::wm::SetWindowVisibilityAnimationType(window_, type); | 315 ::wm::SetWindowVisibilityAnimationType(window_, type); |
| 335 } | 316 } |
| 336 | 317 |
| 337 void WmWindow::SetVisibilityAnimationDuration(base::TimeDelta delta) { | 318 void WmWindow::SetVisibilityAnimationDuration(base::TimeDelta delta) { |
| 338 ::wm::SetWindowVisibilityAnimationDuration(window_, delta); | 319 ::wm::SetWindowVisibilityAnimationDuration(window_, delta); |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 observer.OnTransientChildAdded(this, Get(transient)); | 736 observer.OnTransientChildAdded(this, Get(transient)); |
| 756 } | 737 } |
| 757 | 738 |
| 758 void WmWindow::OnTransientChildRemoved(aura::Window* window, | 739 void WmWindow::OnTransientChildRemoved(aura::Window* window, |
| 759 aura::Window* transient) { | 740 aura::Window* transient) { |
| 760 for (auto& observer : transient_observers_) | 741 for (auto& observer : transient_observers_) |
| 761 observer.OnTransientChildRemoved(this, Get(transient)); | 742 observer.OnTransientChildRemoved(this, Get(transient)); |
| 762 } | 743 } |
| 763 | 744 |
| 764 } // namespace ash | 745 } // namespace ash |
| OLD | NEW |