OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/wm/workspace/workspace_manager2.h" | 5 #include "ash/wm/workspace/workspace_manager2.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 13 #include "ash/shell_window_ids.h" |
14 #include "ash/wm/base_layout_manager.h" | 14 #include "ash/wm/base_layout_manager.h" |
15 #include "ash/wm/property_util.h" | 15 #include "ash/wm/property_util.h" |
16 #include "ash/wm/shelf_layout_manager.h" | 16 #include "ash/wm/shelf_layout_manager.h" |
17 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
18 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
19 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
20 #include "ash/wm/workspace/auto_window_management.h" | |
21 #include "ash/wm/workspace/desktop_background_fade_controller.h" | 20 #include "ash/wm/workspace/desktop_background_fade_controller.h" |
22 #include "ash/wm/workspace/workspace_animations.h" | 21 #include "ash/wm/workspace/workspace_animations.h" |
23 #include "ash/wm/workspace/workspace_layout_manager2.h" | 22 #include "ash/wm/workspace/workspace_layout_manager2.h" |
24 #include "ash/wm/workspace/workspace2.h" | 23 #include "ash/wm/workspace/workspace2.h" |
25 #include "base/auto_reset.h" | 24 #include "base/auto_reset.h" |
26 #include "base/command_line.h" | 25 #include "base/command_line.h" |
27 #include "base/logging.h" | 26 #include "base/logging.h" |
28 #include "base/stl_util.h" | 27 #include "base/stl_util.h" |
29 #include "ui/aura/client/aura_constants.h" | 28 #include "ui/aura/client/aura_constants.h" |
30 #include "ui/aura/root_window.h" | 29 #include "ui/aura/root_window.h" |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
587 } | 586 } |
588 | 587 |
589 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, | 588 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, |
590 Window* child) { | 589 Window* child) { |
591 child->SetProperty(kWorkspaceKey, workspace); | 590 child->SetProperty(kWorkspaceKey, workspace); |
592 // Do nothing (other than updating shelf visibility) as the right parent was | 591 // Do nothing (other than updating shelf visibility) as the right parent was |
593 // chosen by way of GetParentForNewWindow() or we explicitly moved the window | 592 // chosen by way of GetParentForNewWindow() or we explicitly moved the window |
594 // to the workspace. | 593 // to the workspace. |
595 if (workspace == active_workspace_) | 594 if (workspace == active_workspace_) |
596 UpdateShelfVisibility(); | 595 UpdateShelfVisibility(); |
597 | |
598 RearrangeVisibleWindowOnShow(child); | |
599 } | 596 } |
600 | 597 |
601 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, | 598 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, |
602 Window* child) { | 599 Window* child) { |
603 if (child->TargetVisibility()) | |
604 RearrangeVisibleWindowOnHideOrRemove(child); | |
605 child->ClearProperty(kWorkspaceKey); | 600 child->ClearProperty(kWorkspaceKey); |
606 } | 601 } |
607 | 602 |
608 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, | 603 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, |
609 Window* child) { | 604 Window* child) { |
610 if (workspace->ShouldMoveToPending()) | 605 if (workspace->ShouldMoveToPending()) |
611 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); | 606 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); |
612 } | 607 } |
613 | 608 |
614 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( | 609 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( |
615 Workspace2* workspace, | 610 Workspace2* workspace, |
616 Window* child) { | 611 Window* child) { |
617 if (workspace->ShouldMoveToPending()) { | 612 if (workspace->ShouldMoveToPending()) |
618 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); | 613 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); |
619 } else { | 614 else if (workspace == active_workspace_) |
620 if (child->TargetVisibility()) | 615 UpdateShelfVisibility(); |
621 RearrangeVisibleWindowOnShow(child); | |
622 else | |
623 RearrangeVisibleWindowOnHideOrRemove(child); | |
624 if (workspace == active_workspace_) | |
625 UpdateShelfVisibility(); | |
626 } | |
627 } | 616 } |
628 | 617 |
629 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( | 618 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( |
630 Workspace2* workspace, | 619 Workspace2* workspace, |
631 Window* child) { | 620 Window* child) { |
632 if (workspace == active_workspace_) | 621 if (workspace == active_workspace_) |
633 UpdateShelfVisibility(); | 622 UpdateShelfVisibility(); |
634 } | 623 } |
635 | 624 |
636 void WorkspaceManager2::OnWorkspaceWindowShowStateChanged( | 625 void WorkspaceManager2::OnWorkspaceWindowShowStateChanged( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 new_workspace->window()->Show(); | 712 new_workspace->window()->Show(); |
724 ReparentWindow(window, new_workspace->window(), NULL); | 713 ReparentWindow(window, new_workspace->window(), NULL); |
725 if (is_active) { | 714 if (is_active) { |
726 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, | 715 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, |
727 base::TimeDelta()); | 716 base::TimeDelta()); |
728 } | 717 } |
729 } | 718 } |
730 | 719 |
731 } // namespace internal | 720 } // namespace internal |
732 } // namespace ash | 721 } // namespace ash |
OLD | NEW |