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" | 8 #include "ash/aura/aura_layout_manager_adapter.h" |
9 #include "ash/aura/wm_shell_aura.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" |
| 13 #include "ash/shell_port.h" |
14 #include "ash/wm/resize_handle_window_targeter.h" | 14 #include "ash/wm/resize_handle_window_targeter.h" |
15 #include "ash/wm/resize_shadow_controller.h" | 15 #include "ash/wm/resize_shadow_controller.h" |
16 #include "ash/wm/widget_finder.h" | 16 #include "ash/wm/widget_finder.h" |
17 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
18 #include "ash/wm/window_mirror_view.h" | 18 #include "ash/wm/window_mirror_view.h" |
19 #include "ash/wm/window_properties.h" | 19 #include "ash/wm/window_properties.h" |
20 #include "ash/wm/window_state.h" | 20 #include "ash/wm/window_state.h" |
21 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
22 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
23 #include "ash/wm_layout_manager.h" | 23 #include "ash/wm_layout_manager.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 148 |
149 const WmWindow* WmWindow::GetRootWindow() const { | 149 const WmWindow* WmWindow::GetRootWindow() const { |
150 return Get(window_->GetRootWindow()); | 150 return Get(window_->GetRootWindow()); |
151 } | 151 } |
152 | 152 |
153 RootWindowController* WmWindow::GetRootWindowController() { | 153 RootWindowController* WmWindow::GetRootWindowController() { |
154 aura::Window* root = window_->GetRootWindow(); | 154 aura::Window* root = window_->GetRootWindow(); |
155 return root ? RootWindowController::ForWindow(root) : nullptr; | 155 return root ? RootWindowController::ForWindow(root) : nullptr; |
156 } | 156 } |
157 | 157 |
158 WmShell* WmWindow::GetShell() const { | |
159 return WmShell::Get(); | |
160 } | |
161 | |
162 void WmWindow::SetShellWindowId(int id) { | 158 void WmWindow::SetShellWindowId(int id) { |
163 window_->set_id(id); | 159 window_->set_id(id); |
164 } | 160 } |
165 | 161 |
166 int WmWindow::GetShellWindowId() const { | 162 int WmWindow::GetShellWindowId() const { |
167 return window_->id(); | 163 return window_->id(); |
168 } | 164 } |
169 | 165 |
170 ui::wm::WindowType WmWindow::GetType() const { | 166 ui::wm::WindowType WmWindow::GetType() const { |
171 return window_->type(); | 167 return window_->type(); |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 | 569 |
574 void WmWindow::Hide() { | 570 void WmWindow::Hide() { |
575 window_->Hide(); | 571 window_->Hide(); |
576 } | 572 } |
577 | 573 |
578 void WmWindow::Show() { | 574 void WmWindow::Show() { |
579 window_->Show(); | 575 window_->Show(); |
580 } | 576 } |
581 | 577 |
582 void WmWindow::CloseWidget() { | 578 void WmWindow::CloseWidget() { |
583 if (WmShell::Get()->IsRunningInMash() && | 579 if (ShellPort::Get()->IsRunningInMash() && |
584 aura_window()->GetProperty(kWidgetCreationTypeKey) == | 580 aura_window()->GetProperty(kWidgetCreationTypeKey) == |
585 WidgetCreationType::FOR_CLIENT) { | 581 WidgetCreationType::FOR_CLIENT) { |
586 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated | 582 // NOTE: in the FOR_CLIENT case there is not necessarily a widget associated |
587 // with the window. Mash only creates widgets for top level windows if mash | 583 // with the window. Mash only creates widgets for top level windows if mash |
588 // renders the non-client frame. | 584 // renders the non-client frame. |
589 DCHECK(Shell::window_manager_client()); | 585 DCHECK(Shell::window_manager_client()); |
590 Shell::window_manager_client()->RequestClose(aura_window()); | 586 Shell::window_manager_client()->RequestClose(aura_window()); |
591 return; | 587 return; |
592 } | 588 } |
593 views::Widget* widget = GetInternalWidgetForWindow(window_); | 589 views::Widget* widget = GetInternalWidgetForWindow(window_); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 632 |
637 std::vector<WmWindow*> WmWindow::GetChildren() { | 633 std::vector<WmWindow*> WmWindow::GetChildren() { |
638 return FromAuraWindows(window_->children()); | 634 return FromAuraWindows(window_->children()); |
639 } | 635 } |
640 | 636 |
641 WmWindow* WmWindow::GetChildByShellWindowId(int id) { | 637 WmWindow* WmWindow::GetChildByShellWindowId(int id) { |
642 return Get(window_->GetChildById(id)); | 638 return Get(window_->GetChildById(id)); |
643 } | 639 } |
644 | 640 |
645 void WmWindow::ShowResizeShadow(int component) { | 641 void WmWindow::ShowResizeShadow(int component) { |
646 if (WmShell::Get()->IsRunningInMash()) { | 642 if (ShellPort::Get()->IsRunningInMash()) { |
647 // TODO: http://crbug.com/640773. | 643 // TODO: http://crbug.com/640773. |
648 return; | 644 return; |
649 } | 645 } |
650 ResizeShadowController* resize_shadow_controller = | 646 ResizeShadowController* resize_shadow_controller = |
651 Shell::Get()->resize_shadow_controller(); | 647 Shell::Get()->resize_shadow_controller(); |
652 if (resize_shadow_controller) | 648 if (resize_shadow_controller) |
653 resize_shadow_controller->ShowShadow(window_, component); | 649 resize_shadow_controller->ShowShadow(window_, component); |
654 } | 650 } |
655 | 651 |
656 void WmWindow::HideResizeShadow() { | 652 void WmWindow::HideResizeShadow() { |
657 if (WmShell::Get()->IsRunningInMash()) { | 653 if (ShellPort::Get()->IsRunningInMash()) { |
658 // TODO: http://crbug.com/640773. | 654 // TODO: http://crbug.com/640773. |
659 return; | 655 return; |
660 } | 656 } |
661 ResizeShadowController* resize_shadow_controller = | 657 ResizeShadowController* resize_shadow_controller = |
662 Shell::Get()->resize_shadow_controller(); | 658 Shell::Get()->resize_shadow_controller(); |
663 if (resize_shadow_controller) | 659 if (resize_shadow_controller) |
664 resize_shadow_controller->HideShadow(window_); | 660 resize_shadow_controller->HideShadow(window_); |
665 } | 661 } |
666 | 662 |
667 void WmWindow::InstallResizeHandleWindowTargeter( | 663 void WmWindow::InstallResizeHandleWindowTargeter( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 transient_observers_.RemoveObserver(observer); | 714 transient_observers_.RemoveObserver(observer); |
719 if (added_transient_observer_ && | 715 if (added_transient_observer_ && |
720 !transient_observers_.might_have_observers()) { | 716 !transient_observers_.might_have_observers()) { |
721 added_transient_observer_ = false; | 717 added_transient_observer_ = false; |
722 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); | 718 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); |
723 } | 719 } |
724 } | 720 } |
725 | 721 |
726 void WmWindow::AddLimitedPreTargetHandler(ui::EventHandler* handler) { | 722 void WmWindow::AddLimitedPreTargetHandler(ui::EventHandler* handler) { |
727 // In mus AddPreTargetHandler() only works for windows created by this client. | 723 // In mus AddPreTargetHandler() only works for windows created by this client. |
728 DCHECK(!WmShell::Get()->IsRunningInMash() || | 724 DCHECK(!ShellPort::Get()->IsRunningInMash() || |
729 Shell::window_tree_client()->WasCreatedByThisClient( | 725 Shell::window_tree_client()->WasCreatedByThisClient( |
730 aura::WindowMus::Get(window_))); | 726 aura::WindowMus::Get(window_))); |
731 window_->AddPreTargetHandler(handler); | 727 window_->AddPreTargetHandler(handler); |
732 } | 728 } |
733 | 729 |
734 void WmWindow::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { | 730 void WmWindow::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { |
735 window_->RemovePreTargetHandler(handler); | 731 window_->RemovePreTargetHandler(handler); |
736 } | 732 } |
737 | 733 |
738 WmWindow::WmWindow(aura::Window* window) | 734 WmWindow::WmWindow(aura::Window* window) |
(...skipping 28 matching lines...) Expand all Loading... |
767 observer.OnTransientChildAdded(this, Get(transient)); | 763 observer.OnTransientChildAdded(this, Get(transient)); |
768 } | 764 } |
769 | 765 |
770 void WmWindow::OnTransientChildRemoved(aura::Window* window, | 766 void WmWindow::OnTransientChildRemoved(aura::Window* window, |
771 aura::Window* transient) { | 767 aura::Window* transient) { |
772 for (auto& observer : transient_observers_) | 768 for (auto& observer : transient_observers_) |
773 observer.OnTransientChildRemoved(this, Get(transient)); | 769 observer.OnTransientChildRemoved(this, Get(transient)); |
774 } | 770 } |
775 | 771 |
776 } // namespace ash | 772 } // namespace ash |
OLD | NEW |