| 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" |
| (...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 803 void WmWindowAura::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { | 803 void WmWindowAura::RemoveLimitedPreTargetHandler(ui::EventHandler* handler) { |
| 804 window_->RemovePreTargetHandler(handler); | 804 window_->RemovePreTargetHandler(handler); |
| 805 } | 805 } |
| 806 | 806 |
| 807 void WmWindowAura::OnWindowHierarchyChanging( | 807 void WmWindowAura::OnWindowHierarchyChanging( |
| 808 const HierarchyChangeParams& params) { | 808 const HierarchyChangeParams& params) { |
| 809 WmWindowObserver::TreeChangeParams wm_params; | 809 WmWindowObserver::TreeChangeParams wm_params; |
| 810 wm_params.target = Get(params.target); | 810 wm_params.target = Get(params.target); |
| 811 wm_params.new_parent = Get(params.new_parent); | 811 wm_params.new_parent = Get(params.new_parent); |
| 812 wm_params.old_parent = Get(params.old_parent); | 812 wm_params.old_parent = Get(params.old_parent); |
| 813 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 813 for (auto& observer : observers_) |
| 814 OnWindowTreeChanging(this, wm_params)); | 814 observer.OnWindowTreeChanging(this, wm_params); |
| 815 } | 815 } |
| 816 | 816 |
| 817 void WmWindowAura::OnWindowHierarchyChanged( | 817 void WmWindowAura::OnWindowHierarchyChanged( |
| 818 const HierarchyChangeParams& params) { | 818 const HierarchyChangeParams& params) { |
| 819 WmWindowObserver::TreeChangeParams wm_params; | 819 WmWindowObserver::TreeChangeParams wm_params; |
| 820 wm_params.target = Get(params.target); | 820 wm_params.target = Get(params.target); |
| 821 wm_params.new_parent = Get(params.new_parent); | 821 wm_params.new_parent = Get(params.new_parent); |
| 822 wm_params.old_parent = Get(params.old_parent); | 822 wm_params.old_parent = Get(params.old_parent); |
| 823 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 823 for (auto& observer : observers_) |
| 824 OnWindowTreeChanged(this, wm_params)); | 824 observer.OnWindowTreeChanged(this, wm_params); |
| 825 } | 825 } |
| 826 | 826 |
| 827 void WmWindowAura::OnWindowStackingChanged(aura::Window* window) { | 827 void WmWindowAura::OnWindowStackingChanged(aura::Window* window) { |
| 828 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 828 for (auto& observer : observers_) |
| 829 OnWindowStackingChanged(this)); | 829 observer.OnWindowStackingChanged(this); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window, | 832 void WmWindowAura::OnWindowPropertyChanged(aura::Window* window, |
| 833 const void* key, | 833 const void* key, |
| 834 intptr_t old) { | 834 intptr_t old) { |
| 835 if (key == aura::client::kShowStateKey) { | 835 if (key == aura::client::kShowStateKey) { |
| 836 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); | 836 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); |
| 837 return; | 837 return; |
| 838 } | 838 } |
| 839 WmWindowProperty wm_property; | 839 WmWindowProperty wm_property; |
| 840 if (key == aura::client::kAlwaysOnTopKey) { | 840 if (key == aura::client::kAlwaysOnTopKey) { |
| 841 wm_property = WmWindowProperty::ALWAYS_ON_TOP; | 841 wm_property = WmWindowProperty::ALWAYS_ON_TOP; |
| 842 } else if (key == aura::client::kExcludeFromMruKey) { | 842 } else if (key == aura::client::kExcludeFromMruKey) { |
| 843 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; | 843 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; |
| 844 } else if (key == aura::client::kModalKey) { | 844 } else if (key == aura::client::kModalKey) { |
| 845 wm_property = WmWindowProperty::MODAL_TYPE; | 845 wm_property = WmWindowProperty::MODAL_TYPE; |
| 846 } else if (key == kShelfIconResourceIdKey) { | 846 } else if (key == kShelfIconResourceIdKey) { |
| 847 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID; | 847 wm_property = WmWindowProperty::SHELF_ICON_RESOURCE_ID; |
| 848 } else if (key == kShelfIDKey) { | 848 } else if (key == kShelfIDKey) { |
| 849 wm_property = WmWindowProperty::SHELF_ID; | 849 wm_property = WmWindowProperty::SHELF_ID; |
| 850 } else if (key == kShelfItemTypeKey) { | 850 } else if (key == kShelfItemTypeKey) { |
| 851 wm_property = WmWindowProperty::SHELF_ITEM_TYPE; | 851 wm_property = WmWindowProperty::SHELF_ITEM_TYPE; |
| 852 } else if (key == kSnapChildrenToPixelBoundary) { | 852 } else if (key == kSnapChildrenToPixelBoundary) { |
| 853 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; | 853 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; |
| 854 } else if (key == aura::client::kTopViewInset) { | 854 } else if (key == aura::client::kTopViewInset) { |
| 855 wm_property = WmWindowProperty::TOP_VIEW_INSET; | 855 wm_property = WmWindowProperty::TOP_VIEW_INSET; |
| 856 } else { | 856 } else { |
| 857 return; | 857 return; |
| 858 } | 858 } |
| 859 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 859 for (auto& observer : observers_) |
| 860 OnWindowPropertyChanged(this, wm_property)); | 860 observer.OnWindowPropertyChanged(this, wm_property); |
| 861 } | 861 } |
| 862 | 862 |
| 863 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window, | 863 void WmWindowAura::OnWindowBoundsChanged(aura::Window* window, |
| 864 const gfx::Rect& old_bounds, | 864 const gfx::Rect& old_bounds, |
| 865 const gfx::Rect& new_bounds) { | 865 const gfx::Rect& new_bounds) { |
| 866 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 866 for (auto& observer : observers_) |
| 867 OnWindowBoundsChanged(this, old_bounds, new_bounds)); | 867 observer.OnWindowBoundsChanged(this, old_bounds, new_bounds); |
| 868 } | 868 } |
| 869 | 869 |
| 870 void WmWindowAura::OnWindowDestroying(aura::Window* window) { | 870 void WmWindowAura::OnWindowDestroying(aura::Window* window) { |
| 871 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroying(this)); | 871 for (auto& observer : observers_) |
| 872 observer.OnWindowDestroying(this); |
| 872 } | 873 } |
| 873 | 874 |
| 874 void WmWindowAura::OnWindowDestroyed(aura::Window* window) { | 875 void WmWindowAura::OnWindowDestroyed(aura::Window* window) { |
| 875 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowDestroyed(this)); | 876 for (auto& observer : observers_) |
| 877 observer.OnWindowDestroyed(this); |
| 876 } | 878 } |
| 877 | 879 |
| 878 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window, | 880 void WmWindowAura::OnWindowVisibilityChanging(aura::Window* window, |
| 879 bool visible) { | 881 bool visible) { |
| 880 DCHECK_EQ(window, window_); | 882 DCHECK_EQ(window, window_); |
| 881 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 883 for (auto& observer : observers_) |
| 882 OnWindowVisibilityChanging(this, visible)); | 884 observer.OnWindowVisibilityChanging(this, visible); |
| 883 } | 885 } |
| 884 | 886 |
| 885 void WmWindowAura::OnWindowVisibilityChanged(aura::Window* window, | 887 void WmWindowAura::OnWindowVisibilityChanged(aura::Window* window, |
| 886 bool visible) { | 888 bool visible) { |
| 887 FOR_EACH_OBSERVER(WmWindowObserver, observers_, | 889 for (auto& observer : observers_) |
| 888 OnWindowVisibilityChanged(Get(window), visible)); | 890 observer.OnWindowVisibilityChanged(Get(window), visible); |
| 889 } | 891 } |
| 890 | 892 |
| 891 void WmWindowAura::OnWindowTitleChanged(aura::Window* window) { | 893 void WmWindowAura::OnWindowTitleChanged(aura::Window* window) { |
| 892 FOR_EACH_OBSERVER(WmWindowObserver, observers_, OnWindowTitleChanged(this)); | 894 for (auto& observer : observers_) |
| 895 observer.OnWindowTitleChanged(this); |
| 893 } | 896 } |
| 894 | 897 |
| 895 void WmWindowAura::OnTransientChildAdded(aura::Window* window, | 898 void WmWindowAura::OnTransientChildAdded(aura::Window* window, |
| 896 aura::Window* transient) { | 899 aura::Window* transient) { |
| 897 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 900 for (auto& observer : transient_observers_) |
| 898 OnTransientChildAdded(this, Get(transient))); | 901 observer.OnTransientChildAdded(this, Get(transient)); |
| 899 } | 902 } |
| 900 | 903 |
| 901 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, | 904 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, |
| 902 aura::Window* transient) { | 905 aura::Window* transient) { |
| 903 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 906 for (auto& observer : transient_observers_) |
| 904 OnTransientChildRemoved(this, Get(transient))); | 907 observer.OnTransientChildRemoved(this, Get(transient)); |
| 905 } | 908 } |
| 906 | 909 |
| 907 } // namespace ash | 910 } // namespace ash |
| OLD | NEW |