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

Unified Diff: ash/shell.cc

Issue 2911393002: Nix GetRootWindowController, use RootWindowController::ForWindow. (Closed)
Patch Set: Sync and 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 c12b790bc3bec3a4db87f3b6667ff067f839f259..895b09fe5b9978720c27e380c85f11d12b2bcdcd 100644
--- a/ash/shell.cc
+++ b/ash/shell.cc
@@ -251,15 +251,15 @@ void Shell::DeleteInstance() {
// static
RootWindowController* Shell::GetPrimaryRootWindowController() {
CHECK(HasInstance());
- return GetRootWindowController(GetPrimaryRootWindow());
+ return RootWindowController::ForWindow(GetPrimaryRootWindow());
}
// static
Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() {
CHECK(HasInstance());
RootWindowControllerList root_window_controllers;
- for (WmWindow* root_window : instance_->shell_port_->GetAllRootWindows())
- root_window_controllers.push_back(root_window->GetRootWindowController());
+ for (aura::Window* root : GetAllRootWindows())
+ root_window_controllers.push_back(RootWindowController::ForWindow(root));
return root_window_controllers;
}
@@ -269,7 +269,7 @@ RootWindowController* Shell::GetRootWindowControllerWithDisplayId(
CHECK(HasInstance());
aura::Window* root_window =
instance_->shell_port_->GetRootWindowForDisplayId(display_id);
- return GetRootWindowController(root_window);
+ return RootWindowController::ForWindow(root_window);
}
// static
@@ -386,8 +386,8 @@ ShelfModel* Shell::shelf_model() {
}
void Shell::UpdateShelfVisibility() {
- for (WmWindow* root : shell_port_->GetAllRootWindows())
- root->GetRootWindowController()->shelf()->UpdateVisibilityState();
+ for (aura::Window* root : GetAllRootWindows())
+ Shelf::ForWindow(root)->UpdateVisibilityState();
}
PrefService* Shell::GetActiveUserPrefService() const {
@@ -480,10 +480,8 @@ bool Shell::GetAppListTargetVisibility() const {
}
void Shell::UpdateAfterLoginStatusChange(LoginStatus status) {
- for (WmWindow* root_window : shell_port_->GetAllRootWindows()) {
- root_window->GetRootWindowController()->UpdateAfterLoginStatusChange(
- status);
- }
+ for (RootWindowController* controller : GetAllRootWindowControllers())
+ controller->UpdateAfterLoginStatusChange(status);
}
void Shell::NotifyMaximizeModeStarted() {
@@ -663,8 +661,8 @@ Shell::~Shell() {
// Destroy SystemTrayDelegate before destroying the status area(s). Make sure
// to deinitialize the shelf first, as it is initialized after the delegate.
- for (WmWindow* root : shell_port_->GetAllRootWindows())
- root->GetRootWindowController()->shelf()->ShutdownShelfWidget();
+ for (aura::Window* root : GetAllRootWindows())
+ Shelf::ForWindow(root)->ShutdownShelfWidget();
tray_bluetooth_helper_.reset();
DeleteSystemTrayDelegate();
@@ -721,8 +719,7 @@ Shell::~Shell() {
// This also deletes all RootWindows. Note that we invoke Shutdown() on
// WindowTreeHostManager before resetting |window_tree_host_manager_|, since
- // destruction
- // of its owned RootWindowControllers relies on the value.
+ // destruction of its owned RootWindowControllers relies on the value.
ScreenAsh::CreateScreenForShutdown();
display_configuration_controller_.reset();
@@ -1167,14 +1164,13 @@ void Shell::DeleteSystemTrayDelegate() {
}
void Shell::CloseAllRootWindowChildWindows() {
- for (WmWindow* wm_root_window : shell_port_->GetAllRootWindows()) {
- aura::Window* root_window = wm_root_window->aura_window();
- RootWindowController* controller = GetRootWindowController(root_window);
+ for (aura::Window* root : GetAllRootWindows()) {
+ RootWindowController* controller = RootWindowController::ForWindow(root);
if (controller) {
controller->CloseChildWindows();
} else {
- while (!root_window->children().empty()) {
- aura::Window* child = root_window->children()[0];
+ while (!root->children().empty()) {
+ aura::Window* child = root->children()[0];
delete child;
}
}

Powered by Google App Engine
This is Rietveld 408576698