| 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/base_layout_manager.h" | 5 #include "ash/wm/base_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.h" |
| 8 #include "ash/screen_ash.h" | 8 #include "ash/screen_ash.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/shelf_layout_manager.h" | 10 #include "ash/wm/shelf_layout_manager.h" |
| 11 #include "ash/wm/window_animations.h" | 11 #include "ash/wm/window_animations.h" |
| 12 #include "ash/wm/window_properties.h" | 12 #include "ash/wm/window_properties.h" |
| 13 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 14 #include "ash/wm/workspace_controller.h" |
| 14 #include "base/command_line.h" | 15 #include "base/command_line.h" |
| 15 #include "ui/aura/client/aura_constants.h" | 16 #include "ui/aura/client/aura_constants.h" |
| 16 #include "ui/aura/root_window.h" | 17 #include "ui/aura/root_window.h" |
| 17 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
| 18 #include "ui/base/ui_base_types.h" | 19 #include "ui/base/ui_base_types.h" |
| 19 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
| 20 #include "ui/gfx/screen.h" | 21 #include "ui/gfx/screen.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ui::WindowShowState new_state = | 137 ui::WindowShowState new_state = |
| 137 window->GetProperty(aura::client::kShowStateKey); | 138 window->GetProperty(aura::client::kShowStateKey); |
| 138 if (old_state != new_state && old_state != ui::SHOW_STATE_MINIMIZED && | 139 if (old_state != new_state && old_state != ui::SHOW_STATE_MINIMIZED && |
| 139 ((new_state == ui::SHOW_STATE_MAXIMIZED && | 140 ((new_state == ui::SHOW_STATE_MAXIMIZED && |
| 140 old_state != ui::SHOW_STATE_FULLSCREEN) || | 141 old_state != ui::SHOW_STATE_FULLSCREEN) || |
| 141 (new_state == ui::SHOW_STATE_FULLSCREEN && | 142 (new_state == ui::SHOW_STATE_FULLSCREEN && |
| 142 old_state != ui::SHOW_STATE_MAXIMIZED))) { | 143 old_state != ui::SHOW_STATE_MAXIMIZED))) { |
| 143 SetRestoreBoundsInParent(window, window->bounds()); | 144 SetRestoreBoundsInParent(window, window->bounds()); |
| 144 } | 145 } |
| 145 // Minimized state handles its own animations. | 146 // Minimized state handles its own animations. |
| 146 bool animate = (old_state != ui::SHOW_STATE_MINIMIZED); | 147 // TODO(sky): get animations to work with Workspace2. |
| 148 bool animate = (old_state != ui::SHOW_STATE_MINIMIZED) && |
| 149 !WorkspaceController::IsWorkspace2Enabled(); |
| 147 UpdateBoundsFromShowState(window, animate); | 150 UpdateBoundsFromShowState(window, animate); |
| 148 ShowStateChanged(window, old_state); | 151 ShowStateChanged(window, old_state); |
| 149 } | 152 } |
| 150 } | 153 } |
| 151 | 154 |
| 152 void BaseLayoutManager::OnWindowDestroying(aura::Window* window) { | 155 void BaseLayoutManager::OnWindowDestroying(aura::Window* window) { |
| 153 if (root_window_ == window) { | 156 if (root_window_ == window) { |
| 154 root_window_->RemoveObserver(this); | 157 root_window_->RemoveObserver(this); |
| 155 root_window_ = NULL; | 158 root_window_ = NULL; |
| 156 } | 159 } |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 gfx::Rect display_rect = | 256 gfx::Rect display_rect = |
| 254 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window); | 257 ScreenAsh::GetDisplayWorkAreaBoundsInParent(window); |
| 255 // Put as much of the window as possible within the display area. | 258 // Put as much of the window as possible within the display area. |
| 256 window->SetBounds(window->bounds().AdjustToFit(display_rect)); | 259 window->SetBounds(window->bounds().AdjustToFit(display_rect)); |
| 257 } | 260 } |
| 258 } | 261 } |
| 259 } | 262 } |
| 260 | 263 |
| 261 } // namespace internal | 264 } // namespace internal |
| 262 } // namespace ash | 265 } // namespace ash |
| OLD | NEW |