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

Unified Diff: ash/shell.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/shell.cc
diff --git a/ash/shell.cc b/ash/shell.cc
index 2d36d457672a27fa6712ce10fb719013481a9b5a..5b0f96abd4b272f7a11f42453c6de40d359e4da8 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -419,21 +419,6 @@ FirstRunHelper* Shell::CreateFirstRunHelper() {
return new FirstRunHelperImpl;
}
-void Shell::CreateShelfView() {
- // Must occur after SessionController creation and user login.
- DCHECK(session_controller());
- DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0);
-
- // Notify the ShellDelegate that the shelf is being initialized.
- // TODO(msw): Refine ChromeLauncherController lifetime management.
- shell_delegate_->ShelfInit();
-
- if (!shelf_window_watcher_)
- shelf_window_watcher_ = base::MakeUnique<ShelfWindowWatcher>(shelf_model());
- for (WmWindow* root_window : shell_port_->GetAllRootWindows())
- root_window->GetRootWindowController()->CreateShelfView();
-}
-
void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) {
window_tree_host_manager_->cursor_window_controller()
->SetLargeCursorSizeInDip(large_cursor_size_in_dip);
@@ -1233,11 +1218,10 @@ void Shell::OnWindowActivated(
}
void Shell::OnSessionStateChanged(session_manager::SessionState state) {
- // Create the shelf when a session becomes active. It's safe to do this
+ // Initialize the shelf when a session becomes active. It's safe to do this
// multiple times (e.g. initial login vs. multiprofile add session).
if (state == session_manager::SessionState::ACTIVE) {
- CreateShelfView();
-
+ InitializeShelf();
if (GetAshConfig() != Config::MASH) {
// Recreate the keyboard after initial login and after multiprofile login.
CreateKeyboard();
@@ -1261,6 +1245,22 @@ void Shell::OnLockStateChanged(bool locked) {
#endif
}
+void Shell::InitializeShelf() {
+ // Must occur after SessionController creation and user login.
+ DCHECK(session_controller());
+ DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0);
+
+ // Notify the ShellDelegate that the shelf is being initialized.
+ // TODO(msw): Refine ChromeLauncherController lifetime management.
+ shell_delegate_->ShelfInit();
+
+ if (!shelf_window_watcher_)
+ shelf_window_watcher_ = base::MakeUnique<ShelfWindowWatcher>(shelf_model());
+
+ for (RootWindowController* root : GetAllRootWindowControllers())
+ root->InitializeShelf();
+}
+
void Shell::OnPrefServiceInitialized(
std::unique_ptr<::PrefService> pref_service) {
if (!instance_)

Powered by Google App Engine
This is Rietveld 408576698