Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ash/wm/workspace/workspace_manager2.cc

Issue 11085053: Improving window auto management between workspaces (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed a part of the change which slipped in through a branch switch and eclipse usage Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 587 }
587 588
588 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace, 589 void WorkspaceManager2::OnWindowAddedToWorkspace(Workspace2* workspace,
589 Window* child) { 590 Window* child) {
590 child->SetProperty(kWorkspaceKey, workspace); 591 child->SetProperty(kWorkspaceKey, workspace);
591 // Do nothing (other than updating shelf visibility) as the right parent was 592 // Do nothing (other than updating shelf visibility) as the right parent was
592 // chosen by way of GetParentForNewWindow() or we explicitly moved the window 593 // chosen by way of GetParentForNewWindow() or we explicitly moved the window
593 // to the workspace. 594 // to the workspace.
594 if (workspace == active_workspace_) 595 if (workspace == active_workspace_)
595 UpdateShelfVisibility(); 596 UpdateShelfVisibility();
597
598 RearrangeVisibleWindowOnShow(child);
596 } 599 }
597 600
598 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace, 601 void WorkspaceManager2::OnWillRemoveWindowFromWorkspace(Workspace2* workspace,
599 Window* child) { 602 Window* child) {
603 if (child->TargetVisibility())
604 RearrangeVisibleWindowOnHideOrRemove(child);
600 child->ClearProperty(kWorkspaceKey); 605 child->ClearProperty(kWorkspaceKey);
601 } 606 }
602 607
603 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace, 608 void WorkspaceManager2::OnWindowRemovedFromWorkspace(Workspace2* workspace,
604 Window* child) { 609 Window* child) {
605 if (workspace->ShouldMoveToPending()) 610 if (workspace->ShouldMoveToPending())
606 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED); 611 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_WINDOW_REMOVED);
607 } 612 }
608 613
609 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged( 614 void WorkspaceManager2::OnWorkspaceChildWindowVisibilityChanged(
610 Workspace2* workspace, 615 Workspace2* workspace,
611 Window* child) { 616 Window* child) {
612 if (workspace->ShouldMoveToPending()) 617 if (workspace->ShouldMoveToPending()) {
613 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED); 618 MoveWorkspaceToPendingOrDelete(workspace, NULL, SWITCH_VISIBILITY_CHANGED);
614 else if (workspace == active_workspace_) 619 } else {
615 UpdateShelfVisibility(); 620 if (child->TargetVisibility())
621 RearrangeVisibleWindowOnShow(child);
622 else
623 RearrangeVisibleWindowOnHideOrRemove(child);
624 if (workspace == active_workspace_)
625 UpdateShelfVisibility();
626 }
616 } 627 }
617 628
618 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged( 629 void WorkspaceManager2::OnWorkspaceWindowChildBoundsChanged(
619 Workspace2* workspace, 630 Workspace2* workspace,
620 Window* child) { 631 Window* child) {
621 if (workspace == active_workspace_) 632 if (workspace == active_workspace_)
622 UpdateShelfVisibility(); 633 UpdateShelfVisibility();
623 } 634 }
624 635
625 void WorkspaceManager2::OnWorkspaceWindowShowStateChanged( 636 void WorkspaceManager2::OnWorkspaceWindowShowStateChanged(
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 new_workspace->window()->Show(); 723 new_workspace->window()->Show();
713 ReparentWindow(window, new_workspace->window(), NULL); 724 ReparentWindow(window, new_workspace->window(), NULL);
714 if (is_active) { 725 if (is_active) {
715 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, 726 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED,
716 base::TimeDelta()); 727 base::TimeDelta());
717 } 728 }
718 } 729 }
719 730
720 } // namespace internal 731 } // namespace internal
721 } // namespace ash 732 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager2_unittest.cc ('k') | ash/wm/workspace/workspace_manager2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698