| 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_layout_manager.h" | 5 #include "ash/wm/workspace/workspace_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/screen_ash.h" | 9 #include "ash/screen_ash.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 SetChildBoundsAnimated(window_state->window(), bounds); | 247 SetChildBoundsAnimated(window_state->window(), bounds); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded( | 250 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded( |
| 251 wm::WindowState* window_state) { | 251 wm::WindowState* window_state) { |
| 252 // Don't adjust window bounds if the bounds are empty as this | 252 // Don't adjust window bounds if the bounds are empty as this |
| 253 // happens when a new views::Widget is created. | 253 // happens when a new views::Widget is created. |
| 254 // When a window is dragged and dropped onto a different | 254 // When a window is dragged and dropped onto a different |
| 255 // root window, the bounds will be updated after they are added | 255 // root window, the bounds will be updated after they are added |
| 256 // to the root window. | 256 // to the root window. |
| 257 if (window_state->window()->bounds().IsEmpty() || | 257 if (window_state->window()->bounds().IsEmpty()) |
| 258 window_state->is_dragged() || | |
| 259 SetMaximizedOrFullscreenBounds(window_state)) { | |
| 260 return; | 258 return; |
| 261 } | |
| 262 | 259 |
| 263 Window* window = window_state->window(); | 260 Window* window = window_state->window(); |
| 264 gfx::Rect bounds = window->bounds(); | 261 gfx::Rect bounds = window->bounds(); |
| 265 | 262 |
| 266 // Use entire display instead of workarea because the workarea can | 263 // Use entire display instead of workarea because the workarea can |
| 267 // be further shrunk by the docked area. The logic ensures 30% | 264 // be further shrunk by the docked area. The logic ensures 30% |
| 268 // visibility which should be enough to see where the window gets | 265 // visibility which should be enough to see where the window gets |
| 269 // moved. | 266 // moved. |
| 270 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); | 267 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); |
| 271 | 268 |
| 269 if (window_state->is_dragged()) { |
| 270 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility( |
| 271 display_area, &bounds); |
| 272 if (window->bounds() != bounds) |
| 273 window->SetBounds(bounds); |
| 274 return; |
| 275 } |
| 276 |
| 277 if (SetMaximizedOrFullscreenBounds(window_state)) |
| 278 return; |
| 279 |
| 272 int min_width = bounds.width() * kMinimumPercentOnScreenArea; | 280 int min_width = bounds.width() * kMinimumPercentOnScreenArea; |
| 273 int min_height = bounds.height() * kMinimumPercentOnScreenArea; | 281 int min_height = bounds.height() * kMinimumPercentOnScreenArea; |
| 274 ash::wm::AdjustBoundsToEnsureWindowVisibility( | 282 ash::wm::AdjustBoundsToEnsureWindowVisibility( |
| 275 display_area, min_width, min_height, &bounds); | 283 display_area, min_width, min_height, &bounds); |
| 276 AdjustSnappedBounds(window_state, &bounds); | 284 AdjustSnappedBounds(window_state, &bounds); |
| 277 if (window->bounds() != bounds) | 285 if (window->bounds() != bounds) |
| 278 window->SetBounds(bounds); | 286 window->SetBounds(bounds); |
| 279 } | 287 } |
| 280 | 288 |
| 281 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 289 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 411 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
| 404 slide_settings.SetPreemptionStrategy( | 412 slide_settings.SetPreemptionStrategy( |
| 405 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 413 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 406 slide_settings.SetTransitionDuration( | 414 slide_settings.SetTransitionDuration( |
| 407 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); | 415 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); |
| 408 SetChildBoundsDirect(child, bounds); | 416 SetChildBoundsDirect(child, bounds); |
| 409 } | 417 } |
| 410 | 418 |
| 411 } // namespace internal | 419 } // namespace internal |
| 412 } // namespace ash | 420 } // namespace ash |
| OLD | NEW |