Chromium Code Reviews| 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" |
| 11 #include "ash/common/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
| 12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
| 13 #include "ash/common/wm_layout_manager.h" | 13 #include "ash/common/wm_layout_manager.h" |
| 14 #include "ash/common/wm_transient_window_observer.h" | 14 #include "ash/common/wm_transient_window_observer.h" |
| 15 #include "ash/common/wm_window_observer.h" | 15 #include "ash/common/wm_window_observer.h" |
| 16 #include "ash/common/wm_window_property.h" | 16 #include "ash/common/wm_window_property.h" |
| 17 #include "ash/screen_util.h" | 17 #include "ash/screen_util.h" |
| 18 #include "ash/shelf/shelf_util.h" | 18 #include "ash/shelf/shelf_util.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/wm/resize_handle_window_targeter.h" | 20 #include "ash/wm/resize_handle_window_targeter.h" |
| 21 #include "ash/wm/resize_shadow_controller.h" | 21 #include "ash/wm/resize_shadow_controller.h" |
| 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 "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
| 29 #include "ui/aura/client/focus_client.h" | |
| 29 #include "ui/aura/client/window_tree_client.h" | 30 #include "ui/aura/client/window_tree_client.h" |
| 30 #include "ui/aura/layout_manager.h" | 31 #include "ui/aura/layout_manager.h" |
| 31 #include "ui/aura/window.h" | 32 #include "ui/aura/window.h" |
| 32 #include "ui/aura/window_delegate.h" | 33 #include "ui/aura/window_delegate.h" |
| 33 #include "ui/aura/window_property.h" | 34 #include "ui/aura/window_property.h" |
| 34 #include "ui/base/hit_test.h" | 35 #include "ui/base/hit_test.h" |
| 35 #include "ui/compositor/layer_tree_owner.h" | 36 #include "ui/compositor/layer_tree_owner.h" |
| 36 #include "ui/compositor/scoped_layer_animation_settings.h" | 37 #include "ui/compositor/scoped_layer_animation_settings.h" |
| 37 #include "ui/display/screen.h" | 38 #include "ui/display/screen.h" |
| 38 #include "ui/gfx/geometry/insets.h" | 39 #include "ui/gfx/geometry/insets.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 void WmWindowAura::SetParentUsingContext(WmWindow* context, | 362 void WmWindowAura::SetParentUsingContext(WmWindow* context, |
| 362 const gfx::Rect& screen_bounds) { | 363 const gfx::Rect& screen_bounds) { |
| 363 aura::client::ParentWindowWithContext(window_, GetAuraWindow(context), | 364 aura::client::ParentWindowWithContext(window_, GetAuraWindow(context), |
| 364 screen_bounds); | 365 screen_bounds); |
| 365 } | 366 } |
| 366 | 367 |
| 367 void WmWindowAura::AddChild(WmWindow* window) { | 368 void WmWindowAura::AddChild(WmWindow* window) { |
| 368 window_->AddChild(GetAuraWindow(window)); | 369 window_->AddChild(GetAuraWindow(window)); |
| 369 } | 370 } |
| 370 | 371 |
| 371 WmWindow* WmWindowAura::GetParent() { | 372 const WmWindow* WmWindowAura::GetParent() const { |
| 372 return Get(window_->parent()); | 373 return Get(window_->parent()); |
| 373 } | 374 } |
| 374 | 375 |
| 375 const WmWindow* WmWindowAura::GetTransientParent() const { | 376 const WmWindow* WmWindowAura::GetTransientParent() const { |
| 376 return Get(::wm::GetTransientParent(window_)); | 377 return Get(::wm::GetTransientParent(window_)); |
| 377 } | 378 } |
| 378 | 379 |
| 379 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() { | 380 std::vector<WmWindow*> WmWindowAura::GetTransientChildren() { |
| 380 return FromAuraWindows(::wm::GetTransientChildren(window_)); | 381 return FromAuraWindows(::wm::GetTransientChildren(window_)); |
| 381 } | 382 } |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 547 } | 548 } |
| 548 window_->SetProperty(kRestoreShowStateOverrideKey, window_state_override); | 549 window_->SetProperty(kRestoreShowStateOverrideKey, window_state_override); |
| 549 window_->SetProperty(kRestoreBoundsOverrideKey, | 550 window_->SetProperty(kRestoreBoundsOverrideKey, |
| 550 new gfx::Rect(bounds_override)); | 551 new gfx::Rect(bounds_override)); |
| 551 } | 552 } |
| 552 | 553 |
| 553 void WmWindowAura::SetLockedToRoot(bool value) { | 554 void WmWindowAura::SetLockedToRoot(bool value) { |
| 554 window_->SetProperty(kStayInSameRootWindowKey, value); | 555 window_->SetProperty(kStayInSameRootWindowKey, value); |
| 555 } | 556 } |
| 556 | 557 |
| 558 bool WmWindowAura::IsLockedToRoot() const { | |
| 559 return window_->GetProperty(kStayInSameRootWindowKey); | |
|
James Cook
2016/09/15 16:31:40
It's a little weird that many of the functions are
sky
2016/09/15 17:35:03
I went with LockedToRoot everywhere.
| |
| 560 } | |
| 561 | |
| 557 void WmWindowAura::SetCapture() { | 562 void WmWindowAura::SetCapture() { |
| 558 window_->SetCapture(); | 563 window_->SetCapture(); |
| 559 } | 564 } |
| 560 | 565 |
| 561 bool WmWindowAura::HasCapture() { | 566 bool WmWindowAura::HasCapture() { |
| 562 return window_->HasCapture(); | 567 return window_->HasCapture(); |
| 563 } | 568 } |
| 564 | 569 |
| 565 void WmWindowAura::ReleaseCapture() { | 570 void WmWindowAura::ReleaseCapture() { |
| 566 window_->ReleaseCapture(); | 571 window_->ReleaseCapture(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 620 | 625 |
| 621 views::Widget* WmWindowAura::GetInternalWidget() { | 626 views::Widget* WmWindowAura::GetInternalWidget() { |
| 622 return views::Widget::GetWidgetForNativeView(window_); | 627 return views::Widget::GetWidgetForNativeView(window_); |
| 623 } | 628 } |
| 624 | 629 |
| 625 void WmWindowAura::CloseWidget() { | 630 void WmWindowAura::CloseWidget() { |
| 626 DCHECK(GetInternalWidget()); | 631 DCHECK(GetInternalWidget()); |
| 627 GetInternalWidget()->Close(); | 632 GetInternalWidget()->Close(); |
| 628 } | 633 } |
| 629 | 634 |
| 635 void WmWindowAura::SetFocused() { | |
| 636 aura::client::GetFocusClient(window_)->FocusWindow(window_); | |
| 637 } | |
| 638 | |
| 630 bool WmWindowAura::IsFocused() const { | 639 bool WmWindowAura::IsFocused() const { |
| 631 return window_->HasFocus(); | 640 return window_->HasFocus(); |
| 632 } | 641 } |
| 633 | 642 |
| 634 bool WmWindowAura::IsActive() const { | 643 bool WmWindowAura::IsActive() const { |
| 635 return wm::IsActiveWindow(window_); | 644 return wm::IsActiveWindow(window_); |
| 636 } | 645 } |
| 637 | 646 |
| 638 void WmWindowAura::Activate() { | 647 void WmWindowAura::Activate() { |
| 639 wm::ActivateWindow(window_); | 648 wm::ActivateWindow(window_); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 void WmWindowAura::SetChildrenUseExtendedHitRegion() { | 722 void WmWindowAura::SetChildrenUseExtendedHitRegion() { |
| 714 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize, | 723 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, -kResizeOutsideBoundsSize, |
| 715 -kResizeOutsideBoundsSize, | 724 -kResizeOutsideBoundsSize, |
| 716 -kResizeOutsideBoundsSize); | 725 -kResizeOutsideBoundsSize); |
| 717 gfx::Insets touch_extend = | 726 gfx::Insets touch_extend = |
| 718 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); | 727 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); |
| 719 window_->SetEventTargeter(base::MakeUnique<::wm::EasyResizeWindowTargeter>( | 728 window_->SetEventTargeter(base::MakeUnique<::wm::EasyResizeWindowTargeter>( |
| 720 window_, mouse_extend, touch_extend)); | 729 window_, mouse_extend, touch_extend)); |
| 721 } | 730 } |
| 722 | 731 |
| 723 void WmWindowAura::SetDescendantsStayInSameRootWindow(bool value) { | |
| 724 window_->SetProperty(kStayInSameRootWindowKey, true); | |
| 725 } | |
| 726 | |
| 727 std::unique_ptr<views::View> WmWindowAura::CreateViewWithRecreatedLayers() { | 732 std::unique_ptr<views::View> WmWindowAura::CreateViewWithRecreatedLayers() { |
| 728 return base::MakeUnique<wm::WindowMirrorView>(this); | 733 return base::MakeUnique<wm::WindowMirrorView>(this); |
| 729 } | 734 } |
| 730 | 735 |
| 731 void WmWindowAura::AddObserver(WmWindowObserver* observer) { | 736 void WmWindowAura::AddObserver(WmWindowObserver* observer) { |
| 732 observers_.AddObserver(observer); | 737 observers_.AddObserver(observer); |
| 733 } | 738 } |
| 734 | 739 |
| 735 void WmWindowAura::RemoveObserver(WmWindowObserver* observer) { | 740 void WmWindowAura::RemoveObserver(WmWindowObserver* observer) { |
| 736 observers_.RemoveObserver(observer); | 741 observers_.RemoveObserver(observer); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 859 OnTransientChildAdded(this, Get(transient))); | 864 OnTransientChildAdded(this, Get(transient))); |
| 860 } | 865 } |
| 861 | 866 |
| 862 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, | 867 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, |
| 863 aura::Window* transient) { | 868 aura::Window* transient) { |
| 864 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 869 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, |
| 865 OnTransientChildRemoved(this, Get(transient))); | 870 OnTransientChildRemoved(this, Get(transient))); |
| 866 } | 871 } |
| 867 | 872 |
| 868 } // namespace ash | 873 } // namespace ash |
| OLD | NEW |