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

Unified Diff: ash/mus/bridge/mus_layout_manager_adapter.cc

Issue 2387013003: Adds OnChildWindowVisibilityChanged to ui::WindowObserver (Closed)
Patch Set: merge Created 4 years, 2 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/mus/bridge/mus_layout_manager_adapter.h ('k') | ash/mus/bridge/wm_window_mus.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/mus/bridge/mus_layout_manager_adapter.cc
diff --git a/ash/mus/bridge/mus_layout_manager_adapter.cc b/ash/mus/bridge/mus_layout_manager_adapter.cc
index 58d3ffd097fd142bc40ec4a8101a4739a633bda0..2cada41691fe1e97be1169104cc8bde7f6a06622 100644
--- a/ash/mus/bridge/mus_layout_manager_adapter.cc
+++ b/ash/mus/bridge/mus_layout_manager_adapter.cc
@@ -11,33 +11,15 @@
namespace ash {
namespace mus {
-MusLayoutManagerAdapter::ChildWindowObserver::ChildWindowObserver(
- MusLayoutManagerAdapter* adapter)
- : adapter_(adapter) {}
-
-MusLayoutManagerAdapter::ChildWindowObserver::~ChildWindowObserver() {}
-
-void MusLayoutManagerAdapter::ChildWindowObserver::OnWindowVisibilityChanged(
- ui::Window* window) {
- adapter_->layout_manager_->OnChildWindowVisibilityChanged(
- WmWindowMus::Get(window), window->visible());
-}
-
MusLayoutManagerAdapter::MusLayoutManagerAdapter(
ui::Window* window,
std::unique_ptr<WmLayoutManager> layout_manager)
: window_(window),
- child_window_observer_(this),
layout_manager_(std::move(layout_manager)) {
window_->AddObserver(this);
- for (ui::Window* child : window_->children())
- child->AddObserver(&child_window_observer_);
}
MusLayoutManagerAdapter::~MusLayoutManagerAdapter() {
- for (ui::Window* child : window_->children())
- child->RemoveObserver(&child_window_observer_);
-
window_->RemoveObserver(this);
}
@@ -49,13 +31,10 @@ void MusLayoutManagerAdapter::OnTreeChanging(const TreeChangeParams& params) {
}
void MusLayoutManagerAdapter::OnTreeChanged(const TreeChangeParams& params) {
- if (params.new_parent == window_) {
+ if (params.new_parent == window_)
layout_manager_->OnWindowAddedToLayout(WmWindowMus::Get(params.target));
- params.target->AddObserver(&child_window_observer_);
- } else if (params.old_parent == window_) {
- params.target->RemoveObserver(&child_window_observer_);
+ else if (params.old_parent == window_)
layout_manager_->OnWindowRemovedFromLayout(WmWindowMus::Get(params.target));
- }
}
void MusLayoutManagerAdapter::OnWindowBoundsChanged(
@@ -65,5 +44,11 @@ void MusLayoutManagerAdapter::OnWindowBoundsChanged(
layout_manager_->OnWindowResized();
}
+void MusLayoutManagerAdapter::OnChildWindowVisibilityChanged(ui::Window* window,
+ bool visible) {
+ layout_manager_->OnChildWindowVisibilityChanged(WmWindowMus::Get(window),
+ visible);
+}
+
} // namespace mus
} // namespace ash
« no previous file with comments | « ash/mus/bridge/mus_layout_manager_adapter.h ('k') | ash/mus/bridge/wm_window_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698