Index: ash/wm/workspace/workspace_manager2.cc |
diff --git a/ash/wm/workspace/workspace_manager2.cc b/ash/wm/workspace/workspace_manager2.cc |
index 68250c32e7386b5807d1e2583250fa5e2ab5bf86..4a46cb72c0f228b32d6d0233dd70e5c0b2afb126 100644 |
--- a/ash/wm/workspace/workspace_manager2.cc |
+++ b/ash/wm/workspace/workspace_manager2.cc |
@@ -17,6 +17,7 @@ |
#include "ash/wm/window_animations.h" |
#include "ash/wm/window_properties.h" |
#include "ash/wm/window_util.h" |
+#include "ash/wm/workspace/auto_window_management.h" |
#include "ash/wm/workspace/desktop_background_fade_controller.h" |
#include "ash/wm/workspace/workspace_animations.h" |
#include "ash/wm/workspace/workspace_layout_manager2.h" |
@@ -593,10 +594,14 @@ void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, |
// to the workspace. |
if (workspace == active_workspace_) |
UpdateShelfVisibility(); |
+ |
+ RearrangeVisibleWindowOnShow(child); |
} |
void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, |
Window* child) { |
+ if (child->TargetVisibility()) |
+ RearrangeVisibleWindowOnHideOrRemove(child); |
child->ClearProperty(kWorkspaceKey); |
} |
@@ -609,10 +614,16 @@ void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, |
void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( |
Workspace2* workspace, |
Window* child) { |
- if (workspace->ShouldMoveToPending()) |
+ if (workspace->ShouldMoveToPending()) { |
MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); |
- else if (workspace == active_workspace_) |
- UpdateShelfVisibility(); |
+ } else { |
+ if (child->TargetVisibility()) |
+ RearrangeVisibleWindowOnShow(child); |
+ else |
+ RearrangeVisibleWindowOnHideOrRemove(child); |
+ if (workspace == active_workspace_) |
+ UpdateShelfVisibility(); |
+ } |
} |
void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( |