Chromium Code Reviews| 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" | |
| 20 #include "ash/wm/workspace/desktop_background_fade_controller.h" | 21 #include "ash/wm/workspace/desktop_background_fade_controller.h" |
| 21 #include "ash/wm/workspace/workspace_animations.h" | 22 #include "ash/wm/workspace/workspace_animations.h" |
| 22 #include "ash/wm/workspace/workspace_layout_manager2.h" | 23 #include "ash/wm/workspace/workspace_layout_manager2.h" |
| 23 #include "ash/wm/workspace/workspace2.h" | 24 #include "ash/wm/workspace/workspace2.h" |
| 24 #include "base/auto_reset.h" | 25 #include "base/auto_reset.h" |
| 25 #include "base/command_line.h" | 26 #include "base/command_line.h" |
| 26 #include "base/logging.h" | 27 #include "base/logging.h" |
| 27 #include "base/stl_util.h" | 28 #include "base/stl_util.h" |
| 28 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
| 29 #include "ui/aura/root_window.h" | 30 #include "ui/aura/root_window.h" |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 590 } | 591 } |
| 591 | 592 |
| 592 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, | 593 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, |
| 593 Window* child) { | 594 Window* child) { |
| 594 child->SetProperty(kWorkspaceKey, workspace); | 595 child->SetProperty(kWorkspaceKey, workspace); |
| 595 // Do nothing (other than updating shelf visibility) as the right parent was | 596 // Do nothing (other than updating shelf visibility) as the right parent was |
| 596 // chosen by way of GetParentForNewWindow() or we explicitly moved the window | 597 // chosen by way of GetParentForNewWindow() or we explicitly moved the window |
| 597 // to the workspace. | 598 // to the workspace. |
| 598 if (workspace == active_workspace_) | 599 if (workspace == active_workspace_) |
| 599 UpdateShelfVisibility(); | 600 UpdateShelfVisibility(); |
| 601 | |
| 602 RearrangeVisibleWindowOnShow(child); | |
| 600 } | 603 } |
| 601 | 604 |
| 602 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, | 605 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, |
| 603 Window* child) { | 606 Window* child) { |
| 607 RearrangeVisibleWindowOnHide(child); | |
| 604 child->ClearProperty(kWorkspaceKey); | 608 child->ClearProperty(kWorkspaceKey); |
| 605 } | 609 } |
| 606 | 610 |
| 607 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, | 611 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, |
| 608 Window* child) { | 612 Window* child) { |
| 609 if (workspace->ShouldMoveToPending()) | 613 if (workspace->ShouldMoveToPending()) |
| 610 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); | 614 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); |
| 611 } | 615 } |
| 612 | 616 |
| 613 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( | 617 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( |
| 614 Workspace2* workspace, | 618 Workspace2* workspace, |
| 615 Window* child) { | 619 Window* child) { |
| 620 | |
| 621 if (child->IsVisible()) | |
|
sky
2012/10/17 15:59:38
I don't get why this needs to be before the Should
Mr4D (OOO till 08-26)
2012/10/17 18:43:56
I am tired arguing. You get it the way and I fix t
sky
2012/10/18 16:11:19
The reason it should be like this is that if Shoul
| |
| 622 RearrangeVisibleWindowOnShow(child); | |
| 623 else | |
| 624 RearrangeVisibleWindowOnHide(child); | |
| 625 | |
| 616 if (workspace->ShouldMoveToPending()) | 626 if (workspace->ShouldMoveToPending()) |
| 617 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); | 627 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); |
| 618 else if (workspace == active_workspace_) | 628 else if (workspace == active_workspace_) |
| 619 UpdateShelfVisibility(); | 629 UpdateShelfVisibility(); |
| 620 } | 630 } |
| 621 | 631 |
| 622 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( | 632 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( |
| 623 Workspace2* workspace, | 633 Workspace2* workspace, |
| 624 Window* child) { | 634 Window* child) { |
| 625 if (workspace == active_workspace_) | 635 if (workspace == active_workspace_) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 716 new_workspace->window()->Show(); | 726 new_workspace->window()->Show(); |
| 717 ReparentWindow(window, new_workspace->window(), NULL); | 727 ReparentWindow(window, new_workspace->window(), NULL); |
| 718 if (is_active) { | 728 if (is_active) { |
| 719 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, | 729 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, |
| 720 base::TimeDelta()); | 730 base::TimeDelta()); |
| 721 } | 731 } |
| 722 } | 732 } |
| 723 | 733 |
| 724 } // namespace internal | 734 } // namespace internal |
| 725 } // namespace ash | 735 } // namespace ash |
| OLD | NEW |