Chromium Code Reviews| Index: ash/common/wm/root_window_layout_manager.cc |
| diff --git a/ash/common/wm/root_window_layout_manager.cc b/ash/common/wm/root_window_layout_manager.cc |
| index 15ec3fbfaaa0219b4aa5d078c9da5d5a12fa3be3..26d4caf0c429fc3c5c17f081df5aa4784d29f544 100644 |
| --- a/ash/common/wm/root_window_layout_manager.cc |
| +++ b/ash/common/wm/root_window_layout_manager.cc |
| @@ -9,25 +9,19 @@ |
| #include "ui/aura/window_tracker.h" |
| namespace ash { |
| -namespace wm { |
| - |
| -//////////////////////////////////////////////////////////////////////////////// |
| -// RootWindowLayoutManager, public: |
| -RootWindowLayoutManager::RootWindowLayoutManager(WmWindow* owner) |
| - : owner_(owner) {} |
| +namespace { |
| -RootWindowLayoutManager::~RootWindowLayoutManager() {} |
| - |
| -//////////////////////////////////////////////////////////////////////////////// |
| -// RootWindowLayoutManager, aura::LayoutManager implementation: |
| - |
| -void RootWindowLayoutManager::OnWindowResized() { |
| - const gfx::Rect fullscreen_bounds = gfx::Rect(owner_->GetBounds().size()); |
| +void ResizeWindow(const aura::Window::Windows& children, |
| + const gfx::Rect& fullscreen_bounds, |
| + int depth) { |
| + // Stop to prevent resizing non top level window such as tooltip. |
| + if (depth > 3) |
| + return; |
|
oshima
2017/04/06 16:34:15
I think this is ok in this CL, but we should make
wutao
2017/04/08 02:07:10
Acknowledged.
|
| // Resize both our immediate children (the containers-of-containers animated |
| // by PowerButtonController) and their children (the actual containers). |
| - aura::WindowTracker children_tracker(owner_->aura_window()->children()); |
| + aura::WindowTracker children_tracker(children); |
| while (!children_tracker.windows().empty()) { |
| aura::Window* child = children_tracker.Pop(); |
| // Skip descendants of top-level windows, i.e. only resize containers and |
| @@ -36,15 +30,30 @@ void RootWindowLayoutManager::OnWindowResized() { |
| continue; |
| child->SetBounds(fullscreen_bounds); |
| - aura::WindowTracker grandchildren_tracker(child->children()); |
| - while (!grandchildren_tracker.windows().empty()) { |
| - child = grandchildren_tracker.Pop(); |
| - if (!child->GetToplevelWindow()) |
| - child->SetBounds(fullscreen_bounds); |
| - } |
| + ResizeWindow(child->children(), fullscreen_bounds, depth + 1); |
|
oshima
2017/04/06 16:34:15
can you define child_depth instead of adding every
wutao
2017/04/08 02:07:10
Done.
|
| } |
| } |
| +} // namespace |
| + |
| +namespace wm { |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// RootWindowLayoutManager, public: |
| + |
| +RootWindowLayoutManager::RootWindowLayoutManager(WmWindow* owner) |
| + : owner_(owner) {} |
| + |
| +RootWindowLayoutManager::~RootWindowLayoutManager() {} |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| +// RootWindowLayoutManager, aura::LayoutManager implementation: |
| + |
| +void RootWindowLayoutManager::OnWindowResized() { |
| + ResizeWindow(owner_->aura_window()->children(), |
| + gfx::Rect(owner_->GetBounds().size()), 1); |
|
oshima
2017/04/06 16:34:15
optional: it's probably easier for us to start wit
wutao
2017/04/08 02:07:10
Done.
|
| +} |
| + |
| void RootWindowLayoutManager::OnWindowAddedToLayout(WmWindow* child) {} |
| void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {} |