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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/shell.h" 5 #include "ash/shell.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 is_touch_hud_projection_enabled_ = enabled; 413 is_touch_hud_projection_enabled_ = enabled;
414 for (auto& observer : shell_observers_) 414 for (auto& observer : shell_observers_)
415 observer.OnTouchHudProjectionToggled(enabled); 415 observer.OnTouchHudProjectionToggled(enabled);
416 } 416 }
417 417
418 FirstRunHelper* Shell::CreateFirstRunHelper() { 418 FirstRunHelper* Shell::CreateFirstRunHelper() {
419 return new FirstRunHelperImpl; 419 return new FirstRunHelperImpl;
420 } 420 }
421 421
422 void Shell::CreateShelfView() {
423 // Must occur after SessionController creation and user login.
424 DCHECK(session_controller());
425 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0);
426
427 // Notify the ShellDelegate that the shelf is being initialized.
428 // TODO(msw): Refine ChromeLauncherController lifetime management.
429 shell_delegate_->ShelfInit();
430
431 if (!shelf_window_watcher_)
432 shelf_window_watcher_ = base::MakeUnique<ShelfWindowWatcher>(shelf_model());
433 for (WmWindow* root_window : shell_port_->GetAllRootWindows())
434 root_window->GetRootWindowController()->CreateShelfView();
435 }
436
437 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) { 422 void Shell::SetLargeCursorSizeInDip(int large_cursor_size_in_dip) {
438 window_tree_host_manager_->cursor_window_controller() 423 window_tree_host_manager_->cursor_window_controller()
439 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip); 424 ->SetLargeCursorSizeInDip(large_cursor_size_in_dip);
440 } 425 }
441 426
442 void Shell::SetCursorCompositingEnabled(bool enabled) { 427 void Shell::SetCursorCompositingEnabled(bool enabled) {
443 if (GetAshConfig() == Config::CLASSIC) { 428 if (GetAshConfig() == Config::CLASSIC) {
444 // TODO: needs to work in mus. http://crbug.com/705592. 429 // TODO: needs to work in mus. http://crbug.com/705592.
445 window_tree_host_manager_->cursor_window_controller() 430 window_tree_host_manager_->cursor_window_controller()
446 ->SetCursorCompositingEnabled(enabled); 431 ->SetCursorCompositingEnabled(enabled);
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 void Shell::OnWindowActivated( 1211 void Shell::OnWindowActivated(
1227 aura::client::ActivationChangeObserver::ActivationReason reason, 1212 aura::client::ActivationChangeObserver::ActivationReason reason,
1228 aura::Window* gained_active, 1213 aura::Window* gained_active,
1229 aura::Window* lost_active) { 1214 aura::Window* lost_active) {
1230 WmWindow* gained_active_wm = WmWindow::Get(gained_active); 1215 WmWindow* gained_active_wm = WmWindow::Get(gained_active);
1231 if (gained_active_wm) 1216 if (gained_active_wm)
1232 root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); 1217 root_window_for_new_windows_ = gained_active_wm->GetRootWindow();
1233 } 1218 }
1234 1219
1235 void Shell::OnSessionStateChanged(session_manager::SessionState state) { 1220 void Shell::OnSessionStateChanged(session_manager::SessionState state) {
1236 // Create the shelf when a session becomes active. It's safe to do this 1221 // Initialize the shelf when a session becomes active. It's safe to do this
1237 // multiple times (e.g. initial login vs. multiprofile add session). 1222 // multiple times (e.g. initial login vs. multiprofile add session).
1238 if (state == session_manager::SessionState::ACTIVE) { 1223 if (state == session_manager::SessionState::ACTIVE) {
1239 CreateShelfView(); 1224 InitializeShelf();
1240
1241 if (GetAshConfig() != Config::MASH) { 1225 if (GetAshConfig() != Config::MASH) {
1242 // Recreate the keyboard after initial login and after multiprofile login. 1226 // Recreate the keyboard after initial login and after multiprofile login.
1243 CreateKeyboard(); 1227 CreateKeyboard();
1244 } 1228 }
1245 } 1229 }
1246 } 1230 }
1247 1231
1248 void Shell::OnLoginStatusChanged(LoginStatus login_status) { 1232 void Shell::OnLoginStatusChanged(LoginStatus login_status) {
1249 UpdateAfterLoginStatusChange(login_status); 1233 UpdateAfterLoginStatusChange(login_status);
1250 } 1234 }
1251 1235
1252 void Shell::OnLockStateChanged(bool locked) { 1236 void Shell::OnLockStateChanged(bool locked) {
1253 #ifndef NDEBUG 1237 #ifndef NDEBUG
1254 // Make sure that there is no system modal in Lock layer when unlocked. 1238 // Make sure that there is no system modal in Lock layer when unlocked.
1255 if (!locked) { 1239 if (!locked) {
1256 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows( 1240 aura::Window::Windows containers = wm::GetContainersFromAllRootWindows(
1257 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow()); 1241 kShellWindowId_LockSystemModalContainer, GetPrimaryRootWindow());
1258 for (aura::Window* container : containers) 1242 for (aura::Window* container : containers)
1259 DCHECK(container->children().empty()); 1243 DCHECK(container->children().empty());
1260 } 1244 }
1261 #endif 1245 #endif
1262 } 1246 }
1263 1247
1248 void Shell::InitializeShelf() {
1249 // Must occur after SessionController creation and user login.
1250 DCHECK(session_controller());
1251 DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0);
1252
1253 // Notify the ShellDelegate that the shelf is being initialized.
1254 // TODO(msw): Refine ChromeLauncherController lifetime management.
1255 shell_delegate_->ShelfInit();
1256
1257 if (!shelf_window_watcher_)
1258 shelf_window_watcher_ = base::MakeUnique<ShelfWindowWatcher>(shelf_model());
1259
1260 for (RootWindowController* root : GetAllRootWindowControllers())
1261 root->InitializeShelf();
1262 }
1263
1264 void Shell::OnPrefServiceInitialized( 1264 void Shell::OnPrefServiceInitialized(
1265 std::unique_ptr<::PrefService> pref_service) { 1265 std::unique_ptr<::PrefService> pref_service) {
1266 if (!instance_) 1266 if (!instance_)
1267 return; 1267 return;
1268 // |pref_service_| is null if can't connect to Chrome (as happens when 1268 // |pref_service_| is null if can't connect to Chrome (as happens when
1269 // running mash outside of chrome --mash and chrome isn't built). 1269 // running mash outside of chrome --mash and chrome isn't built).
1270 pref_service_ = std::move(pref_service); 1270 pref_service_ = std::move(pref_service);
1271 } 1271 }
1272 1272
1273 } // namespace ash 1273 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698