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

Unified Diff: ash/root_window_controller.cc

Issue 2889673002: chromeos: Refactor shelf to create ShelfView earlier in startup (Closed)
Patch Set: rebase Created 3 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
Index: ash/root_window_controller.cc
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc
index ab4e14c00d7ca1c3c2591422ea3786d594bc8733..cc881532a7bebacc3a79c705c90430fd6bde8fa5 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -351,27 +351,19 @@ wm::WorkspaceWindowState RootWindowController::GetWorkspaceWindowState() {
: wm::WORKSPACE_WINDOW_STATE_DEFAULT;
}
-bool RootWindowController::HasShelf() {
- return wm_shelf_->shelf_widget() != nullptr;
-}
-
-WmShelf* RootWindowController::GetShelf() {
- return wm_shelf_.get();
-}
-
-void RootWindowController::CreateShelfView() {
- if (wm_shelf_->IsShelfInitialized())
+void RootWindowController::InitializeShelf() {
+ if (shelf_initialized_)
return;
- wm_shelf_->CreateShelfView();
+ shelf_initialized_ = true;
+ wm_shelf_->NotifyShelfInitialized();
// TODO(jamescook): Pass |wm_shelf_| into the constructors for these layout
// managers.
if (panel_layout_manager_)
panel_layout_manager_->SetShelf(wm_shelf_.get());
- // Notify shell observers that the shelf has been created.
- // TODO(jamescook): Move this into WmShelf::InitializeShelf(). This will
- // require changing AttachedPanelWidgetTargeter's access to WmShelf.
+ // TODO(jamescook): Eliminate this. Refactor AttachedPanelWidgetTargeter's
+ // access to WmShelf.
Shell::Get()->NotifyShelfCreatedForRootWindow(WmWindow::Get(GetRootWindow()));
wm_shelf_->shelf_widget()->PostCreateShelf();
@@ -601,11 +593,6 @@ void RootWindowController::CloseChildWindows() {
shelf->DestroyShelfWidget();
- // CloseChildWindows() may be called twice during the shutdown of ash
- // unittests. Avoid notifying WmShelf that the shelf has been destroyed twice.
- if (shelf->IsShelfInitialized())
- shelf->ShutdownShelf();
-
aura::client::SetDragDropClient(GetRootWindow(), nullptr);
aura::client::SetTooltipClient(GetRootWindow(), nullptr);
}
@@ -767,9 +754,9 @@ void RootWindowController::Init(RootWindowType root_window_type) {
} else {
window_tree_host_->Show();
- // Create a shelf if a user is already logged in.
- if (shell->session_controller()->NumberOfLoggedInUsers())
- CreateShelfView();
+ // At the login screen the shelf will be hidden because its container window
+ // is hidden. InitializeShelf() will make it visible.
+ InitializeShelf();
// Notify shell observers about new root window.
shell->OnRootWindowAdded(WmWindow::Get(root_window));

Powered by Google App Engine
This is Rietveld 408576698