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

Side by Side Diff: ash/common/wm_root_window_controller.cc

Issue 2336653002: Ports SystemModalContainerLayoutManager to ash/common (Closed)
Patch Set: merge again Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « ash/common/wm_root_window_controller.h ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/wm_root_window_controller.h" 5 #include "ash/common/wm_root_window_controller.h"
6 6
7 #include "ash/common/session/session_state_delegate.h"
7 #include "ash/common/shell_window_ids.h" 8 #include "ash/common/shell_window_ids.h"
8 #include "ash/common/wallpaper/wallpaper_delegate.h" 9 #include "ash/common/wallpaper/wallpaper_delegate.h"
9 #include "ash/common/wallpaper/wallpaper_widget_controller.h" 10 #include "ash/common/wallpaper/wallpaper_widget_controller.h"
11 #include "ash/common/wm/container_finder.h"
10 #include "ash/common/wm/root_window_layout_manager.h" 12 #include "ash/common/wm/root_window_layout_manager.h"
13 #include "ash/common/wm/system_modal_container_layout_manager.h"
11 #include "ash/common/wm/workspace/workspace_layout_manager.h" 14 #include "ash/common/wm/workspace/workspace_layout_manager.h"
12 #include "ash/common/wm/workspace_controller.h" 15 #include "ash/common/wm/workspace_controller.h"
13 #include "ash/common/wm_shell.h" 16 #include "ash/common/wm_shell.h"
14 #include "ash/common/wm_window.h" 17 #include "ash/common/wm_window.h"
15 #include "base/memory/ptr_util.h" 18 #include "base/memory/ptr_util.h"
16 19
17 namespace ash { 20 namespace ash {
18 namespace { 21 namespace {
19 22
20 // Creates a new window for use as a container. 23 // Creates a new window for use as a container.
(...skipping 28 matching lines...) Expand all
49 if (animating_wallpaper_widget_controller_.get()) 52 if (animating_wallpaper_widget_controller_.get())
50 animating_wallpaper_widget_controller_->StopAnimating(); 53 animating_wallpaper_widget_controller_->StopAnimating();
51 animating_wallpaper_widget_controller_.reset(controller); 54 animating_wallpaper_widget_controller_.reset(controller);
52 } 55 }
53 56
54 wm::WorkspaceWindowState WmRootWindowController::GetWorkspaceWindowState() { 57 wm::WorkspaceWindowState WmRootWindowController::GetWorkspaceWindowState() {
55 return workspace_controller_ ? workspace_controller()->GetWindowState() 58 return workspace_controller_ ? workspace_controller()->GetWindowState()
56 : wm::WORKSPACE_WINDOW_STATE_DEFAULT; 59 : wm::WORKSPACE_WINDOW_STATE_DEFAULT;
57 } 60 }
58 61
62 SystemModalContainerLayoutManager*
63 WmRootWindowController::GetSystemModalLayoutManager(WmWindow* window) {
64 WmWindow* modal_container = nullptr;
65 if (window) {
66 WmWindow* window_container = wm::GetContainerForWindow(window);
67 if (window_container &&
68 window_container->GetShellWindowId() >=
69 kShellWindowId_LockScreenContainer) {
70 modal_container = GetContainer(kShellWindowId_LockSystemModalContainer);
71 } else {
72 modal_container = GetContainer(kShellWindowId_SystemModalContainer);
73 }
74 } else {
75 int modal_window_id =
76 WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()
77 ? kShellWindowId_LockSystemModalContainer
78 : kShellWindowId_SystemModalContainer;
79 modal_container = GetContainer(modal_window_id);
80 }
81 return modal_container ? static_cast<SystemModalContainerLayoutManager*>(
82 modal_container->GetLayoutManager())
83 : nullptr;
84 }
85
86 WmWindow* WmRootWindowController::GetContainer(int container_id) {
87 return root_->GetChildByShellWindowId(container_id);
88 }
89
90 const WmWindow* WmRootWindowController::GetContainer(int container_id) const {
91 return root_->GetChildByShellWindowId(container_id);
92 }
93
59 void WmRootWindowController::OnInitialWallpaperAnimationStarted() {} 94 void WmRootWindowController::OnInitialWallpaperAnimationStarted() {}
60 95
61 void WmRootWindowController::OnWallpaperAnimationFinished( 96 void WmRootWindowController::OnWallpaperAnimationFinished(
62 views::Widget* widget) { 97 views::Widget* widget) {
63 WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished(); 98 WmShell::Get()->wallpaper_delegate()->OnWallpaperAnimationFinished();
64 // Only removes old component when wallpaper animation finished. If we 99 // Only removes old component when wallpaper animation finished. If we
65 // remove the old one before the new wallpaper is done fading in there will 100 // remove the old one before the new wallpaper is done fading in there will
66 // be a white flash during the animation. 101 // be a white flash during the animation.
67 if (animating_wallpaper_widget_controller()) { 102 if (animating_wallpaper_widget_controller()) {
68 WallpaperWidgetController* controller = 103 WallpaperWidgetController* controller =
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 #endif 283 #endif
249 284
250 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 285 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
251 "PowerButtonAnimationContainer", root_); 286 "PowerButtonAnimationContainer", root_);
252 } 287 }
253 288
254 void WmRootWindowController::CreateLayoutManagers() { 289 void WmRootWindowController::CreateLayoutManagers() {
255 root_window_layout_manager_ = new wm::RootWindowLayoutManager(root_); 290 root_window_layout_manager_ = new wm::RootWindowLayoutManager(root_);
256 root_->SetLayoutManager(base::WrapUnique(root_window_layout_manager_)); 291 root_->SetLayoutManager(base::WrapUnique(root_window_layout_manager_));
257 292
258 WmWindow* default_container = 293 WmWindow* default_container = GetContainer(kShellWindowId_DefaultContainer);
259 root_->GetChildByShellWindowId(kShellWindowId_DefaultContainer);
260 workspace_controller_.reset(new WorkspaceController(default_container)); 294 workspace_controller_.reset(new WorkspaceController(default_container));
295
296 WmWindow* modal_container = GetContainer(kShellWindowId_SystemModalContainer);
297 DCHECK(modal_container);
298 modal_container->SetLayoutManager(
299 base::MakeUnique<SystemModalContainerLayoutManager>(modal_container));
300
301 WmWindow* lock_modal_container =
302 GetContainer(kShellWindowId_LockSystemModalContainer);
303 DCHECK(lock_modal_container);
304 lock_modal_container->SetLayoutManager(
305 base::MakeUnique<SystemModalContainerLayoutManager>(
306 lock_modal_container));
261 } 307 }
262 308
263 void WmRootWindowController::DeleteWorkspaceController() { 309 void WmRootWindowController::DeleteWorkspaceController() {
264 workspace_controller_.reset(); 310 workspace_controller_.reset();
265 } 311 }
266 312
267 } // namespace ash 313 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm_root_window_controller.h ('k') | ash/common/wm_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698