| 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_window_resizer.h" | 5 #include "ash/wm/workspace/workspace_window_resizer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( | 279 void WorkspaceWindowResizer::AdjustBoundsForMainWindow( |
| 280 gfx::Rect* bounds, int grid_size) const { | 280 gfx::Rect* bounds, int grid_size) const { |
| 281 // Always keep kMinOnscreenHeight on the bottom. | 281 // Always keep kMinOnscreenHeight on the bottom. |
| 282 gfx::Rect work_area( | 282 gfx::Rect work_area( |
| 283 gfx::Screen::GetDisplayNearestWindow(window()).work_area()); | 283 gfx::Screen::GetDisplayNearestWindow(window()).work_area()); |
| 284 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, | 284 int max_y = AlignToGridRoundUp(work_area.bottom() - kMinOnscreenHeight, |
| 285 grid_size); | 285 grid_size); |
| 286 if (bounds->y() > max_y) | 286 if (bounds->y() > max_y) |
| 287 bounds->set_y(max_y); | 287 bounds->set_y(max_y); |
| 288 | 288 |
| 289 // Don't allow dragging above the top of the monitor. | 289 // Don't allow dragging above the top of the display. |
| 290 if (bounds->y() <= work_area.y()) | 290 if (bounds->y() <= work_area.y()) |
| 291 bounds->set_y(work_area.y()); | 291 bounds->set_y(work_area.y()); |
| 292 | 292 |
| 293 if (grid_size >= 0 && details_.window_component == HTCAPTION) | 293 if (grid_size >= 0 && details_.window_component == HTCAPTION) |
| 294 SnapToWorkAreaEdges(work_area, bounds, grid_size); | 294 SnapToWorkAreaEdges(work_area, bounds, grid_size); |
| 295 | 295 |
| 296 if (attached_windows_.empty()) | 296 if (attached_windows_.empty()) |
| 297 return; | 297 return; |
| 298 | 298 |
| 299 if (details_.window_component == HTRIGHT) { | 299 if (details_.window_component == HTRIGHT) { |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 i != map.rend(); ) { | 412 i != map.rend(); ) { |
| 413 aura::Window* window = i->second; | 413 aura::Window* window = i->second; |
| 414 ++i; | 414 ++i; |
| 415 if (i != map.rend()) | 415 if (i != map.rend()) |
| 416 parent->StackChildBelow(i->second, window); | 416 parent->StackChildBelow(i->second, window); |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 | 419 |
| 420 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( | 420 WorkspaceWindowResizer::SnapType WorkspaceWindowResizer::GetSnapType( |
| 421 const gfx::Point& location) const { | 421 const gfx::Point& location) const { |
| 422 // TODO: this likely only wants total monitor area, not the area of a single | 422 // TODO: this likely only wants total display area, not the area of a single |
| 423 // monitor. | 423 // display. |
| 424 gfx::Rect area( | 424 gfx::Rect area( |
| 425 gfx::Screen::GetDisplayNearestWindow(details_.window).bounds()); | 425 gfx::Screen::GetDisplayNearestWindow(details_.window).bounds()); |
| 426 if (location.x() <= area.x()) | 426 if (location.x() <= area.x()) |
| 427 return SNAP_LEFT_EDGE; | 427 return SNAP_LEFT_EDGE; |
| 428 if (location.x() >= area.right() - 1) | 428 if (location.x() >= area.right() - 1) |
| 429 return SNAP_RIGHT_EDGE; | 429 return SNAP_RIGHT_EDGE; |
| 430 return SNAP_NONE; | 430 return SNAP_NONE; |
| 431 } | 431 } |
| 432 | 432 |
| 433 } // namespace internal | 433 } // namespace internal |
| 434 } // namespace ash | 434 } // namespace ash |
| OLD | NEW |