Index: athena/wm/window_manager_impl.cc |
diff --git a/athena/wm/window_manager_impl.cc b/athena/wm/window_manager_impl.cc |
index 3dd9612467b06b42c2a23922e7f8a3189708965f..d78233e55cdcf0d7c0a55079dec54c0dda2b3fc4 100644 |
--- a/athena/wm/window_manager_impl.cc |
+++ b/athena/wm/window_manager_impl.cc |
@@ -25,8 +25,8 @@ |
namespace athena { |
namespace { |
- |
class WindowManagerImpl* instance = NULL; |
+} // namespace |
class AthenaContainerLayoutManager : public aura::LayoutManager { |
public: |
@@ -54,11 +54,47 @@ AthenaContainerLayoutManager::~AthenaContainerLayoutManager() { |
} |
void AthenaContainerLayoutManager::OnWindowResized() { |
- instance->Layout(); |
+ // Resize all the existing windows. |
+ const aura::Window::Windows& list = instance->container_->children(); |
+ const gfx::Size container_size = instance->container_->bounds().size(); |
+ bool is_splitview = instance->split_view_controller_->IsSplitViewModeActive(); |
+ gfx::Size split_size; |
+ if (is_splitview) { |
+ CHECK(instance->split_view_controller_->left_window()); |
+ split_size = |
+ instance->split_view_controller_->left_window()->bounds().size(); |
+ } |
+ |
+ for (aura::Window::Windows::const_iterator iter = list.begin(); |
+ iter != list.end(); |
+ ++iter) { |
+ aura::Window* window = *iter; |
+ if (window->type() != ui::wm::WINDOW_TYPE_NORMAL) |
+ return; |
+ if (is_splitview) { |
+ if (window == instance->split_view_controller_->left_window()) |
+ window->SetBounds(gfx::Rect(split_size)); |
+ else if (window == instance->split_view_controller_->right_window()) |
+ window->SetBounds( |
+ gfx::Rect(gfx::Point(split_size.width(), 0), split_size)); |
+ else |
+ window->SetBounds(gfx::Rect(container_size)); |
+ } else { |
+ window->SetBounds(gfx::Rect(container_size)); |
+ } |
+ } |
} |
void AthenaContainerLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
- instance->Layout(); |
+ if (child->type() != ui::wm::WINDOW_TYPE_NORMAL) |
+ return; |
+ aura::Window* window = NULL; |
+ if (instance->split_view_controller_->IsSplitViewModeActive()) |
+ window = instance->split_view_controller_->left_window(); |
+ else |
+ window = instance->container_.get(); |
+ CHECK(window); |
+ child->SetBounds(gfx::Rect(window->bounds().size())); |
} |
void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout( |
@@ -67,13 +103,11 @@ void AthenaContainerLayoutManager::OnWillRemoveWindowFromLayout( |
void AthenaContainerLayoutManager::OnWindowRemovedFromLayout( |
aura::Window* child) { |
- instance->Layout(); |
} |
void AthenaContainerLayoutManager::OnChildWindowVisibilityChanged( |
aura::Window* child, |
bool visible) { |
- instance->Layout(); |
} |
void AthenaContainerLayoutManager::SetChildBounds( |
@@ -83,8 +117,6 @@ void AthenaContainerLayoutManager::SetChildBounds( |
SetChildBoundsDirect(child, requested_bounds); |
} |
-} // namespace |
- |
WindowManagerImpl::WindowManagerImpl() { |
ScreenManager::ContainerParams params("DefaultContainer", CP_DEFAULT); |
params.can_activate_children = true; |
@@ -120,19 +152,6 @@ WindowManagerImpl::~WindowManagerImpl() { |
instance = NULL; |
} |
-void WindowManagerImpl::Layout() { |
- if (!container_) |
- return; |
- gfx::Rect bounds = gfx::Rect(container_->bounds().size()); |
- const aura::Window::Windows& children = container_->children(); |
- for (aura::Window::Windows::const_iterator iter = children.begin(); |
- iter != children.end(); |
- ++iter) { |
- if ((*iter)->type() == ui::wm::WINDOW_TYPE_NORMAL) |
- (*iter)->SetBounds(bounds); |
- } |
-} |
- |
void WindowManagerImpl::ToggleOverview() { |
SetInOverview(overview_.get() == NULL); |
} |