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

Unified Diff: ash/root_window_controller.cc

Issue 2027733002: Creates RootWindowControllerCommon (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@create_containers_wm_types
Patch Set: merge Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/root_window_controller_common.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/root_window_controller.cc
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index bf980dcc2ff36961962cf6cc04e9427e1abd021f..5a392383d655035d4710d33aea67c9b3cffb7782 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -16,6 +16,7 @@
#include "ash/focus_cycler.h"
#include "ash/high_contrast/high_contrast_controller.h"
#include "ash/host/ash_window_tree_host.h"
+#include "ash/root_window_controller_common.h"
#include "ash/root_window_settings.h"
#include "ash/session/session_state_delegate.h"
#include "ash/shelf/shelf_layout_manager.h"
@@ -102,19 +103,6 @@ namespace {
const int kBootSplashScreenHideDurationMs = 500;
#endif
-// Creates a new window for use as a container.
-wm::WmWindow* CreateContainer(int window_id,
- const char* name,
- wm::WmWindow* parent) {
- wm::WmWindow* window = wm::WmGlobals::Get()->NewContainerWindow();
- window->SetShellWindowId(window_id);
- window->SetName(name);
- parent->AddChild(window);
- if (window_id != kShellWindowId_UnparentedControlContainer)
- window->Show();
- return window;
-}
-
float ToRelativeValue(int value, int src, int dst) {
return static_cast<float>(value) / static_cast<float>(src) * dst;
}
@@ -668,6 +656,8 @@ RootWindowController::RootWindowController(AshWindowTreeHost* ash_host)
touch_hud_debug_(NULL),
touch_hud_projection_(NULL) {
aura::Window* root_window = GetRootWindow();
+ root_window_controller_common_.reset(
+ new RootWindowControllerCommon(wm::WmWindowAura::Get(root_window)));
GetRootWindowSettings(root_window)->controller = this;
stacking_controller_.reset(new StackingController);
@@ -681,7 +671,7 @@ void RootWindowController::Init(RootWindowType root_window_type,
Shell* shell = Shell::GetInstance();
shell->InitRootWindow(root_window);
- CreateContainersInRootWindow(wm::WmWindowAura::Get(root_window));
+ root_window_controller_common_->CreateContainers();
CreateSystemBackground(first_run_after_boot);
@@ -838,188 +828,6 @@ void RootWindowController::CreateSystemBackground(
#endif
}
-void RootWindowController::CreateContainersInRootWindow(
- wm::WmWindow* root_window) {
- // These containers are just used by PowerButtonController to animate groups
- // of containers simultaneously without messing up the current transformations
- // on those containers. These are direct children of the root window; all of
- // the other containers are their children.
-
- // The desktop background container is not part of the lock animation, so it
- // is not included in those animate groups.
- // When screen is locked desktop background is moved to lock screen background
- // container (moved back on unlock). We want to make sure that there's an
- // opaque layer occluding the non-lock-screen layers.
- wm::WmWindow* desktop_background_container =
- CreateContainer(kShellWindowId_DesktopBackgroundContainer,
- "DesktopBackgroundContainer", root_window);
- desktop_background_container->SetChildWindowVisibilityChangesAnimated();
-
- wm::WmWindow* non_lock_screen_containers =
- CreateContainer(kShellWindowId_NonLockScreenContainersContainer,
- "NonLockScreenContainersContainer", root_window);
- // Clip all windows inside this container, as half pixel of the window's
- // texture may become visible when the screen is scaled. crbug.com/368591.
- non_lock_screen_containers->SetMasksToBounds(true);
-
- wm::WmWindow* lock_background_containers =
- CreateContainer(kShellWindowId_LockScreenBackgroundContainer,
- "LockScreenBackgroundContainer", root_window);
- lock_background_containers->SetChildWindowVisibilityChangesAnimated();
-
- wm::WmWindow* lock_screen_containers =
- CreateContainer(kShellWindowId_LockScreenContainersContainer,
- "LockScreenContainersContainer", root_window);
- wm::WmWindow* lock_screen_related_containers =
- CreateContainer(kShellWindowId_LockScreenRelatedContainersContainer,
- "LockScreenRelatedContainersContainer", root_window);
-
- CreateContainer(kShellWindowId_UnparentedControlContainer,
- "UnparentedControlContainer",
- non_lock_screen_containers);
-
- wm::WmWindow* default_container =
- CreateContainer(kShellWindowId_DefaultContainer, "DefaultContainer",
- non_lock_screen_containers);
- default_container->SetChildWindowVisibilityChangesAnimated();
- default_container->SetSnapsChildrenToPhysicalPixelBoundary();
- default_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- default_container->SetChildrenUseExtendedHitRegion();
-
- wm::WmWindow* always_on_top_container =
- CreateContainer(kShellWindowId_AlwaysOnTopContainer,
- "AlwaysOnTopContainer", non_lock_screen_containers);
- always_on_top_container->SetChildWindowVisibilityChangesAnimated();
- always_on_top_container->SetSnapsChildrenToPhysicalPixelBoundary();
- always_on_top_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* docked_container =
- CreateContainer(kShellWindowId_DockedContainer, "DockedContainer",
- non_lock_screen_containers);
- docked_container->SetChildWindowVisibilityChangesAnimated();
- docked_container->SetSnapsChildrenToPhysicalPixelBoundary();
- docked_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- docked_container->SetChildrenUseExtendedHitRegion();
-
- wm::WmWindow* shelf_container =
- CreateContainer(kShellWindowId_ShelfContainer, "ShelfContainer",
- non_lock_screen_containers);
- shelf_container->SetSnapsChildrenToPhysicalPixelBoundary();
- shelf_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- shelf_container->SetDescendantsStayInSameRootWindow(true);
-
- wm::WmWindow* panel_container =
- CreateContainer(kShellWindowId_PanelContainer, "PanelContainer",
- non_lock_screen_containers);
- panel_container->SetSnapsChildrenToPhysicalPixelBoundary();
- panel_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* shelf_bubble_container =
- CreateContainer(kShellWindowId_ShelfBubbleContainer,
- "ShelfBubbleContainer", non_lock_screen_containers);
- shelf_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary();
- shelf_bubble_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- shelf_bubble_container->SetDescendantsStayInSameRootWindow(true);
-
- wm::WmWindow* app_list_container =
- CreateContainer(kShellWindowId_AppListContainer, "AppListContainer",
- non_lock_screen_containers);
- app_list_container->SetSnapsChildrenToPhysicalPixelBoundary();
- app_list_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* modal_container =
- CreateContainer(kShellWindowId_SystemModalContainer,
- "SystemModalContainer", non_lock_screen_containers);
- modal_container->SetSnapsChildrenToPhysicalPixelBoundary();
- modal_container->SetChildWindowVisibilityChangesAnimated();
- modal_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- modal_container->SetChildrenUseExtendedHitRegion();
-
- // TODO(beng): Figure out if we can make this use
- // SystemModalContainerEventFilter instead of stops_event_propagation.
- wm::WmWindow* lock_container =
- CreateContainer(kShellWindowId_LockScreenContainer, "LockScreenContainer",
- lock_screen_containers);
- lock_container->SetSnapsChildrenToPhysicalPixelBoundary();
- lock_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- // TODO(beng): stopsevents
-
- wm::WmWindow* lock_modal_container =
- CreateContainer(kShellWindowId_LockSystemModalContainer,
- "LockSystemModalContainer", lock_screen_containers);
- lock_modal_container->SetSnapsChildrenToPhysicalPixelBoundary();
- lock_modal_container->SetChildWindowVisibilityChangesAnimated();
- lock_modal_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- lock_modal_container->SetChildrenUseExtendedHitRegion();
-
- wm::WmWindow* status_container =
- CreateContainer(kShellWindowId_StatusContainer, "StatusContainer",
- lock_screen_related_containers);
- status_container->SetSnapsChildrenToPhysicalPixelBoundary();
- status_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- status_container->SetDescendantsStayInSameRootWindow(true);
-
- wm::WmWindow* settings_bubble_container =
- CreateContainer(kShellWindowId_SettingBubbleContainer,
- "SettingBubbleContainer", lock_screen_related_containers);
- settings_bubble_container->SetChildWindowVisibilityChangesAnimated();
- settings_bubble_container->SetSnapsChildrenToPhysicalPixelBoundary();
- settings_bubble_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
- settings_bubble_container->SetDescendantsStayInSameRootWindow(true);
-
- wm::WmWindow* virtual_keyboard_parent_container = CreateContainer(
- kShellWindowId_ImeWindowParentContainer, "VirtualKeyboardParentContainer",
- lock_screen_related_containers);
- virtual_keyboard_parent_container->SetSnapsChildrenToPhysicalPixelBoundary();
- virtual_keyboard_parent_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* menu_container =
- CreateContainer(kShellWindowId_MenuContainer, "MenuContainer",
- lock_screen_related_containers);
- menu_container->SetChildWindowVisibilityChangesAnimated();
- menu_container->SetSnapsChildrenToPhysicalPixelBoundary();
- menu_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* drag_drop_container = CreateContainer(
- kShellWindowId_DragImageAndTooltipContainer,
- "DragImageAndTooltipContainer", lock_screen_related_containers);
- drag_drop_container->SetChildWindowVisibilityChangesAnimated();
- drag_drop_container->SetSnapsChildrenToPhysicalPixelBoundary();
- drag_drop_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
- wm::WmWindow* overlay_container =
- CreateContainer(kShellWindowId_OverlayContainer, "OverlayContainer",
- lock_screen_related_containers);
- overlay_container->SetSnapsChildrenToPhysicalPixelBoundary();
- overlay_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-
-#if defined(OS_CHROMEOS)
- wm::WmWindow* mouse_cursor_container = CreateContainer(
- kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root_window);
- mouse_cursor_container->SetBoundsInScreenBehaviorForChildren(
- wm::WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES);
-#endif
-
- CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
- "PowerButtonAnimationContainer", root_window);
-}
-
void RootWindowController::EnableTouchHudProjection() {
if (touch_hud_projection_)
return;
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/root_window_controller_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698