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