Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(353)

Side by Side Diff: ash/aura/wm_window_aura.cc

Issue 2613863005: Removes/promotes functions from WmWindowMus to WmWindowAura (Closed)
Patch Set: window_ part2 Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/mus/bridge/wm_window_mus.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 NOTREACHED(); 341 NOTREACHED();
342 } 342 }
343 343
344 int WmWindowAura::GetIntProperty(WmWindowProperty key) { 344 int WmWindowAura::GetIntProperty(WmWindowProperty key) {
345 if (key == WmWindowProperty::MODAL_TYPE) 345 if (key == WmWindowProperty::MODAL_TYPE)
346 return window_->GetProperty(aura::client::kModalKey); 346 return window_->GetProperty(aura::client::kModalKey);
347 347
348 if (key == WmWindowProperty::SHELF_ID) 348 if (key == WmWindowProperty::SHELF_ID)
349 return window_->GetProperty(kShelfIDKey); 349 return window_->GetProperty(kShelfIDKey);
350 350
351 if (key == WmWindowProperty::SHELF_ITEM_TYPE) 351 if (key == WmWindowProperty::SHELF_ITEM_TYPE) {
352 return window_->GetProperty(kShelfItemTypeKey); 352 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::LOCAL ||
353 window_->GetProperty(kShelfItemTypeKey) != TYPE_UNDEFINED) {
354 return window_->GetProperty(kShelfItemTypeKey);
355 }
356 // Mash provides a default shelf item type for non-ignored windows.
357 return GetWindowState()->ignored_by_shelf() ? TYPE_UNDEFINED : TYPE_APP;
358 }
353 359
354 if (key == WmWindowProperty::TOP_VIEW_INSET) 360 if (key == WmWindowProperty::TOP_VIEW_INSET)
355 return window_->GetProperty(aura::client::kTopViewInset); 361 return window_->GetProperty(aura::client::kTopViewInset);
356 362
357 NOTREACHED(); 363 NOTREACHED();
358 return 0; 364 return 0;
359 } 365 }
360 366
361 void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) { 367 void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) {
362 if (key == WmWindowProperty::SHELF_ID) { 368 if (key == WmWindowProperty::SHELF_ID) {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 return (window_->GetProperty(aura::client::kResizeBehaviorKey) & 659 return (window_->GetProperty(aura::client::kResizeBehaviorKey) &
654 ui::mojom::kResizeBehaviorCanMinimize) != 0; 660 ui::mojom::kResizeBehaviorCanMinimize) != 0;
655 } 661 }
656 662
657 bool WmWindowAura::CanResize() const { 663 bool WmWindowAura::CanResize() const {
658 return (window_->GetProperty(aura::client::kResizeBehaviorKey) & 664 return (window_->GetProperty(aura::client::kResizeBehaviorKey) &
659 ui::mojom::kResizeBehaviorCanResize) != 0; 665 ui::mojom::kResizeBehaviorCanResize) != 0;
660 } 666 }
661 667
662 bool WmWindowAura::CanActivate() const { 668 bool WmWindowAura::CanActivate() const {
669 // TODO(sky): for aura-mus need to key off CanFocus() as well, which is not
670 // currently mirrored to ash.
663 return ::wm::CanActivateWindow(window_); 671 return ::wm::CanActivateWindow(window_);
664 } 672 }
665 673
666 void WmWindowAura::StackChildAtTop(WmWindow* child) { 674 void WmWindowAura::StackChildAtTop(WmWindow* child) {
667 window_->StackChildAtTop(GetAuraWindow(child)); 675 window_->StackChildAtTop(GetAuraWindow(child));
668 } 676 }
669 677
670 void WmWindowAura::StackChildAtBottom(WmWindow* child) { 678 void WmWindowAura::StackChildAtBottom(WmWindow* child) {
671 window_->StackChildAtBottom(GetAuraWindow(child)); 679 window_->StackChildAtBottom(GetAuraWindow(child));
672 } 680 }
673 681
674 void WmWindowAura::StackChildAbove(WmWindow* child, WmWindow* target) { 682 void WmWindowAura::StackChildAbove(WmWindow* child, WmWindow* target) {
675 window_->StackChildAbove(GetAuraWindow(child), GetAuraWindow(target)); 683 window_->StackChildAbove(GetAuraWindow(child), GetAuraWindow(target));
676 } 684 }
677 685
678 void WmWindowAura::StackChildBelow(WmWindow* child, WmWindow* target) { 686 void WmWindowAura::StackChildBelow(WmWindow* child, WmWindow* target) {
679 window_->StackChildBelow(GetAuraWindow(child), GetAuraWindow(target)); 687 window_->StackChildBelow(GetAuraWindow(child), GetAuraWindow(target));
680 } 688 }
681 689
682 void WmWindowAura::SetPinned(bool trusted) { 690 void WmWindowAura::SetPinned(bool trusted) {
691 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) {
692 // TODO: fix, see http://crbug.com/622486. With aura-mus pinning may just
693 // work.
694 NOTIMPLEMENTED();
695 return;
696 }
683 wm::PinWindow(window_, trusted); 697 wm::PinWindow(window_, trusted);
684 } 698 }
685 699
686 void WmWindowAura::SetAlwaysOnTop(bool value) { 700 void WmWindowAura::SetAlwaysOnTop(bool value) {
687 window_->SetProperty(aura::client::kAlwaysOnTopKey, value); 701 window_->SetProperty(aura::client::kAlwaysOnTopKey, value);
688 } 702 }
689 703
690 bool WmWindowAura::IsAlwaysOnTop() const { 704 bool WmWindowAura::IsAlwaysOnTop() const {
691 return window_->GetProperty(aura::client::kAlwaysOnTopKey); 705 return window_->GetProperty(aura::client::kAlwaysOnTopKey);
692 } 706 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 766
753 std::vector<WmWindow*> WmWindowAura::GetChildren() { 767 std::vector<WmWindow*> WmWindowAura::GetChildren() {
754 return FromAuraWindows(window_->children()); 768 return FromAuraWindows(window_->children());
755 } 769 }
756 770
757 WmWindow* WmWindowAura::GetChildByShellWindowId(int id) { 771 WmWindow* WmWindowAura::GetChildByShellWindowId(int id) {
758 return Get(window_->GetChildById(id)); 772 return Get(window_->GetChildById(id));
759 } 773 }
760 774
761 void WmWindowAura::ShowResizeShadow(int component) { 775 void WmWindowAura::ShowResizeShadow(int component) {
776 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) {
777 // TODO: http://crbug.com/640773.
778 return;
779 }
762 ResizeShadowController* resize_shadow_controller = 780 ResizeShadowController* resize_shadow_controller =
763 Shell::GetInstance()->resize_shadow_controller(); 781 Shell::GetInstance()->resize_shadow_controller();
764 if (resize_shadow_controller) 782 if (resize_shadow_controller)
765 resize_shadow_controller->ShowShadow(window_, component); 783 resize_shadow_controller->ShowShadow(window_, component);
766 } 784 }
767 785
768 void WmWindowAura::HideResizeShadow() { 786 void WmWindowAura::HideResizeShadow() {
787 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) {
788 // TODO: http://crbug.com/640773.
789 return;
790 }
769 ResizeShadowController* resize_shadow_controller = 791 ResizeShadowController* resize_shadow_controller =
770 Shell::GetInstance()->resize_shadow_controller(); 792 Shell::GetInstance()->resize_shadow_controller();
771 if (resize_shadow_controller) 793 if (resize_shadow_controller)
772 resize_shadow_controller->HideShadow(window_); 794 resize_shadow_controller->HideShadow(window_);
773 } 795 }
774 796
775 void WmWindowAura::InstallResizeHandleWindowTargeter( 797 void WmWindowAura::InstallResizeHandleWindowTargeter(
776 ImmersiveFullscreenController* immersive_fullscreen_controller) { 798 ImmersiveFullscreenController* immersive_fullscreen_controller) {
799 if (aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS) {
800 // TODO(sky): I believe once ImmersiveFullscreenController is ported this
801 // won't be necessary in mash, but I need to verify that:
802 // http://crbug.com/548435.
803 return;
804 }
777 window_->SetEventTargeter(base::MakeUnique<ResizeHandleWindowTargeter>( 805 window_->SetEventTargeter(base::MakeUnique<ResizeHandleWindowTargeter>(
778 window_, immersive_fullscreen_controller)); 806 window_, immersive_fullscreen_controller));
779 } 807 }
780 808
781 void WmWindowAura::SetBoundsInScreenBehaviorForChildren( 809 void WmWindowAura::SetBoundsInScreenBehaviorForChildren(
782 BoundsInScreenBehavior behavior) { 810 BoundsInScreenBehavior behavior) {
783 window_->SetProperty( 811 window_->SetProperty(
784 kUsesScreenCoordinatesKey, 812 kUsesScreenCoordinatesKey,
785 behavior == BoundsInScreenBehavior::USE_SCREEN_COORDINATES); 813 behavior == BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
786 } 814 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 observer.OnTransientChildAdded(this, Get(transient)); 995 observer.OnTransientChildAdded(this, Get(transient));
968 } 996 }
969 997
970 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, 998 void WmWindowAura::OnTransientChildRemoved(aura::Window* window,
971 aura::Window* transient) { 999 aura::Window* transient) {
972 for (auto& observer : transient_observers_) 1000 for (auto& observer : transient_observers_)
973 observer.OnTransientChildRemoved(this, Get(transient)); 1001 observer.OnTransientChildRemoved(this, Get(transient));
974 } 1002 }
975 1003
976 } // namespace ash 1004 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/mus/bridge/wm_window_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698