| 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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 // happens when a new views::Widget is created. | 260 // happens when a new views::Widget is created. |
| 261 // When a window is dragged and dropped onto a different | 261 // When a window is dragged and dropped onto a different |
| 262 // root window, the bounds will be updated after they are added | 262 // root window, the bounds will be updated after they are added |
| 263 // to the root window. | 263 // to the root window. |
| 264 if (window_state->window()->bounds().IsEmpty()) | 264 if (window_state->window()->bounds().IsEmpty()) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 Window* window = window_state->window(); | 267 Window* window = window_state->window(); |
| 268 gfx::Rect bounds = window->bounds(); | 268 gfx::Rect bounds = window->bounds(); |
| 269 | 269 |
| 270 if (window_state->is_dragged()) |
| 271 return; |
| 272 |
| 273 if (SetMaximizedOrFullscreenBounds(window_state)) |
| 274 return; |
| 275 |
| 270 // Use entire display instead of workarea because the workarea can | 276 // Use entire display instead of workarea because the workarea can |
| 271 // be further shrunk by the docked area. The logic ensures 30% | 277 // be further shrunk by the docked area. The logic ensures 30% |
| 272 // visibility which should be enough to see where the window gets | 278 // visibility which should be enough to see where the window gets |
| 273 // moved. | 279 // moved. |
| 274 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); | 280 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); |
| 275 | 281 |
| 276 if (window_state->is_dragged()) { | |
| 277 ash::wm::AdjustBoundsToEnsureMinimumWindowVisibility( | |
| 278 display_area, &bounds); | |
| 279 if (window->bounds() != bounds) | |
| 280 window->SetBounds(bounds); | |
| 281 return; | |
| 282 } | |
| 283 | |
| 284 if (SetMaximizedOrFullscreenBounds(window_state)) | |
| 285 return; | |
| 286 | |
| 287 int min_width = bounds.width() * kMinimumPercentOnScreenArea; | 282 int min_width = bounds.width() * kMinimumPercentOnScreenArea; |
| 288 int min_height = bounds.height() * kMinimumPercentOnScreenArea; | 283 int min_height = bounds.height() * kMinimumPercentOnScreenArea; |
| 289 ash::wm::AdjustBoundsToEnsureWindowVisibility( | 284 ash::wm::AdjustBoundsToEnsureWindowVisibility( |
| 290 display_area, min_width, min_height, &bounds); | 285 display_area, min_width, min_height, &bounds); |
| 291 AdjustSnappedBounds(window_state, &bounds); | 286 AdjustSnappedBounds(window_state, &bounds); |
| 292 if (window->bounds() != bounds) | 287 if (window->bounds() != bounds) |
| 293 window->SetBounds(bounds); | 288 window->SetBounds(bounds); |
| 294 } | 289 } |
| 295 | 290 |
| 296 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 291 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 428 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
| 434 slide_settings.SetPreemptionStrategy( | 429 slide_settings.SetPreemptionStrategy( |
| 435 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 430 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
| 436 slide_settings.SetTransitionDuration( | 431 slide_settings.SetTransitionDuration( |
| 437 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); | 432 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); |
| 438 SetChildBoundsDirect(child, bounds); | 433 SetChildBoundsDirect(child, bounds); |
| 439 } | 434 } |
| 440 | 435 |
| 441 } // namespace internal | 436 } // namespace internal |
| 442 } // namespace ash | 437 } // namespace ash |
| OLD | NEW |