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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm_root_window_controller.cc
diff --git a/ash/common/wm_root_window_controller.cc b/ash/common/wm_root_window_controller.cc
index c407b3985756746fae839e25e7e53cd75ffc4aec..52035e7bbfc0b4e7460c004c6e8e22892d8b662e 100644
--- a/ash/common/wm_root_window_controller.cc
+++ b/ash/common/wm_root_window_controller.cc
@@ -4,10 +4,13 @@
#include "ash/common/wm_root_window_controller.h"
+#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shell_window_ids.h"
#include "ash/common/wallpaper/wallpaper_delegate.h"
#include "ash/common/wallpaper/wallpaper_widget_controller.h"
+#include "ash/common/wm/container_finder.h"
#include "ash/common/wm/root_window_layout_manager.h"
+#include "ash/common/wm/system_modal_container_layout_manager.h"
#include "ash/common/wm/workspace/workspace_layout_manager.h"
#include "ash/common/wm/workspace_controller.h"
#include "ash/common/wm_shell.h"
@@ -56,6 +59,38 @@ wm::WorkspaceWindowState WmRootWindowController::GetWorkspaceWindowState() {
: wm::WORKSPACE_WINDOW_STATE_DEFAULT;
}
+SystemModalContainerLayoutManager*
+WmRootWindowController::GetSystemModalLayoutManager(WmWindow* window) {
+ WmWindow* modal_container = nullptr;
+ if (window) {
+ WmWindow* window_container = wm::GetContainerForWindow(window);
+ if (window_container &&
+ window_container->GetShellWindowId() >=
+ kShellWindowId_LockScreenContainer) {
+ modal_container = GetContainer(kShellWindowId_LockSystemModalContainer);
+ } else {
+ modal_container = GetContainer(kShellWindowId_SystemModalContainer);
+ }
+ } else {
+ int modal_window_id =
+ WmShell::Get()->GetSessionStateDelegate()->IsUserSessionBlocked()
+ ? kShellWindowId_LockSystemModalContainer
+ : kShellWindowId_SystemModalContainer;
+ modal_container = GetContainer(modal_window_id);
+ }
+ return modal_container ? static_cast<SystemModalContainerLayoutManager*>(
+ modal_container->GetLayoutManager())
+ : nullptr;
+}
+
+WmWindow* WmRootWindowController::GetContainer(int container_id) {
+ return root_->GetChildByShellWindowId(container_id);
+}
+
+const WmWindow* WmRootWindowController::GetContainer(int container_id) const {
+ return root_->GetChildByShellWindowId(container_id);
+}
+
void WmRootWindowController::OnInitialWallpaperAnimationStarted() {}
void WmRootWindowController::OnWallpaperAnimationFinished(
@@ -255,9 +290,20 @@ void WmRootWindowController::CreateLayoutManagers() {
root_window_layout_manager_ = new wm::RootWindowLayoutManager(root_);
root_->SetLayoutManager(base::WrapUnique(root_window_layout_manager_));
- WmWindow* default_container =
- root_->GetChildByShellWindowId(kShellWindowId_DefaultContainer);
+ WmWindow* default_container = GetContainer(kShellWindowId_DefaultContainer);
workspace_controller_.reset(new WorkspaceController(default_container));
+
+ WmWindow* modal_container = GetContainer(kShellWindowId_SystemModalContainer);
+ DCHECK(modal_container);
+ modal_container->SetLayoutManager(
+ base::MakeUnique<SystemModalContainerLayoutManager>(modal_container));
+
+ WmWindow* lock_modal_container =
+ GetContainer(kShellWindowId_LockSystemModalContainer);
+ DCHECK(lock_modal_container);
+ lock_modal_container->SetLayoutManager(
+ base::MakeUnique<SystemModalContainerLayoutManager>(
+ lock_modal_container));
}
void WmRootWindowController::DeleteWorkspaceController() {
« 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