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/shelf/shelf_item_types.h" |
11 #include "ash/common/shell_window_ids.h" | 12 #include "ash/common/shell_window_ids.h" |
12 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
13 #include "ash/common/wm_layout_manager.h" | 14 #include "ash/common/wm_layout_manager.h" |
14 #include "ash/common/wm_transient_window_observer.h" | 15 #include "ash/common/wm_transient_window_observer.h" |
15 #include "ash/common/wm_window_observer.h" | 16 #include "ash/common/wm_window_observer.h" |
16 #include "ash/common/wm_window_property.h" | 17 #include "ash/common/wm_window_property.h" |
17 #include "ash/screen_util.h" | 18 #include "ash/screen_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/window_tree_client.h" | 29 #include "ui/aura/client/window_tree_client.h" |
30 #include "ui/aura/layout_manager.h" | 30 #include "ui/aura/layout_manager.h" |
31 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
32 #include "ui/aura/window_delegate.h" | 32 #include "ui/aura/window_delegate.h" |
33 #include "ui/aura/window_property.h" | 33 #include "ui/aura/window_property.h" |
34 #include "ui/base/hit_test.h" | 34 #include "ui/base/hit_test.h" |
35 #include "ui/compositor/layer_tree_owner.h" | 35 #include "ui/compositor/layer_tree_owner.h" |
36 #include "ui/compositor/scoped_layer_animation_settings.h" | 36 #include "ui/compositor/scoped_layer_animation_settings.h" |
37 #include "ui/display/screen.h" | 37 #include "ui/display/screen.h" |
38 #include "ui/gfx/geometry/insets.h" | 38 #include "ui/gfx/geometry/insets.h" |
39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
40 #include "ui/views/widget/widget_delegate.h" | 40 #include "ui/views/widget/widget_delegate.h" |
41 #include "ui/wm/core/coordinate_conversion.h" | 41 #include "ui/wm/core/coordinate_conversion.h" |
42 #include "ui/wm/core/easy_resize_window_targeter.h" | 42 #include "ui/wm/core/easy_resize_window_targeter.h" |
43 #include "ui/wm/core/transient_window_manager.h" | 43 #include "ui/wm/core/transient_window_manager.h" |
44 #include "ui/wm/core/visibility_controller.h" | 44 #include "ui/wm/core/visibility_controller.h" |
45 #include "ui/wm/core/window_util.h" | 45 #include "ui/wm/core/window_util.h" |
46 | 46 |
| 47 DECLARE_WINDOW_PROPERTY_TYPE(ash::ShelfItemDetails*); |
47 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmWindowAura*); | 48 DECLARE_WINDOW_PROPERTY_TYPE(ash::WmWindowAura*); |
48 | 49 |
49 namespace ash { | 50 namespace ash { |
50 | 51 |
51 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ash::WmWindowAura, kWmWindowKey, nullptr); | 52 DEFINE_WINDOW_PROPERTY_KEY(ShelfID, kShelfIDKey, kInvalidShelfID); |
| 53 |
| 54 DEFINE_OWNED_WINDOW_PROPERTY_KEY(ShelfItemDetails, |
| 55 kShelfItemDetailsKey, |
| 56 nullptr); |
| 57 DEFINE_OWNED_WINDOW_PROPERTY_KEY(WmWindowAura, kWmWindowKey, nullptr); |
52 | 58 |
53 static_assert(aura::Window::kInitialId == kShellWindowId_Invalid, | 59 static_assert(aura::Window::kInitialId == kShellWindowId_Invalid, |
54 "ids must match"); | 60 "ids must match"); |
55 | 61 |
56 namespace { | 62 namespace { |
57 | 63 |
58 // A tentative class to set the bounds on the window. | 64 // A tentative class to set the bounds on the window. |
59 // TODO(oshima): Once all logic is cleaned up, move this to the real layout | 65 // TODO(oshima): Once all logic is cleaned up, move this to the real layout |
60 // manager with proper friendship. | 66 // manager with proper friendship. |
61 class BoundsSetter : public aura::LayoutManager { | 67 class BoundsSetter : public aura::LayoutManager { |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 } | 309 } |
304 | 310 |
305 NOTREACHED(); | 311 NOTREACHED(); |
306 } | 312 } |
307 | 313 |
308 int WmWindowAura::GetIntProperty(WmWindowProperty key) { | 314 int WmWindowAura::GetIntProperty(WmWindowProperty key) { |
309 if (key == WmWindowProperty::MODAL_TYPE) | 315 if (key == WmWindowProperty::MODAL_TYPE) |
310 return window_->GetProperty(aura::client::kModalKey); | 316 return window_->GetProperty(aura::client::kModalKey); |
311 | 317 |
312 if (key == WmWindowProperty::SHELF_ID) | 318 if (key == WmWindowProperty::SHELF_ID) |
313 return GetShelfIDForWindow(window_); | 319 return window_->GetProperty(kShelfIDKey); |
314 | 320 |
315 if (key == WmWindowProperty::TOP_VIEW_INSET) | 321 if (key == WmWindowProperty::TOP_VIEW_INSET) |
316 return window_->GetProperty(aura::client::kTopViewInset); | 322 return window_->GetProperty(aura::client::kTopViewInset); |
317 | 323 |
318 NOTREACHED(); | 324 NOTREACHED(); |
319 return 0; | 325 return 0; |
320 } | 326 } |
321 | 327 |
322 void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) { | 328 void WmWindowAura::SetIntProperty(WmWindowProperty key, int value) { |
323 if (key == WmWindowProperty::SHELF_ID) { | 329 if (key == WmWindowProperty::SHELF_ID) { |
324 SetShelfIDForWindow(value, window_); | 330 window_->SetProperty(kShelfIDKey, value); |
325 return; | 331 return; |
326 } | 332 } |
327 if (key == WmWindowProperty::TOP_VIEW_INSET) { | 333 if (key == WmWindowProperty::TOP_VIEW_INSET) { |
328 window_->SetProperty(aura::client::kTopViewInset, value); | 334 window_->SetProperty(aura::client::kTopViewInset, value); |
329 return; | 335 return; |
330 } | 336 } |
331 | 337 |
332 NOTREACHED(); | 338 NOTREACHED(); |
333 } | 339 } |
334 | 340 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); | 806 ash::wm::GetWindowState(window_)->OnWindowShowStateChanged(); |
801 return; | 807 return; |
802 } | 808 } |
803 WmWindowProperty wm_property; | 809 WmWindowProperty wm_property; |
804 if (key == aura::client::kAlwaysOnTopKey) { | 810 if (key == aura::client::kAlwaysOnTopKey) { |
805 wm_property = WmWindowProperty::ALWAYS_ON_TOP; | 811 wm_property = WmWindowProperty::ALWAYS_ON_TOP; |
806 } else if (key == aura::client::kExcludeFromMruKey) { | 812 } else if (key == aura::client::kExcludeFromMruKey) { |
807 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; | 813 wm_property = WmWindowProperty::EXCLUDE_FROM_MRU; |
808 } else if (key == aura::client::kModalKey) { | 814 } else if (key == aura::client::kModalKey) { |
809 wm_property = WmWindowProperty::MODAL_TYPE; | 815 wm_property = WmWindowProperty::MODAL_TYPE; |
810 } else if (key == kShelfID) { | 816 } else if (key == kShelfIDKey) { |
811 wm_property = WmWindowProperty::SHELF_ID; | 817 wm_property = WmWindowProperty::SHELF_ID; |
812 } else if (key == kShelfItemDetailsKey) { | 818 } else if (key == kShelfItemDetailsKey) { |
813 wm_property = WmWindowProperty::SHELF_ITEM_DETAILS; | 819 wm_property = WmWindowProperty::SHELF_ITEM_DETAILS; |
814 } else if (key == kSnapChildrenToPixelBoundary) { | 820 } else if (key == kSnapChildrenToPixelBoundary) { |
815 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; | 821 wm_property = WmWindowProperty::SNAP_CHILDREN_TO_PIXEL_BOUNDARY; |
816 } else if (key == aura::client::kTopViewInset) { | 822 } else if (key == aura::client::kTopViewInset) { |
817 wm_property = WmWindowProperty::TOP_VIEW_INSET; | 823 wm_property = WmWindowProperty::TOP_VIEW_INSET; |
818 } else { | 824 } else { |
819 return; | 825 return; |
820 } | 826 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 OnTransientChildAdded(this, Get(transient))); | 865 OnTransientChildAdded(this, Get(transient))); |
860 } | 866 } |
861 | 867 |
862 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, | 868 void WmWindowAura::OnTransientChildRemoved(aura::Window* window, |
863 aura::Window* transient) { | 869 aura::Window* transient) { |
864 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, | 870 FOR_EACH_OBSERVER(WmTransientWindowObserver, transient_observers_, |
865 OnTransientChildRemoved(this, Get(transient))); | 871 OnTransientChildRemoved(this, Get(transient))); |
866 } | 872 } |
867 | 873 |
868 } // namespace ash | 874 } // namespace ash |
OLD | NEW |