Chromium Code Reviews| Index: ash/wm/root_window_layout_manager.cc |
| diff --git a/ash/wm/root_window_layout_manager.cc b/ash/wm/root_window_layout_manager.cc |
| index aa7301dd06d485d8d2cf4afb2c37114d9f47cc09..55cce76ad490e025b6ae86d33610e03059093fcf 100644 |
| --- a/ash/wm/root_window_layout_manager.cc |
| +++ b/ash/wm/root_window_layout_manager.cc |
| @@ -9,25 +9,20 @@ |
| #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 > 2) |
| + return; |
|
sadrul
2017/04/14 05:52:44
This doesn't make sense. Why not check to see if t
oshima
2017/04/14 06:52:15
This is equivalent to what current code does. This
sadrul
2017/04/14 17:00:58
OK. I guess checking 'window->GetTopLevelWindow()
oshima
2017/04/14 17:28:45
You're righ. I'll talk to wutao and we'll update t
wutao
2017/04/14 17:56:21
Comments are updated.
|
| // 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()); |
| + const int child_depth = depth + 1; |
| + 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 +31,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, child_depth); |
| } |
| } |
| +} // 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()), 0); |
| +} |
| + |
| void RootWindowLayoutManager::OnWindowAddedToLayout(WmWindow* child) {} |
| void RootWindowLayoutManager::OnWillRemoveWindowFromLayout(WmWindow* child) {} |