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 <algorithm> | 7 #include <algorithm> |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 gfx::Insets touch_extend = | 861 gfx::Insets touch_extend = |
862 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); | 862 mouse_extend.Scale(kResizeOutsideBoundsScaleForTouch); |
863 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); | 863 aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); |
864 panel_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( | 864 panel_container->SetEventTargeter(std::unique_ptr<ui::EventTargeter>( |
865 new AttachedPanelWindowTargeter(panel_container, mouse_extend, | 865 new AttachedPanelWindowTargeter(panel_container, mouse_extend, |
866 touch_extend, panel_layout_manager()))); | 866 touch_extend, panel_layout_manager()))); |
867 } | 867 } |
868 | 868 |
869 void RootWindowController::CreateContainers() { | 869 void RootWindowController::CreateContainers() { |
870 WmWindow* root = GetWindow(); | 870 WmWindow* root = GetWindow(); |
| 871 // For screen rotation animation: add a NOT_DRAWN layer in between the |
| 872 // root_window's layer and its current children so that we only need to |
| 873 // initiate two LayerAnimationSequences. One for the new layers and one for |
| 874 // the old layers. |
| 875 WmWindow* screen_rotation_container = CreateContainer( |
| 876 kShellWindowId_ScreenRotationContainer, "ScreenRotationContainer", root); |
| 877 screen_rotation_container->SetChildWindowVisibilityChangesAnimated(); |
| 878 |
871 // These containers are just used by PowerButtonController to animate groups | 879 // These containers are just used by PowerButtonController to animate groups |
872 // of containers simultaneously without messing up the current transformations | 880 // of containers simultaneously without messing up the current transformations |
873 // on those containers. These are direct children of the root window; all of | 881 // on those containers. These are direct children of the |
874 // the other containers are their children. | 882 // screen_rotation_container window; all of the other containers are their |
| 883 // children. |
875 | 884 |
876 // The wallpaper container is not part of the lock animation, so it is not | 885 // The wallpaper container is not part of the lock animation, so it is not |
877 // included in those animate groups. When the screen is locked, the wallpaper | 886 // included in those animate groups. When the screen is locked, the wallpaper |
878 // is moved to the lock screen wallpaper container (and moved back on unlock). | 887 // is moved to the lock screen wallpaper container (and moved back on unlock). |
879 // Ensure that there's an opaque layer occluding the non-lock-screen layers. | 888 // Ensure that there's an opaque layer occluding the non-lock-screen layers. |
880 WmWindow* wallpaper_container = CreateContainer( | 889 WmWindow* wallpaper_container = |
881 kShellWindowId_WallpaperContainer, "WallpaperContainer", root); | 890 CreateContainer(kShellWindowId_WallpaperContainer, "WallpaperContainer", |
| 891 screen_rotation_container); |
882 wallpaper_container->SetChildWindowVisibilityChangesAnimated(); | 892 wallpaper_container->SetChildWindowVisibilityChangesAnimated(); |
883 | 893 |
884 WmWindow* non_lock_screen_containers = | 894 WmWindow* non_lock_screen_containers = CreateContainer( |
885 CreateContainer(kShellWindowId_NonLockScreenContainersContainer, | 895 kShellWindowId_NonLockScreenContainersContainer, |
886 "NonLockScreenContainersContainer", root); | 896 "NonLockScreenContainersContainer", screen_rotation_container); |
887 // Clip all windows inside this container, as half pixel of the window's | 897 // Clip all windows inside this container, as half pixel of the window's |
888 // texture may become visible when the screen is scaled. crbug.com/368591. | 898 // texture may become visible when the screen is scaled. crbug.com/368591. |
889 non_lock_screen_containers->SetMasksToBounds(true); | 899 non_lock_screen_containers->SetMasksToBounds(true); |
890 | 900 |
891 WmWindow* lock_wallpaper_containers = | 901 WmWindow* lock_wallpaper_containers = CreateContainer( |
892 CreateContainer(kShellWindowId_LockScreenWallpaperContainer, | 902 kShellWindowId_LockScreenWallpaperContainer, |
893 "LockScreenWallpaperContainer", root); | 903 "LockScreenWallpaperContainer", screen_rotation_container); |
894 lock_wallpaper_containers->SetChildWindowVisibilityChangesAnimated(); | 904 lock_wallpaper_containers->SetChildWindowVisibilityChangesAnimated(); |
895 | 905 |
896 WmWindow* lock_screen_containers = | 906 WmWindow* lock_screen_containers = CreateContainer( |
897 CreateContainer(kShellWindowId_LockScreenContainersContainer, | 907 kShellWindowId_LockScreenContainersContainer, |
898 "LockScreenContainersContainer", root); | 908 "LockScreenContainersContainer", screen_rotation_container); |
899 WmWindow* lock_screen_related_containers = | 909 WmWindow* lock_screen_related_containers = CreateContainer( |
900 CreateContainer(kShellWindowId_LockScreenRelatedContainersContainer, | 910 kShellWindowId_LockScreenRelatedContainersContainer, |
901 "LockScreenRelatedContainersContainer", root); | 911 "LockScreenRelatedContainersContainer", screen_rotation_container); |
902 | 912 |
903 CreateContainer(kShellWindowId_UnparentedControlContainer, | 913 CreateContainer(kShellWindowId_UnparentedControlContainer, |
904 "UnparentedControlContainer", non_lock_screen_containers); | 914 "UnparentedControlContainer", non_lock_screen_containers); |
905 | 915 |
906 WmWindow* default_container = | 916 WmWindow* default_container = |
907 CreateContainer(kShellWindowId_DefaultContainer, "DefaultContainer", | 917 CreateContainer(kShellWindowId_DefaultContainer, "DefaultContainer", |
908 non_lock_screen_containers); | 918 non_lock_screen_containers); |
909 default_container->SetChildWindowVisibilityChangesAnimated(); | 919 default_container->SetChildWindowVisibilityChangesAnimated(); |
910 default_container->SetSnapsChildrenToPhysicalPixelBoundary(); | 920 default_container->SetSnapsChildrenToPhysicalPixelBoundary(); |
911 default_container->SetBoundsInScreenBehaviorForChildren( | 921 default_container->SetBoundsInScreenBehaviorForChildren( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 drag_drop_container->SetBoundsInScreenBehaviorForChildren( | 1028 drag_drop_container->SetBoundsInScreenBehaviorForChildren( |
1019 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); | 1029 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); |
1020 | 1030 |
1021 WmWindow* overlay_container = | 1031 WmWindow* overlay_container = |
1022 CreateContainer(kShellWindowId_OverlayContainer, "OverlayContainer", | 1032 CreateContainer(kShellWindowId_OverlayContainer, "OverlayContainer", |
1023 lock_screen_related_containers); | 1033 lock_screen_related_containers); |
1024 overlay_container->SetSnapsChildrenToPhysicalPixelBoundary(); | 1034 overlay_container->SetSnapsChildrenToPhysicalPixelBoundary(); |
1025 overlay_container->SetBoundsInScreenBehaviorForChildren( | 1035 overlay_container->SetBoundsInScreenBehaviorForChildren( |
1026 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); | 1036 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); |
1027 | 1037 |
1028 WmWindow* mouse_cursor_container = CreateContainer( | 1038 WmWindow* mouse_cursor_container = |
1029 kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root); | 1039 CreateContainer(kShellWindowId_MouseCursorContainer, |
| 1040 "MouseCursorContainer", screen_rotation_container); |
1030 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren( | 1041 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren( |
1031 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); | 1042 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); |
1032 | 1043 |
1033 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 1044 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
1034 "PowerButtonAnimationContainer", root); | 1045 "PowerButtonAnimationContainer", screen_rotation_container); |
1035 } | 1046 } |
1036 | 1047 |
1037 void RootWindowController::CreateSystemWallpaper( | 1048 void RootWindowController::CreateSystemWallpaper( |
1038 RootWindowType root_window_type) { | 1049 RootWindowType root_window_type) { |
1039 SkColor color = SK_ColorBLACK; | 1050 SkColor color = SK_ColorBLACK; |
1040 // The splash screen appears on the primary display at boot. If this is a | 1051 // The splash screen appears on the primary display at boot. If this is a |
1041 // secondary monitor (either connected at boot or connected later) or if the | 1052 // secondary monitor (either connected at boot or connected later) or if the |
1042 // browser restarted for a second login then don't use the boot color. | 1053 // browser restarted for a second login then don't use the boot color. |
1043 const bool is_boot_splash_screen = | 1054 const bool is_boot_splash_screen = |
1044 root_window_type == RootWindowType::PRIMARY && | 1055 root_window_type == RootWindowType::PRIMARY && |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 EnableTouchHudProjection(); | 1113 EnableTouchHudProjection(); |
1103 else | 1114 else |
1104 DisableTouchHudProjection(); | 1115 DisableTouchHudProjection(); |
1105 } | 1116 } |
1106 | 1117 |
1107 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1118 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
1108 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1119 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
1109 } | 1120 } |
1110 | 1121 |
1111 } // namespace ash | 1122 } // namespace ash |
OLD | NEW |