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

Unified Diff: ash/root_window_controller.cc

Issue 2889673002: chromeos: Refactor shelf to create ShelfView earlier in startup (Closed)
Patch Set: Move ShelfView to initializer list 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..8be29960a89807d70eeb763f836755c61f62cfd4 100644
--- a/ash/root_window_controller.cc
+++ b/ash/root_window_controller.cc
@@ -359,19 +359,19 @@ 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 +601,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 +762,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.
msw 2017/05/16 22:42:00 nit: Maybe tie this comment into Shelf init? (eg.
James Cook 2017/05/17 16:16:12 Done.
+ InitializeShelf();
// Notify shell observers about new root window.
shell->OnRootWindowAdded(WmWindow::Get(root_window));

Powered by Google App Engine
This is Rietveld 408576698