| 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/public/cpp/config.h" |
| 9 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
| 10 #include "ash/public/cpp/window_properties.h" | 11 #include "ash/public/cpp/window_properties.h" |
| 11 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
| 12 #include "ash/shell.h" | 13 #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 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 | 569 |
| 570 void WmWindow::Hide() { | 570 void WmWindow::Hide() { |
| 571 window_->Hide(); | 571 window_->Hide(); |
| 572 } | 572 } |
| 573 | 573 |
| 574 void WmWindow::Show() { | 574 void WmWindow::Show() { |
| 575 window_->Show(); | 575 window_->Show(); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void WmWindow::CloseWidget() { | 578 void WmWindow::CloseWidget() { |
| 579 if (ShellPort::Get()->IsRunningInMash() && | 579 if (Shell::GetAshConfig() == Config::MASH && |
| 580 aura_window()->GetProperty(kWidgetCreationTypeKey) == | 580 aura_window()->GetProperty(kWidgetCreationTypeKey) == |
| 581 WidgetCreationType::FOR_CLIENT) { | 581 WidgetCreationType::FOR_CLIENT) { |
| 582 // 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 |
| 583 // 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 |
| 584 // renders the non-client frame. | 584 // renders the non-client frame. |
| 585 DCHECK(Shell::window_manager_client()); | 585 DCHECK(Shell::window_manager_client()); |
| 586 Shell::window_manager_client()->RequestClose(aura_window()); | 586 Shell::window_manager_client()->RequestClose(aura_window()); |
| 587 return; | 587 return; |
| 588 } | 588 } |
| 589 views::Widget* widget = GetInternalWidgetForWindow(window_); | 589 views::Widget* widget = GetInternalWidgetForWindow(window_); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 std::vector<WmWindow*> WmWindow::GetChildren() { | 633 std::vector<WmWindow*> WmWindow::GetChildren() { |
| 634 return FromAuraWindows(window_->children()); | 634 return FromAuraWindows(window_->children()); |
| 635 } | 635 } |
| 636 | 636 |
| 637 WmWindow* WmWindow::GetChildByShellWindowId(int id) { | 637 WmWindow* WmWindow::GetChildByShellWindowId(int id) { |
| 638 return Get(window_->GetChildById(id)); | 638 return Get(window_->GetChildById(id)); |
| 639 } | 639 } |
| 640 | 640 |
| 641 void WmWindow::ShowResizeShadow(int component) { | 641 void WmWindow::ShowResizeShadow(int component) { |
| 642 if (ShellPort::Get()->IsRunningInMash()) { | 642 if (Shell::GetAshConfig() == Config::MASH) { |
| 643 // TODO: http://crbug.com/640773. | 643 // TODO: http://crbug.com/640773. |
| 644 return; | 644 return; |
| 645 } | 645 } |
| 646 ResizeShadowController* resize_shadow_controller = | 646 ResizeShadowController* resize_shadow_controller = |
| 647 Shell::Get()->resize_shadow_controller(); | 647 Shell::Get()->resize_shadow_controller(); |
| 648 if (resize_shadow_controller) | 648 if (resize_shadow_controller) |
| 649 resize_shadow_controller->ShowShadow(window_, component); | 649 resize_shadow_controller->ShowShadow(window_, component); |
| 650 } | 650 } |
| 651 | 651 |
| 652 void WmWindow::HideResizeShadow() { | 652 void WmWindow::HideResizeShadow() { |
| 653 if (ShellPort::Get()->IsRunningInMash()) { | 653 if (Shell::GetAshConfig() == Config::MASH) { |
| 654 // TODO: http://crbug.com/640773. | 654 // TODO: http://crbug.com/640773. |
| 655 return; | 655 return; |
| 656 } | 656 } |
| 657 ResizeShadowController* resize_shadow_controller = | 657 ResizeShadowController* resize_shadow_controller = |
| 658 Shell::Get()->resize_shadow_controller(); | 658 Shell::Get()->resize_shadow_controller(); |
| 659 if (resize_shadow_controller) | 659 if (resize_shadow_controller) |
| 660 resize_shadow_controller->HideShadow(window_); | 660 resize_shadow_controller->HideShadow(window_); |
| 661 } | 661 } |
| 662 | 662 |
| 663 void WmWindow::InstallResizeHandleWindowTargeter( | 663 void WmWindow::InstallResizeHandleWindowTargeter( |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 transient_observers_.RemoveObserver(observer); | 714 transient_observers_.RemoveObserver(observer); |
| 715 if (added_transient_observer_ && | 715 if (added_transient_observer_ && |
| 716 !transient_observers_.might_have_observers()) { | 716 !transient_observers_.might_have_observers()) { |
| 717 added_transient_observer_ = false; | 717 added_transient_observer_ = false; |
| 718 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); | 718 ::wm::TransientWindowManager::Get(window_)->RemoveObserver(this); |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 | 721 |
| 722 void WmWindow::AddLimitedPreTargetHandler(ui::EventHandler* handler) { | 722 void WmWindow::AddLimitedPreTargetHandler(ui::EventHandler* handler) { |
| 723 // In mus AddPreTargetHandler() only works for windows created by this client. | 723 // In mus AddPreTargetHandler() only works for windows created by this client. |
| 724 DCHECK(!ShellPort::Get()->IsRunningInMash() || | 724 DCHECK(Shell::GetAshConfig() != Config::MASH || |
| 725 Shell::window_tree_client()->WasCreatedByThisClient( | 725 Shell::window_tree_client()->WasCreatedByThisClient( |
| 726 aura::WindowMus::Get(window_))); | 726 aura::WindowMus::Get(window_))); |
| 727 window_->AddPreTargetHandler(handler); | 727 window_->AddPreTargetHandler(handler); |
| 728 } | 728 } |
| 729 | 729 |
| 730 void WmWindow::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { | 730 void WmWindow::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { |
| 731 window_->RemovePreTargetHandler(handler); | 731 window_->RemovePreTargetHandler(handler); |
| 732 } | 732 } |
| 733 | 733 |
| 734 WmWindow::WmWindow(aura::Window* window) | 734 WmWindow::WmWindow(aura::Window* window) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 763 observer.OnTransientChildAdded(this, Get(transient)); | 763 observer.OnTransientChildAdded(this, Get(transient)); |
| 764 } | 764 } |
| 765 | 765 |
| 766 void WmWindow::OnTransientChildRemoved(aura::Window* window, | 766 void WmWindow::OnTransientChildRemoved(aura::Window* window, |
| 767 aura::Window* transient) { | 767 aura::Window* transient) { |
| 768 for (auto& observer : transient_observers_) | 768 for (auto& observer : transient_observers_) |
| 769 observer.OnTransientChildRemoved(this, Get(transient)); | 769 observer.OnTransientChildRemoved(this, Get(transient)); |
| 770 } | 770 } |
| 771 | 771 |
| 772 } // namespace ash | 772 } // namespace ash |
| OLD | NEW |