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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded( | 257 void WorkspaceLayoutManager::AdjustWindowBoundsWhenAdded( |
258 wm::WindowState* window_state) { | 258 wm::WindowState* window_state) { |
259 // Don't adjust window bounds if the bounds are empty as this | 259 // Don't adjust window bounds if the bounds are empty as this |
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 if (window_state->is_dragged()) | |
268 return; | |
269 | |
270 if (SetMaximizedOrFullscreenBounds(window_state)) | |
271 return; | |
272 | |
273 Window* window = window_state->window(); | 267 Window* window = window_state->window(); |
274 gfx::Rect bounds = window->bounds(); | 268 gfx::Rect bounds = window->bounds(); |
275 int min_width = bounds.width() * kMinimumPercentOnScreenArea; | 269 |
276 int min_height = bounds.height() * kMinimumPercentOnScreenArea; | |
277 // Use entire display instead of workarea because the workarea can | 270 // Use entire display instead of workarea because the workarea can |
278 // be further shrunk by the docked area. The logic ensures 30% | 271 // be further shrunk by the docked area. The logic ensures 30% |
279 // visibility which should be enough to see where the window gets | 272 // visibility which should be enough to see where the window gets |
280 // moved. | 273 // moved. |
281 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); | 274 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); |
282 | 275 |
| 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; |
| 288 int min_height = bounds.height() * kMinimumPercentOnScreenArea; |
283 ash::wm::AdjustBoundsToEnsureWindowVisibility( | 289 ash::wm::AdjustBoundsToEnsureWindowVisibility( |
284 display_area, min_width, min_height, &bounds); | 290 display_area, min_width, min_height, &bounds); |
285 AdjustSnappedBounds(window_state, &bounds); | 291 AdjustSnappedBounds(window_state, &bounds); |
286 if (window->bounds() != bounds) | 292 if (window->bounds() != bounds) |
287 window->SetBounds(bounds); | 293 window->SetBounds(bounds); |
288 } | 294 } |
289 | 295 |
290 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 296 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
291 if (shelf_) | 297 if (shelf_) |
292 shelf_->UpdateVisibilityState(); | 298 shelf_->UpdateVisibilityState(); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 433 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
428 slide_settings.SetPreemptionStrategy( | 434 slide_settings.SetPreemptionStrategy( |
429 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 435 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
430 slide_settings.SetTransitionDuration( | 436 slide_settings.SetTransitionDuration( |
431 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); | 437 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); |
432 SetChildBoundsDirect(child, bounds); | 438 SetChildBoundsDirect(child, bounds); |
433 } | 439 } |
434 | 440 |
435 } // namespace internal | 441 } // namespace internal |
436 } // namespace ash | 442 } // namespace ash |
OLD | NEW |