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)) { |
258 return; | 260 return; |
| 261 } |
259 | 262 |
260 Window* window = window_state->window(); | 263 Window* window = window_state->window(); |
261 gfx::Rect bounds = window->bounds(); | 264 gfx::Rect bounds = window->bounds(); |
262 | 265 |
263 // Use entire display instead of workarea because the workarea can | 266 // Use entire display instead of workarea because the workarea can |
264 // be further shrunk by the docked area. The logic ensures 30% | 267 // be further shrunk by the docked area. The logic ensures 30% |
265 // visibility which should be enough to see where the window gets | 268 // visibility which should be enough to see where the window gets |
266 // moved. | 269 // moved. |
267 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); | 270 gfx::Rect display_area = ScreenAsh::GetDisplayBoundsInParent(window); |
268 | 271 |
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 | |
280 int min_width = bounds.width() * kMinimumPercentOnScreenArea; | 272 int min_width = bounds.width() * kMinimumPercentOnScreenArea; |
281 int min_height = bounds.height() * kMinimumPercentOnScreenArea; | 273 int min_height = bounds.height() * kMinimumPercentOnScreenArea; |
282 ash::wm::AdjustBoundsToEnsureWindowVisibility( | 274 ash::wm::AdjustBoundsToEnsureWindowVisibility( |
283 display_area, min_width, min_height, &bounds); | 275 display_area, min_width, min_height, &bounds); |
284 AdjustSnappedBounds(window_state, &bounds); | 276 AdjustSnappedBounds(window_state, &bounds); |
285 if (window->bounds() != bounds) | 277 if (window->bounds() != bounds) |
286 window->SetBounds(bounds); | 278 window->SetBounds(bounds); |
287 } | 279 } |
288 | 280 |
289 void WorkspaceLayoutManager::UpdateShelfVisibility() { | 281 void WorkspaceLayoutManager::UpdateShelfVisibility() { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); | 403 ui::ScopedLayerAnimationSettings slide_settings(layer->GetAnimator()); |
412 slide_settings.SetPreemptionStrategy( | 404 slide_settings.SetPreemptionStrategy( |
413 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); | 405 ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET); |
414 slide_settings.SetTransitionDuration( | 406 slide_settings.SetTransitionDuration( |
415 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); | 407 base::TimeDelta::FromMilliseconds(kBoundsChangeSlideDurationMs)); |
416 SetChildBoundsDirect(child, bounds); | 408 SetChildBoundsDirect(child, bounds); |
417 } | 409 } |
418 | 410 |
419 } // namespace internal | 411 } // namespace internal |
420 } // namespace ash | 412 } // namespace ash |
OLD | NEW |