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

Unified Diff: ash/wm/screen_pinning_controller.cc

Issue 2904073002: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (Closed)
Patch Set: [mus+ash] Removes WmWindow from ash/wm/screen_pinning_controller.h (removes unneeded header) 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
« no previous file with comments | « ash/wm/screen_pinning_controller.h ('k') | ash/wm/workspace/workspace_layout_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/screen_pinning_controller.cc
diff --git a/ash/wm/screen_pinning_controller.cc b/ash/wm/screen_pinning_controller.cc
index a4658d88f61b44360d5b9da3dbf8023d8d7c0800..06ccf1cd590e29f675b28420b6355f914a8fc21b 100644
--- a/ash/wm/screen_pinning_controller.cc
+++ b/ash/wm/screen_pinning_controller.cc
@@ -25,34 +25,32 @@
namespace ash {
namespace {
-// Returns a list of WmWindows corresponding to SystemModalContainers,
+// Returns a list of Windows corresponding to SystemModalContainers,
// except ones whose root is shared with |pinned_window|.
-std::vector<WmWindow*> GetSystemModalWindowsExceptPinned(
- WmWindow* pinned_window) {
- WmWindow* pinned_root = pinned_window->GetRootWindow();
+aura::Window::Windows GetSystemModalWindowsExceptPinned(
+ aura::Window* pinned_window) {
+ aura::Window* pinned_root = pinned_window->GetRootWindow();
- std::vector<WmWindow*> result;
+ aura::Window::Windows result;
for (aura::Window* system_modal : wm::GetContainersFromAllRootWindows(
kShellWindowId_SystemModalContainer)) {
- if (WmWindow::Get(system_modal)->GetRootWindow() == pinned_root)
+ if (system_modal->GetRootWindow() == pinned_root)
continue;
- result.push_back(WmWindow::Get(system_modal));
+ result.push_back(system_modal);
}
return result;
}
-void AddObserverToChildren(WmWindow* container,
+void AddObserverToChildren(aura::Window* container,
aura::WindowObserver* observer) {
- for (WmWindow* child : container->GetChildren()) {
- WmWindow::GetAuraWindow(child)->AddObserver(observer);
- }
+ for (aura::Window* child : container->children())
+ child->AddObserver(observer);
}
-void RemoveObserverFromChildren(WmWindow* container,
+void RemoveObserverFromChildren(aura::Window* container,
aura::WindowObserver* observer) {
- for (WmWindow* child : container->GetChildren()) {
- WmWindow::GetAuraWindow(child)->RemoveObserver(observer);
- }
+ for (aura::Window* child : container->children())
+ child->RemoveObserver(observer);
}
// Returns true if the aura::Window from a WindowDimmer is visible.
@@ -71,7 +69,7 @@ class ScreenPinningController::PinnedContainerChildWindowObserver
: controller_(controller) {}
void OnWindowStackingChanged(aura::Window* window) override {
- controller_->OnPinnedContainerWindowStackingChanged(WmWindow::Get(window));
+ controller_->OnPinnedContainerWindowStackingChanged(window);
}
private:
@@ -88,10 +86,10 @@ class ScreenPinningController::PinnedContainerWindowObserver
: controller_(controller) {}
void OnWindowAdded(aura::Window* new_window) override {
- controller_->OnWindowAddedToPinnedContainer(WmWindow::Get(new_window));
+ controller_->OnWindowAddedToPinnedContainer(new_window);
}
void OnWillRemoveWindow(aura::Window* window) override {
- controller_->OnWillRemoveWindowFromPinnedContainer(WmWindow::Get(window));
+ controller_->OnWillRemoveWindowFromPinnedContainer(window);
}
void OnWindowDestroying(aura::Window* window) override {
// Just in case. There is nothing we can do here.
@@ -112,8 +110,7 @@ class ScreenPinningController::SystemModalContainerChildWindowObserver
: controller_(controller) {}
void OnWindowStackingChanged(aura::Window* window) override {
- controller_->OnSystemModalContainerWindowStackingChanged(
- WmWindow::Get(window));
+ controller_->OnSystemModalContainerWindowStackingChanged(window);
}
private:
@@ -131,11 +128,10 @@ class ScreenPinningController::SystemModalContainerWindowObserver
: controller_(controller) {}
void OnWindowAdded(aura::Window* new_window) override {
- controller_->OnWindowAddedToSystemModalContainer(WmWindow::Get(new_window));
+ controller_->OnWindowAddedToSystemModalContainer(new_window);
}
void OnWillRemoveWindow(aura::Window* window) override {
- controller_->OnWillRemoveWindowFromSystemModalContainer(
- WmWindow::Get(window));
+ controller_->OnWillRemoveWindowFromSystemModalContainer(window);
}
void OnWindowDestroying(aura::Window* window) override {
// Just in case. There is nothing we can do here.
@@ -168,16 +164,16 @@ bool ScreenPinningController::IsPinned() const {
return pinned_window_ != nullptr;
}
-void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) {
- if (pinned_window->GetWindowState()->IsPinned()) {
+void ScreenPinningController::SetPinnedWindow(aura::Window* pinned_window) {
+ if (wm::GetWindowState(pinned_window)->IsPinned()) {
if (pinned_window_) {
LOG(DFATAL) << "Pinned mode is enabled, while it is already in "
<< "the pinned mode";
return;
}
- WmWindow* container = pinned_window->GetParent();
- std::vector<WmWindow*> system_modal_containers =
+ aura::Window* container = pinned_window->parent();
+ aura::Window::Windows system_modal_containers =
GetSystemModalWindowsExceptPinned(pinned_window);
// Set up the container which has the pinned window.
@@ -187,17 +183,15 @@ void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) {
// Set the dim windows to the system containers, other than the one which
// the root window of the pinned window holds.
- for (WmWindow* system_modal : system_modal_containers)
+ for (aura::Window* system_modal : system_modal_containers)
system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal));
// Set observers.
- WmWindow::GetAuraWindow(container)->AddObserver(
- pinned_container_window_observer_.get());
+ container->AddObserver(pinned_container_window_observer_.get());
AddObserverToChildren(container,
pinned_container_child_window_observer_.get());
- for (WmWindow* system_modal : system_modal_containers) {
- WmWindow::GetAuraWindow(system_modal)
- ->AddObserver(system_modal_container_window_observer_.get());
+ for (aura::Window* system_modal : system_modal_containers) {
+ system_modal->AddObserver(system_modal_container_window_observer_.get());
AddObserverToChildren(
system_modal, system_modal_container_child_window_observer_.get());
}
@@ -208,25 +202,23 @@ void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) {
return;
}
- WmWindow* container = pinned_window->GetParent();
- std::vector<WmWindow*> system_modal_containers =
+ aura::Window* container = pinned_window->parent();
+ aura::Window::Windows system_modal_containers =
GetSystemModalWindowsExceptPinned(pinned_window_);
// Unset observers.
- for (WmWindow* system_modal :
+ for (aura::Window* system_modal :
GetSystemModalWindowsExceptPinned(pinned_window_)) {
RemoveObserverFromChildren(
system_modal, system_modal_container_child_window_observer_.get());
- WmWindow::GetAuraWindow(system_modal)
- ->RemoveObserver(system_modal_container_window_observer_.get());
+ system_modal->RemoveObserver(
+ system_modal_container_window_observer_.get());
}
RemoveObserverFromChildren(container,
pinned_container_child_window_observer_.get());
- WmWindow::GetAuraWindow(container)->RemoveObserver(
- pinned_container_window_observer_.get());
+ container->RemoveObserver(pinned_container_window_observer_.get());
window_dimmers_->clear();
-
pinned_window_ = nullptr;
}
@@ -234,53 +226,50 @@ void ScreenPinningController::SetPinnedWindow(WmWindow* pinned_window) {
}
void ScreenPinningController::OnWindowAddedToPinnedContainer(
- WmWindow* new_window) {
+ aura::Window* new_window) {
KeepPinnedWindowOnTop();
- WmWindow::GetAuraWindow(new_window)
- ->AddObserver(pinned_container_child_window_observer_.get());
+ new_window->AddObserver(pinned_container_child_window_observer_.get());
}
void ScreenPinningController::OnWillRemoveWindowFromPinnedContainer(
- WmWindow* window) {
- WmWindow::GetAuraWindow(window)->RemoveObserver(
- pinned_container_child_window_observer_.get());
+ aura::Window* window) {
+ window->RemoveObserver(pinned_container_child_window_observer_.get());
if (window == pinned_window_) {
- pinned_window_->GetWindowState()->Restore();
+ wm::GetWindowState(pinned_window_)->Restore();
return;
}
}
void ScreenPinningController::OnPinnedContainerWindowStackingChanged(
- WmWindow* window) {
+ aura::Window* window) {
KeepPinnedWindowOnTop();
}
void ScreenPinningController::OnWindowAddedToSystemModalContainer(
- WmWindow* new_window) {
- KeepDimWindowAtBottom(new_window->GetParent()->aura_window());
- WmWindow::GetAuraWindow(new_window)
- ->AddObserver(system_modal_container_child_window_observer_.get());
+ aura::Window* new_window) {
+ KeepDimWindowAtBottom(new_window->parent());
+ new_window->AddObserver(system_modal_container_child_window_observer_.get());
}
void ScreenPinningController::OnWillRemoveWindowFromSystemModalContainer(
- WmWindow* window) {
- WmWindow::GetAuraWindow(window)->RemoveObserver(
- system_modal_container_child_window_observer_.get());
+ aura::Window* window) {
+ window->RemoveObserver(system_modal_container_child_window_observer_.get());
}
void ScreenPinningController::OnSystemModalContainerWindowStackingChanged(
- WmWindow* window) {
- KeepDimWindowAtBottom(window->GetParent()->aura_window());
+ aura::Window* window) {
+ KeepDimWindowAtBottom(window->parent());
}
-WmWindow* ScreenPinningController::CreateWindowDimmer(WmWindow* container) {
+aura::Window* ScreenPinningController::CreateWindowDimmer(
+ aura::Window* container) {
std::unique_ptr<WindowDimmer> window_dimmer =
- base::MakeUnique<WindowDimmer>(container->aura_window());
+ base::MakeUnique<WindowDimmer>(container);
window_dimmer->SetDimOpacity(1); // Fully opaque.
::wm::SetWindowFullscreen(window_dimmer->window(), true);
window_dimmer->window()->Show();
- WmWindow* window = WmWindow::Get(window_dimmer->window());
- window_dimmers_->Set(container->aura_window(), std::move(window_dimmer));
+ aura::Window* window = window_dimmer->window();
+ window_dimmers_->Set(container, std::move(window_dimmer));
return window;
}
@@ -298,17 +287,17 @@ void ScreenPinningController::OnDisplayConfigurationChanged() {
// First, delete unnecessary WindowDimmers.
for (aura::Window* container : window_dimmers_->GetWindows()) {
- if (container != pinned_window_->GetParent()->aura_window() &&
+ if (container != pinned_window_->parent() &&
!IsWindowDimmerWindowVisible(window_dimmers_->Get(container))) {
window_dimmers_->Set(container, nullptr);
}
}
// Then, create missing WindowDimmers.
- std::vector<WmWindow*> system_modal_containers =
+ aura::Window::Windows system_modal_containers =
GetSystemModalWindowsExceptPinned(pinned_window_);
- for (WmWindow* system_modal : system_modal_containers) {
- if (window_dimmers_->Get(system_modal->aura_window())) {
+ for (aura::Window* system_modal : system_modal_containers) {
+ if (window_dimmers_->Get(system_modal)) {
// |system_modal| already has a WindowDimmer.
continue;
}
@@ -317,8 +306,7 @@ void ScreenPinningController::OnDisplayConfigurationChanged() {
system_modal->StackChildAtBottom(CreateWindowDimmer(system_modal));
// Set observers to the tree.
- WmWindow::GetAuraWindow(system_modal)
- ->AddObserver(system_modal_container_window_observer_.get());
+ system_modal->AddObserver(system_modal_container_window_observer_.get());
AddObserverToChildren(system_modal,
system_modal_container_child_window_observer_.get());
}
@@ -329,14 +317,11 @@ void ScreenPinningController::KeepPinnedWindowOnTop() {
return;
base::AutoReset<bool> auto_reset(&in_restacking_, true);
- WmWindow* container = pinned_window_->GetParent();
+ aura::Window* container = pinned_window_->parent();
container->StackChildAtTop(pinned_window_);
- WindowDimmer* pinned_window_dimmer =
- window_dimmers_->Get(container->aura_window());
- if (pinned_window_dimmer && pinned_window_dimmer->window()) {
- container->StackChildBelow(WmWindow::Get(pinned_window_dimmer->window()),
- pinned_window_);
- }
+ WindowDimmer* pinned_window_dimmer = window_dimmers_->Get(container);
+ if (pinned_window_dimmer && pinned_window_dimmer->window())
+ container->StackChildBelow(pinned_window_dimmer->window(), pinned_window_);
}
void ScreenPinningController::KeepDimWindowAtBottom(aura::Window* container) {
« no previous file with comments | « ash/wm/screen_pinning_controller.h ('k') | ash/wm/workspace/workspace_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698