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