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_manager.h" | 5 #include "ash/wm/workspace/workspace_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "ash/ash_switches.h" | |
11 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
12 #include "ash/shell.h" | 11 #include "ash/shell.h" |
13 #include "ash/shell_window_ids.h" | 12 #include "ash/shell_window_ids.h" |
14 #include "ash/wm/base_layout_manager.h" | 13 #include "ash/wm/base_layout_manager.h" |
15 #include "ash/wm/frame_painter.h" | 14 #include "ash/wm/frame_painter.h" |
16 #include "ash/wm/property_util.h" | 15 #include "ash/wm/property_util.h" |
17 #include "ash/wm/shelf_layout_manager.h" | 16 #include "ash/wm/shelf_layout_manager.h" |
18 #include "ash/wm/window_animations.h" | 17 #include "ash/wm/window_animations.h" |
19 #include "ash/wm/window_properties.h" | 18 #include "ash/wm/window_properties.h" |
20 #include "ash/wm/window_util.h" | 19 #include "ash/wm/window_util.h" |
21 #include "ash/wm/workspace/auto_window_management.h" | 20 #include "ash/wm/workspace/auto_window_management.h" |
22 #include "ash/wm/workspace/desktop_background_fade_controller.h" | 21 #include "ash/wm/workspace/desktop_background_fade_controller.h" |
23 #include "ash/wm/workspace/workspace_animations.h" | 22 #include "ash/wm/workspace/workspace_animations.h" |
24 #include "ash/wm/workspace/workspace_cycler.h" | 23 #include "ash/wm/workspace/workspace_cycler.h" |
25 #include "ash/wm/workspace/workspace_cycler_animator.h" | 24 #include "ash/wm/workspace/workspace_cycler_animator.h" |
| 25 #include "ash/wm/workspace/workspace_cycler_configuration.h" |
26 #include "ash/wm/workspace/workspace_layout_manager.h" | 26 #include "ash/wm/workspace/workspace_layout_manager.h" |
27 #include "ash/wm/workspace/workspace.h" | 27 #include "ash/wm/workspace/workspace.h" |
28 #include "base/auto_reset.h" | 28 #include "base/auto_reset.h" |
29 #include "base/command_line.h" | |
30 #include "base/logging.h" | 29 #include "base/logging.h" |
31 #include "base/stl_util.h" | 30 #include "base/stl_util.h" |
32 #include "ui/aura/client/aura_constants.h" | 31 #include "ui/aura/client/aura_constants.h" |
33 #include "ui/aura/root_window.h" | 32 #include "ui/aura/root_window.h" |
34 #include "ui/aura/window.h" | 33 #include "ui/aura/window.h" |
35 #include "ui/aura/window_property.h" | 34 #include "ui/aura/window_property.h" |
36 #include "ui/base/ui_base_types.h" | 35 #include "ui/base/ui_base_types.h" |
37 #include "ui/compositor/layer.h" | 36 #include "ui/compositor/layer.h" |
38 #include "ui/compositor/layer_animator.h" | 37 #include "ui/compositor/layer_animator.h" |
39 #include "ui/compositor/scoped_layer_animation_settings.h" | 38 #include "ui/compositor/scoped_layer_animation_settings.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 workspace_cycler_(NULL) { | 119 workspace_cycler_(NULL) { |
121 // Clobber any existing event filter. | 120 // Clobber any existing event filter. |
122 contents_view->SetEventFilter(NULL); | 121 contents_view->SetEventFilter(NULL); |
123 // |contents_view| takes ownership of LayoutManagerImpl. | 122 // |contents_view| takes ownership of LayoutManagerImpl. |
124 contents_view->SetLayoutManager(new LayoutManagerImpl(this)); | 123 contents_view->SetLayoutManager(new LayoutManagerImpl(this)); |
125 active_workspace_ = CreateWorkspace(false); | 124 active_workspace_ = CreateWorkspace(false); |
126 workspaces_.push_back(active_workspace_); | 125 workspaces_.push_back(active_workspace_); |
127 active_workspace_->window()->Show(); | 126 active_workspace_->window()->Show(); |
128 Shell::GetInstance()->AddShellObserver(this); | 127 Shell::GetInstance()->AddShellObserver(this); |
129 | 128 |
130 if (CommandLine::ForCurrentProcess()->HasSwitch( | 129 if (ash::WorkspaceCyclerConfiguration::IsCyclerEnabled()) |
131 switches::kAshEnableWorkspaceScrubbing)) { | |
132 workspace_cycler_.reset(new WorkspaceCycler(this)); | 130 workspace_cycler_.reset(new WorkspaceCycler(this)); |
133 } | |
134 } | 131 } |
135 | 132 |
136 WorkspaceManager::~WorkspaceManager() { | 133 WorkspaceManager::~WorkspaceManager() { |
137 Shell::GetInstance()->RemoveShellObserver(this); | 134 Shell::GetInstance()->RemoveShellObserver(this); |
138 // Release the windows, they'll be destroyed when |contents_view_| is | 135 // Release the windows, they'll be destroyed when |contents_view_| is |
139 // destroyed. | 136 // destroyed. |
140 std::for_each(workspaces_.begin(), workspaces_.end(), | 137 std::for_each(workspaces_.begin(), workspaces_.end(), |
141 std::mem_fun(&Workspace::ReleaseWindow)); | 138 std::mem_fun(&Workspace::ReleaseWindow)); |
142 std::for_each(pending_workspaces_.begin(), pending_workspaces_.end(), | 139 std::for_each(pending_workspaces_.begin(), pending_workspaces_.end(), |
143 std::mem_fun(&Workspace::ReleaseWindow)); | 140 std::mem_fun(&Workspace::ReleaseWindow)); |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 new_workspace->window()->Show(); | 792 new_workspace->window()->Show(); |
796 ReparentWindow(window, new_workspace->window(), NULL); | 793 ReparentWindow(window, new_workspace->window(), NULL); |
797 if (is_active) { | 794 if (is_active) { |
798 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, | 795 SetActiveWorkspace(new_workspace, SWITCH_TRACKED_BY_WORKSPACE_CHANGED, |
799 base::TimeDelta()); | 796 base::TimeDelta()); |
800 } | 797 } |
801 } | 798 } |
802 | 799 |
803 } // namespace internal | 800 } // namespace internal |
804 } // namespace ash | 801 } // namespace ash |
OLD | NEW |