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..40b4df66b004c665e64f86603a9b06b1de9dfae5 100644 |
--- a/ash/wm/root_window_layout_manager.cc |
+++ b/ash/wm/root_window_layout_manager.cc |
@@ -9,6 +9,34 @@ |
#include "ui/aura/window_tracker.h" |
namespace ash { |
+ |
+namespace { |
+ |
+// Resize all container windows that RootWindowLayoutManager is responsible for. |
+// That includes all container windows up to three depth except that top level |
+// window which has a delegate. We cannot simply check top level window, because |
+// we need to skip other windows without a delegate, such as ScreenDimmer |
+// windows. |
+// TODO(wutao): The above logic is error prone. Consider using a Shell window id |
+// to indentify such a container. |
+void ResizeWindow(const aura::Window::Windows& children, |
+ const gfx::Rect& fullscreen_bounds, |
+ int depth) { |
+ if (depth > 2) |
+ return; |
+ const int child_depth = depth + 1; |
+ aura::WindowTracker children_tracker(children); |
+ while (!children_tracker.windows().empty()) { |
+ aura::Window* child = children_tracker.Pop(); |
+ if (child->GetToplevelWindow()) |
+ continue; |
+ child->SetBounds(fullscreen_bounds); |
+ ResizeWindow(child->children(), fullscreen_bounds, child_depth); |
+ } |
+} |
+ |
+} // namespace |
+ |
namespace wm { |
//////////////////////////////////////////////////////////////////////////////// |
@@ -23,26 +51,8 @@ RootWindowLayoutManager::~RootWindowLayoutManager() {} |
// RootWindowLayoutManager, aura::LayoutManager implementation: |
void RootWindowLayoutManager::OnWindowResized() { |
- const gfx::Rect fullscreen_bounds = gfx::Rect(owner_->GetBounds().size()); |
- |
- // 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()); |
- while (!children_tracker.windows().empty()) { |
- aura::Window* child = children_tracker.Pop(); |
- // Skip descendants of top-level windows, i.e. only resize containers and |
- // other windows without a delegate, such as ScreenDimmer windows. |
- if (child->GetToplevelWindow()) |
- 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(owner_->aura_window()->children(), |
+ gfx::Rect(owner_->GetBounds().size()), 0); |
} |
void RootWindowLayoutManager::OnWindowAddedToLayout(WmWindow* child) {} |