| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <queue> | 7 #include <queue> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/ash_constants.h" | 10 #include "ash/ash_constants.h" |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 lock_background_container->AddChild(mouse_event_target_.get()); | 849 lock_background_container->AddChild(mouse_event_target_.get()); |
| 850 mouse_event_target_->Show(); | 850 mouse_event_target_->Show(); |
| 851 } | 851 } |
| 852 | 852 |
| 853 // Create Docked windows layout manager | 853 // Create Docked windows layout manager |
| 854 aura::Window* docked_container = GetContainer(kShellWindowId_DockedContainer); | 854 aura::Window* docked_container = GetContainer(kShellWindowId_DockedContainer); |
| 855 docked_layout_manager_ = | 855 docked_layout_manager_ = |
| 856 new DockedWindowLayoutManager(docked_container, workspace_controller()); | 856 new DockedWindowLayoutManager(docked_container, workspace_controller()); |
| 857 docked_container->SetLayoutManager(docked_layout_manager_); | 857 docked_container->SetLayoutManager(docked_layout_manager_); |
| 858 | 858 |
| 859 // Installs SnapLayoutManager to containers who set the |
| 860 // |kSnapsChildrenToPhysicalPixelBoundary| property. |
| 861 wm::InstallSnapLayoutManagerToContainers(root_window); |
| 862 |
| 859 // Create Panel layout manager | 863 // Create Panel layout manager |
| 860 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); | 864 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); |
| 861 panel_layout_manager_ = new PanelLayoutManager(panel_container); | 865 panel_layout_manager_ = new PanelLayoutManager(panel_container); |
| 862 panel_container->SetLayoutManager(panel_layout_manager_); | 866 panel_container->SetLayoutManager(panel_layout_manager_); |
| 863 panel_container_handler_.reset(new PanelWindowEventHandler); | 867 panel_container_handler_.reset(new PanelWindowEventHandler); |
| 864 panel_container->AddPreTargetHandler(panel_container_handler_.get()); | 868 panel_container->AddPreTargetHandler(panel_container_handler_.get()); |
| 865 | 869 |
| 866 // Install an AttachedPanelWindowTargeter on the panel container to make it | 870 // Install an AttachedPanelWindowTargeter on the panel container to make it |
| 867 // easier to correctly target shelf buttons with touch. | 871 // easier to correctly target shelf buttons with touch. |
| 868 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, | 872 gfx::Insets mouse_extend(-kResizeOutsideBoundsSize, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 948 | 952 |
| 949 CreateContainer(kShellWindowId_UnparentedControlContainer, | 953 CreateContainer(kShellWindowId_UnparentedControlContainer, |
| 950 "UnparentedControlContainer", | 954 "UnparentedControlContainer", |
| 951 non_lock_screen_containers); | 955 non_lock_screen_containers); |
| 952 | 956 |
| 953 aura::Window* default_container = CreateContainer( | 957 aura::Window* default_container = CreateContainer( |
| 954 kShellWindowId_DefaultContainer, | 958 kShellWindowId_DefaultContainer, |
| 955 "DefaultContainer", | 959 "DefaultContainer", |
| 956 non_lock_screen_containers); | 960 non_lock_screen_containers); |
| 957 ::wm::SetChildWindowVisibilityChangesAnimated(default_container); | 961 ::wm::SetChildWindowVisibilityChangesAnimated(default_container); |
| 962 wm::SetSnapsChildrenToPhysicalPixelBoundary(default_container); |
| 958 SetUsesScreenCoordinates(default_container); | 963 SetUsesScreenCoordinates(default_container); |
| 959 SetUsesEasyResizeTargeter(default_container); | 964 SetUsesEasyResizeTargeter(default_container); |
| 960 | 965 |
| 961 aura::Window* always_on_top_container = CreateContainer( | 966 aura::Window* always_on_top_container = CreateContainer( |
| 962 kShellWindowId_AlwaysOnTopContainer, | 967 kShellWindowId_AlwaysOnTopContainer, |
| 963 "AlwaysOnTopContainer", | 968 "AlwaysOnTopContainer", |
| 964 non_lock_screen_containers); | 969 non_lock_screen_containers); |
| 965 ::wm::SetChildWindowVisibilityChangesAnimated(always_on_top_container); | 970 ::wm::SetChildWindowVisibilityChangesAnimated(always_on_top_container); |
| 971 wm::SetSnapsChildrenToPhysicalPixelBoundary(always_on_top_container); |
| 966 SetUsesScreenCoordinates(always_on_top_container); | 972 SetUsesScreenCoordinates(always_on_top_container); |
| 967 | 973 |
| 968 aura::Window* docked_container = CreateContainer( | 974 aura::Window* docked_container = CreateContainer( |
| 969 kShellWindowId_DockedContainer, | 975 kShellWindowId_DockedContainer, |
| 970 "DockedContainer", | 976 "DockedContainer", |
| 971 non_lock_screen_containers); | 977 non_lock_screen_containers); |
| 972 ::wm::SetChildWindowVisibilityChangesAnimated(docked_container); | 978 ::wm::SetChildWindowVisibilityChangesAnimated(docked_container); |
| 979 wm::SetSnapsChildrenToPhysicalPixelBoundary(docked_container); |
| 973 SetUsesScreenCoordinates(docked_container); | 980 SetUsesScreenCoordinates(docked_container); |
| 974 SetUsesEasyResizeTargeter(docked_container); | 981 SetUsesEasyResizeTargeter(docked_container); |
| 975 | 982 |
| 976 aura::Window* shelf_container = | 983 aura::Window* shelf_container = |
| 977 CreateContainer(kShellWindowId_ShelfContainer, | 984 CreateContainer(kShellWindowId_ShelfContainer, |
| 978 "ShelfContainer", | 985 "ShelfContainer", |
| 979 non_lock_screen_containers); | 986 non_lock_screen_containers); |
| 987 wm::SetSnapsChildrenToPhysicalPixelBoundary(shelf_container); |
| 980 SetUsesScreenCoordinates(shelf_container); | 988 SetUsesScreenCoordinates(shelf_container); |
| 981 DescendantShouldStayInSameRootWindow(shelf_container); | 989 DescendantShouldStayInSameRootWindow(shelf_container); |
| 982 | 990 |
| 983 aura::Window* panel_container = CreateContainer( | 991 aura::Window* panel_container = CreateContainer( |
| 984 kShellWindowId_PanelContainer, | 992 kShellWindowId_PanelContainer, |
| 985 "PanelContainer", | 993 "PanelContainer", |
| 986 non_lock_screen_containers); | 994 non_lock_screen_containers); |
| 995 wm::SetSnapsChildrenToPhysicalPixelBoundary(panel_container); |
| 987 SetUsesScreenCoordinates(panel_container); | 996 SetUsesScreenCoordinates(panel_container); |
| 988 | 997 |
| 989 aura::Window* shelf_bubble_container = | 998 aura::Window* shelf_bubble_container = |
| 990 CreateContainer(kShellWindowId_ShelfBubbleContainer, | 999 CreateContainer(kShellWindowId_ShelfBubbleContainer, |
| 991 "ShelfBubbleContainer", | 1000 "ShelfBubbleContainer", |
| 992 non_lock_screen_containers); | 1001 non_lock_screen_containers); |
| 1002 wm::SetSnapsChildrenToPhysicalPixelBoundary(shelf_bubble_container); |
| 993 SetUsesScreenCoordinates(shelf_bubble_container); | 1003 SetUsesScreenCoordinates(shelf_bubble_container); |
| 994 DescendantShouldStayInSameRootWindow(shelf_bubble_container); | 1004 DescendantShouldStayInSameRootWindow(shelf_bubble_container); |
| 995 | 1005 |
| 996 aura::Window* app_list_container = | 1006 aura::Window* app_list_container = |
| 997 CreateContainer(kShellWindowId_AppListContainer, | 1007 CreateContainer(kShellWindowId_AppListContainer, |
| 998 "AppListContainer", | 1008 "AppListContainer", |
| 999 non_lock_screen_containers); | 1009 non_lock_screen_containers); |
| 1010 wm::SetSnapsChildrenToPhysicalPixelBoundary(app_list_container); |
| 1000 SetUsesScreenCoordinates(app_list_container); | 1011 SetUsesScreenCoordinates(app_list_container); |
| 1001 | 1012 |
| 1002 aura::Window* modal_container = CreateContainer( | 1013 aura::Window* modal_container = CreateContainer( |
| 1003 kShellWindowId_SystemModalContainer, | 1014 kShellWindowId_SystemModalContainer, |
| 1004 "SystemModalContainer", | 1015 "SystemModalContainer", |
| 1005 non_lock_screen_containers); | 1016 non_lock_screen_containers); |
| 1017 wm::SetSnapsChildrenToPhysicalPixelBoundary(modal_container); |
| 1006 modal_container->SetLayoutManager( | 1018 modal_container->SetLayoutManager( |
| 1007 new SystemModalContainerLayoutManager(modal_container)); | 1019 new SystemModalContainerLayoutManager(modal_container)); |
| 1008 ::wm::SetChildWindowVisibilityChangesAnimated(modal_container); | 1020 ::wm::SetChildWindowVisibilityChangesAnimated(modal_container); |
| 1009 SetUsesScreenCoordinates(modal_container); | 1021 SetUsesScreenCoordinates(modal_container); |
| 1010 SetUsesEasyResizeTargeter(modal_container); | 1022 SetUsesEasyResizeTargeter(modal_container); |
| 1011 | 1023 |
| 1012 // TODO(beng): Figure out if we can make this use | 1024 // TODO(beng): Figure out if we can make this use |
| 1013 // SystemModalContainerEventFilter instead of stops_event_propagation. | 1025 // SystemModalContainerEventFilter instead of stops_event_propagation. |
| 1014 aura::Window* lock_container = CreateContainer( | 1026 aura::Window* lock_container = CreateContainer( |
| 1015 kShellWindowId_LockScreenContainer, | 1027 kShellWindowId_LockScreenContainer, |
| 1016 "LockScreenContainer", | 1028 "LockScreenContainer", |
| 1017 lock_screen_containers); | 1029 lock_screen_containers); |
| 1030 wm::SetSnapsChildrenToPhysicalPixelBoundary(lock_container); |
| 1018 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1031 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1019 switches::kAshDisableLockLayoutManager)) { | 1032 switches::kAshDisableLockLayoutManager)) { |
| 1020 lock_container->SetLayoutManager( | 1033 lock_container->SetLayoutManager( |
| 1021 new WorkspaceLayoutManager(lock_container)); | 1034 new WorkspaceLayoutManager(lock_container)); |
| 1022 } else { | 1035 } else { |
| 1023 lock_container->SetLayoutManager(new LockLayoutManager(lock_container)); | 1036 lock_container->SetLayoutManager(new LockLayoutManager(lock_container)); |
| 1024 } | 1037 } |
| 1025 SetUsesScreenCoordinates(lock_container); | 1038 SetUsesScreenCoordinates(lock_container); |
| 1026 // TODO(beng): stopsevents | 1039 // TODO(beng): stopsevents |
| 1027 | 1040 |
| 1028 aura::Window* lock_modal_container = CreateContainer( | 1041 aura::Window* lock_modal_container = CreateContainer( |
| 1029 kShellWindowId_LockSystemModalContainer, | 1042 kShellWindowId_LockSystemModalContainer, |
| 1030 "LockSystemModalContainer", | 1043 "LockSystemModalContainer", |
| 1031 lock_screen_containers); | 1044 lock_screen_containers); |
| 1045 wm::SetSnapsChildrenToPhysicalPixelBoundary(lock_modal_container); |
| 1032 lock_modal_container->SetLayoutManager( | 1046 lock_modal_container->SetLayoutManager( |
| 1033 new SystemModalContainerLayoutManager(lock_modal_container)); | 1047 new SystemModalContainerLayoutManager(lock_modal_container)); |
| 1034 ::wm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); | 1048 ::wm::SetChildWindowVisibilityChangesAnimated(lock_modal_container); |
| 1035 SetUsesScreenCoordinates(lock_modal_container); | 1049 SetUsesScreenCoordinates(lock_modal_container); |
| 1036 SetUsesEasyResizeTargeter(lock_modal_container); | 1050 SetUsesEasyResizeTargeter(lock_modal_container); |
| 1037 | 1051 |
| 1038 aura::Window* status_container = | 1052 aura::Window* status_container = |
| 1039 CreateContainer(kShellWindowId_StatusContainer, | 1053 CreateContainer(kShellWindowId_StatusContainer, |
| 1040 "StatusContainer", | 1054 "StatusContainer", |
| 1041 lock_screen_related_containers); | 1055 lock_screen_related_containers); |
| 1056 wm::SetSnapsChildrenToPhysicalPixelBoundary(status_container); |
| 1042 SetUsesScreenCoordinates(status_container); | 1057 SetUsesScreenCoordinates(status_container); |
| 1043 DescendantShouldStayInSameRootWindow(status_container); | 1058 DescendantShouldStayInSameRootWindow(status_container); |
| 1044 | 1059 |
| 1045 aura::Window* settings_bubble_container = CreateContainer( | 1060 aura::Window* settings_bubble_container = CreateContainer( |
| 1046 kShellWindowId_SettingBubbleContainer, | 1061 kShellWindowId_SettingBubbleContainer, |
| 1047 "SettingBubbleContainer", | 1062 "SettingBubbleContainer", |
| 1048 lock_screen_related_containers); | 1063 lock_screen_related_containers); |
| 1049 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); | 1064 ::wm::SetChildWindowVisibilityChangesAnimated(settings_bubble_container); |
| 1065 wm::SetSnapsChildrenToPhysicalPixelBoundary(settings_bubble_container); |
| 1050 SetUsesScreenCoordinates(settings_bubble_container); | 1066 SetUsesScreenCoordinates(settings_bubble_container); |
| 1051 DescendantShouldStayInSameRootWindow(settings_bubble_container); | 1067 DescendantShouldStayInSameRootWindow(settings_bubble_container); |
| 1052 | 1068 |
| 1053 aura::Window* menu_container = CreateContainer( | 1069 aura::Window* menu_container = CreateContainer( |
| 1054 kShellWindowId_MenuContainer, | 1070 kShellWindowId_MenuContainer, |
| 1055 "MenuContainer", | 1071 "MenuContainer", |
| 1056 lock_screen_related_containers); | 1072 lock_screen_related_containers); |
| 1057 ::wm::SetChildWindowVisibilityChangesAnimated(menu_container); | 1073 ::wm::SetChildWindowVisibilityChangesAnimated(menu_container); |
| 1074 wm::SetSnapsChildrenToPhysicalPixelBoundary(menu_container); |
| 1058 SetUsesScreenCoordinates(menu_container); | 1075 SetUsesScreenCoordinates(menu_container); |
| 1059 | 1076 |
| 1060 aura::Window* drag_drop_container = CreateContainer( | 1077 aura::Window* drag_drop_container = CreateContainer( |
| 1061 kShellWindowId_DragImageAndTooltipContainer, | 1078 kShellWindowId_DragImageAndTooltipContainer, |
| 1062 "DragImageAndTooltipContainer", | 1079 "DragImageAndTooltipContainer", |
| 1063 lock_screen_related_containers); | 1080 lock_screen_related_containers); |
| 1064 ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); | 1081 ::wm::SetChildWindowVisibilityChangesAnimated(drag_drop_container); |
| 1082 wm::SetSnapsChildrenToPhysicalPixelBoundary(drag_drop_container); |
| 1065 SetUsesScreenCoordinates(drag_drop_container); | 1083 SetUsesScreenCoordinates(drag_drop_container); |
| 1066 | 1084 |
| 1067 aura::Window* overlay_container = CreateContainer( | 1085 aura::Window* overlay_container = CreateContainer( |
| 1068 kShellWindowId_OverlayContainer, | 1086 kShellWindowId_OverlayContainer, |
| 1069 "OverlayContainer", | 1087 "OverlayContainer", |
| 1070 lock_screen_related_containers); | 1088 lock_screen_related_containers); |
| 1089 wm::SetSnapsChildrenToPhysicalPixelBoundary(overlay_container); |
| 1071 SetUsesScreenCoordinates(overlay_container); | 1090 SetUsesScreenCoordinates(overlay_container); |
| 1072 | 1091 |
| 1073 aura::Window* virtual_keyboard_parent_container = CreateContainer( | 1092 aura::Window* virtual_keyboard_parent_container = CreateContainer( |
| 1074 kShellWindowId_VirtualKeyboardParentContainer, | 1093 kShellWindowId_VirtualKeyboardParentContainer, |
| 1075 "VirtualKeyboardParentContainer", | 1094 "VirtualKeyboardParentContainer", |
| 1076 root_window); | 1095 root_window); |
| 1096 wm::SetSnapsChildrenToPhysicalPixelBoundary( |
| 1097 virtual_keyboard_parent_container); |
| 1077 SetUsesScreenCoordinates(virtual_keyboard_parent_container); | 1098 SetUsesScreenCoordinates(virtual_keyboard_parent_container); |
| 1078 | 1099 |
| 1079 #if defined(OS_CHROMEOS) | 1100 #if defined(OS_CHROMEOS) |
| 1080 aura::Window* mouse_cursor_container = CreateContainer( | 1101 aura::Window* mouse_cursor_container = CreateContainer( |
| 1081 kShellWindowId_MouseCursorContainer, | 1102 kShellWindowId_MouseCursorContainer, |
| 1082 "MouseCursorContainer", | 1103 "MouseCursorContainer", |
| 1083 root_window); | 1104 root_window); |
| 1084 SetUsesScreenCoordinates(mouse_cursor_container); | 1105 SetUsesScreenCoordinates(mouse_cursor_container); |
| 1085 #endif | 1106 #endif |
| 1086 | 1107 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1110 else | 1131 else |
| 1111 DisableTouchHudProjection(); | 1132 DisableTouchHudProjection(); |
| 1112 } | 1133 } |
| 1113 | 1134 |
| 1114 RootWindowController* GetRootWindowController( | 1135 RootWindowController* GetRootWindowController( |
| 1115 const aura::Window* root_window) { | 1136 const aura::Window* root_window) { |
| 1116 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; | 1137 return root_window ? GetRootWindowSettings(root_window)->controller : NULL; |
| 1117 } | 1138 } |
| 1118 | 1139 |
| 1119 } // namespace ash | 1140 } // namespace ash |
| OLD | NEW |