Index: ash/wm/workspace/workspace_layout_manager.cc |
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc |
index 0ac362cda8f2b5183630dee9406a5538fcb0d973..b1f8f6605cf12258670411d0b39e58b76098b21c 100644 |
--- a/ash/wm/workspace/workspace_layout_manager.cc |
+++ b/ash/wm/workspace/workspace_layout_manager.cc |
@@ -8,6 +8,7 @@ |
#include "ash/wm/window_util.h" |
#include "ash/wm/workspace/workspace.h" |
#include "ash/wm/workspace/workspace_manager.h" |
+#include "ash/wm/workspace/workspace_window_resizer.h" |
#include "ui/aura/client/aura_constants.h" |
#include "ui/aura/event.h" |
#include "ui/aura/root_window.h" |
@@ -29,13 +30,19 @@ WorkspaceLayoutManager::WorkspaceLayoutManager( |
: workspace_manager_(workspace_manager) { |
} |
-WorkspaceLayoutManager::~WorkspaceLayoutManager() {} |
+WorkspaceLayoutManager::~WorkspaceLayoutManager() { |
+ const aura::Window::Windows& windows( |
+ workspace_manager_->contents_view()->children()); |
+ for (size_t i = 0; i < windows.size(); ++i) |
+ windows[i]->RemoveObserver(this); |
+} |
void WorkspaceLayoutManager::OnWindowResized() { |
// Workspace is updated via RootWindowObserver::OnRootWindowResized. |
} |
void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
+ child->AddObserver(this); |
if (!workspace_manager_->IsManagedWindow(child)) |
return; |
@@ -56,6 +63,7 @@ void WorkspaceLayoutManager::OnWindowAddedToLayout(aura::Window* child) { |
void WorkspaceLayoutManager::OnWillRemoveWindowFromLayout( |
aura::Window* child) { |
+ child->RemoveObserver(this); |
ClearRestoreBounds(child); |
workspace_manager_->RemoveWindow(child); |
} |
@@ -75,16 +83,29 @@ void WorkspaceLayoutManager::SetChildBounds( |
aura::Window* child, |
const gfx::Rect& requested_bounds) { |
gfx::Rect child_bounds(requested_bounds); |
- if (wm::IsWindowMaximized(child)) { |
- child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); |
- } else if (wm::IsWindowFullscreen(child)) { |
- child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); |
- } else { |
- child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). |
- AdjustToFit(requested_bounds); |
+ if (GetTrackedByWorkspace(child)) { |
+ if (wm::IsWindowMaximized(child)) { |
+ child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child); |
+ } else if (wm::IsWindowFullscreen(child)) { |
+ child_bounds = gfx::Screen::GetMonitorAreaNearestWindow(child); |
+ } else { |
+ child_bounds = gfx::Screen::GetMonitorWorkAreaNearestWindow(child). |
+ AdjustToFit(requested_bounds); |
+ } |
} |
SetChildBoundsDirect(child, child_bounds); |
} |
+void WorkspaceLayoutManager::OnWindowPropertyChanged(aura::Window* window, |
+ const void* key, |
+ intptr_t old) { |
+ if (key == ash::kWindowTrackedByWorkspaceSplitPropKey && |
+ ash::GetTrackedByWorkspace(window)) { |
+ // We currently don't need to support transitioning from true to false, so |
+ // we ignore it. |
+ workspace_manager_->AddWindow(window); |
+ } |
+} |
+ |
} // namespace internal |
} // namespace ash |