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

Unified Diff: ash/common/wm/always_on_top_controller.cc

Issue 2699033002: Replace WmWindowObserver with aura::WindowObserver. (Closed)
Patch Set: Check for null images in ShelfWindowWatcher. Created 3 years, 10 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/common/wm/always_on_top_controller.h ('k') | ash/common/wm/dock/docked_window_layout_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/wm/always_on_top_controller.cc
diff --git a/ash/common/wm/always_on_top_controller.cc b/ash/common/wm/always_on_top_controller.cc
index 80a405a3ea1d222d52625351e3bb170bd7a8da07..0758e8a5388ad739d380321e27d71ed0f1df2104 100644
--- a/ash/common/wm/always_on_top_controller.cc
+++ b/ash/common/wm/always_on_top_controller.cc
@@ -9,6 +9,8 @@
#include "ash/common/wm_window_property.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "base/memory/ptr_util.h"
+#include "ui/aura/client/aura_constants.h"
+#include "ui/aura/window.h"
namespace ash {
@@ -19,12 +21,12 @@ AlwaysOnTopController::AlwaysOnTopController(WmWindow* viewport)
base::MakeUnique<WorkspaceLayoutManager>(viewport));
// Container should be empty.
DCHECK(always_on_top_container_->GetChildren().empty());
- always_on_top_container_->AddObserver(this);
+ always_on_top_container_->aura_window()->AddObserver(this);
}
AlwaysOnTopController::~AlwaysOnTopController() {
if (always_on_top_container_)
- always_on_top_container_->RemoveObserver(this);
+ always_on_top_container_->aura_window()->RemoveObserver(this);
}
WmWindow* AlwaysOnTopController::GetContainer(WmWindow* window) const {
@@ -46,30 +48,30 @@ void AlwaysOnTopController::SetLayoutManagerForTest(
always_on_top_container_->SetLayoutManager(std::move(layout_manager));
}
-void AlwaysOnTopController::OnWindowTreeChanged(
- WmWindow* window,
- const TreeChangeParams& params) {
- if (params.old_parent == always_on_top_container_)
+void AlwaysOnTopController::OnWindowHierarchyChanged(
+ const HierarchyChangeParams& params) {
+ if (WmWindow::Get(params.old_parent) == always_on_top_container_)
params.target->RemoveObserver(this);
- else if (params.new_parent == always_on_top_container_)
+ else if (WmWindow::Get(params.new_parent) == always_on_top_container_)
params.target->AddObserver(this);
}
-void AlwaysOnTopController::OnWindowPropertyChanged(WmWindow* window,
- WmWindowProperty property) {
- if (window != always_on_top_container_ &&
- property == WmWindowProperty::ALWAYS_ON_TOP) {
- DCHECK(window->GetType() == ui::wm::WINDOW_TYPE_NORMAL ||
- window->GetType() == ui::wm::WINDOW_TYPE_POPUP);
- WmWindow* container = GetContainer(window);
- if (window->GetParent() != container)
- container->AddChild(window);
+void AlwaysOnTopController::OnWindowPropertyChanged(aura::Window* window,
+ const void* key,
+ intptr_t old) {
+ if (WmWindow::Get(window) != always_on_top_container_ &&
+ key == aura::client::kAlwaysOnTopKey) {
+ DCHECK(window->type() == ui::wm::WINDOW_TYPE_NORMAL ||
+ window->type() == ui::wm::WINDOW_TYPE_POPUP);
+ WmWindow* container = GetContainer(WmWindow::Get(window));
+ if (WmWindow::Get(window->parent()) != container)
+ container->AddChild(WmWindow::Get(window));
}
}
-void AlwaysOnTopController::OnWindowDestroying(WmWindow* window) {
- if (window == always_on_top_container_) {
- always_on_top_container_->RemoveObserver(this);
+void AlwaysOnTopController::OnWindowDestroying(aura::Window* window) {
+ if (WmWindow::Get(window) == always_on_top_container_) {
+ always_on_top_container_->aura_window()->RemoveObserver(this);
always_on_top_container_ = nullptr;
}
}
« no previous file with comments | « ash/common/wm/always_on_top_controller.h ('k') | ash/common/wm/dock/docked_window_layout_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698