| 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/common/root_window_controller_common.h" | 5 #include "ash/common/wm_root_window_controller.h" |
| 6 | 6 |
| 7 #include "ash/common/shell_window_ids.h" | 7 #include "ash/common/shell_window_ids.h" |
| 8 #include "ash/common/wm/root_window_layout_manager.h" | 8 #include "ash/common/wm/root_window_layout_manager.h" |
| 9 #include "ash/common/wm/workspace/workspace_layout_manager.h" | 9 #include "ash/common/wm/workspace/workspace_layout_manager.h" |
| 10 #include "ash/common/wm/workspace_controller.h" | 10 #include "ash/common/wm/workspace_controller.h" |
| 11 #include "ash/common/wm_shell.h" | 11 #include "ash/common/wm_shell.h" |
| 12 #include "ash/common/wm_window.h" | 12 #include "ash/common/wm_window.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 | 14 |
| 15 namespace ash { | 15 namespace ash { |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // Creates a new window for use as a container. | 18 // Creates a new window for use as a container. |
| 19 WmWindow* CreateContainer(int window_id, const char* name, WmWindow* parent) { | 19 WmWindow* CreateContainer(int window_id, const char* name, WmWindow* parent) { |
| 20 WmWindow* window = WmShell::Get()->NewContainerWindow(); | 20 WmWindow* window = WmShell::Get()->NewContainerWindow(); |
| 21 window->SetShellWindowId(window_id); | 21 window->SetShellWindowId(window_id); |
| 22 window->SetName(name); | 22 window->SetName(name); |
| 23 parent->AddChild(window); | 23 parent->AddChild(window); |
| 24 if (window_id != kShellWindowId_UnparentedControlContainer) | 24 if (window_id != kShellWindowId_UnparentedControlContainer) |
| 25 window->Show(); | 25 window->Show(); |
| 26 return window; | 26 return window; |
| 27 } | 27 } |
| 28 | 28 |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 RootWindowControllerCommon::RootWindowControllerCommon(WmWindow* root) | 31 WmRootWindowController::WmRootWindowController(WmWindow* root) |
| 32 : root_(root), root_window_layout_(nullptr) {} | 32 : root_(root), root_window_layout_manager_(nullptr) {} |
| 33 | 33 |
| 34 RootWindowControllerCommon::~RootWindowControllerCommon() {} | 34 WmRootWindowController::~WmRootWindowController() {} |
| 35 | 35 |
| 36 void RootWindowControllerCommon::CreateContainers() { | 36 wm::WorkspaceWindowState WmRootWindowController::GetWorkspaceWindowState() { |
| 37 return workspace_controller_ ? workspace_controller()->GetWindowState() |
| 38 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; |
| 39 } |
| 40 |
| 41 void WmRootWindowController::AddObserver( |
| 42 WmRootWindowControllerObserver* observer) { |
| 43 observers_.AddObserver(observer); |
| 44 } |
| 45 |
| 46 void WmRootWindowController::RemoveObserver( |
| 47 WmRootWindowControllerObserver* observer) { |
| 48 observers_.RemoveObserver(observer); |
| 49 } |
| 50 |
| 51 void WmRootWindowController::CreateContainers() { |
| 37 // These containers are just used by PowerButtonController to animate groups | 52 // These containers are just used by PowerButtonController to animate groups |
| 38 // of containers simultaneously without messing up the current transformations | 53 // of containers simultaneously without messing up the current transformations |
| 39 // on those containers. These are direct children of the root window; all of | 54 // on those containers. These are direct children of the root window; all of |
| 40 // the other containers are their children. | 55 // the other containers are their children. |
| 41 | 56 |
| 42 // The wallpaper container is not part of the lock animation, so it is not | 57 // The wallpaper container is not part of the lock animation, so it is not |
| 43 // included in those animate groups. When the screen is locked, the wallpaper | 58 // included in those animate groups. When the screen is locked, the wallpaper |
| 44 // is moved to the lock screen wallpaper container (and moved back on unlock). | 59 // is moved to the lock screen wallpaper container (and moved back on unlock). |
| 45 // Ensure that there's an opaque layer occluding the non-lock-screen layers. | 60 // Ensure that there's an opaque layer occluding the non-lock-screen layers. |
| 46 WmWindow* wallpaper_container = CreateContainer( | 61 WmWindow* wallpaper_container = CreateContainer( |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 WmWindow* mouse_cursor_container = CreateContainer( | 219 WmWindow* mouse_cursor_container = CreateContainer( |
| 205 kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root_); | 220 kShellWindowId_MouseCursorContainer, "MouseCursorContainer", root_); |
| 206 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren( | 221 mouse_cursor_container->SetBoundsInScreenBehaviorForChildren( |
| 207 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); | 222 WmWindow::BoundsInScreenBehavior::USE_SCREEN_COORDINATES); |
| 208 #endif | 223 #endif |
| 209 | 224 |
| 210 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, | 225 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, |
| 211 "PowerButtonAnimationContainer", root_); | 226 "PowerButtonAnimationContainer", root_); |
| 212 } | 227 } |
| 213 | 228 |
| 214 void RootWindowControllerCommon::CreateLayoutManagers() { | 229 void WmRootWindowController::CreateLayoutManagers() { |
| 215 root_window_layout_ = new wm::RootWindowLayoutManager(root_); | 230 root_window_layout_manager_ = new wm::RootWindowLayoutManager(root_); |
| 216 root_->SetLayoutManager(base::WrapUnique(root_window_layout_)); | 231 root_->SetLayoutManager(base::WrapUnique(root_window_layout_manager_)); |
| 217 | 232 |
| 218 WmWindow* default_container = | 233 WmWindow* default_container = |
| 219 root_->GetChildByShellWindowId(kShellWindowId_DefaultContainer); | 234 root_->GetChildByShellWindowId(kShellWindowId_DefaultContainer); |
| 220 workspace_controller_.reset(new WorkspaceController(default_container)); | 235 workspace_controller_.reset(new WorkspaceController(default_container)); |
| 221 } | 236 } |
| 222 | 237 |
| 223 void RootWindowControllerCommon::DeleteWorkspaceController() { | 238 void WmRootWindowController::DeleteWorkspaceController() { |
| 224 workspace_controller_.reset(); | 239 workspace_controller_.reset(); |
| 225 } | 240 } |
| 226 | 241 |
| 227 } // namespace ash | 242 } // namespace ash |
| OLD | NEW |