chromeos: Refactor shelf to create ShelfView earlier in startup
Currently ShelfView is created in the middle of login, after the profile
loads, whereas the ShelfWidget and StatusAreaWidget are created on display
initialization. We also have complex logic around showing and hiding the
shelf based on login state, supervised user creation flows, etc. This makes
it difficult to reason about the state of the shelf.
Instead, always create the ShelfView when the widget is created. The view
stays hidden at login because its window container is hidden. This makes it
easier to reason about ShelfView (it's always there). We also want this
because we want to replace the Web UI "fake shelf" during OOBE and login
with a views-based shelf. It may help with Clusterfuzz crashes we're
seeing due to shelf not being fully initialized during the tests.
This is a refactor and should not cause behavior changes.
BUG=717559,674773
TEST=ash_unittests, browser_tests, manually testing login, ChromeVox, and
adding/removing displays
[email protected] for rename
Review-Url: https://codereview.chromium.org/2889673002
Cr-Commit-Position: refs/heads/master@{#472832}
diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h
index 6f0945f..493e9d9 100644
--- a/ash/root_window_controller.h
+++ b/ash/root_window_controller.h
@@ -138,13 +138,11 @@
wm::WorkspaceWindowState GetWorkspaceWindowState();
WmShelf* wm_shelf() const { return wm_shelf_.get(); }
+ // TODO(jamescook): Eliminate in favor of wm_shelf().
+ WmShelf* GetShelf() const { return wm_shelf_.get(); }
- bool HasShelf();
-
- WmShelf* GetShelf();
-
- // Creates the shelf view for this root window and notifies observers.
- void CreateShelfView();
+ // Initializes the shelf for this root window and notifies observers.
+ void InitializeShelf();
// Get touch HUDs associated with this root window controller.
TouchHudDebug* touch_hud_debug() const { return touch_hud_debug_; }
@@ -352,6 +350,10 @@
// to it during construction of the shelf widget and status tray.
std::unique_ptr<WmShelf> wm_shelf_;
+ // TODO(jamescook): Eliminate this. It is left over from legacy shelf code and
+ // doesn't mean anything in particular.
+ bool shelf_initialized_ = false;
+
std::unique_ptr<SystemWallpaperController> system_wallpaper_;
std::unique_ptr<BootSplashScreen> boot_splash_screen_;