Chromium Code Reviews| 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/screen_ash.h" | 10 #include "ash/screen_ash.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 // static | 45 // static |
| 46 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; | 46 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; |
| 47 | 47 |
| 48 WorkspaceWindowResizer::~WorkspaceWindowResizer() { | 48 WorkspaceWindowResizer::~WorkspaceWindowResizer() { |
| 49 aura::Env::GetInstance()->cursor_manager()->UnlockCursor(); | 49 aura::Env::GetInstance()->cursor_manager()->UnlockCursor(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 // static | 52 // static |
| 53 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( | 53 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( |
| 54 aura::Window* window, | 54 aura::Window* window, |
| 55 const gfx::Point& location, | 55 const gfx::Point& location_in_parent, |
|
sky
2012/07/25 23:51:41
rename argument in header to match.
oshima
2012/07/25 23:55:14
Done.
| |
| 56 int window_component, | 56 int window_component, |
| 57 const std::vector<aura::Window*>& attached_windows) { | 57 const std::vector<aura::Window*>& attached_windows) { |
| 58 Details details(window, location, window_component); | 58 Details details(window, location_in_parent, window_component); |
| 59 return details.is_resizable ? | 59 return details.is_resizable ? |
| 60 new WorkspaceWindowResizer(details, attached_windows) : NULL; | 60 new WorkspaceWindowResizer(details, attached_windows) : NULL; |
| 61 } | 61 } |
| 62 | 62 |
| 63 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { | 63 void WorkspaceWindowResizer::Drag(const gfx::Point& location, int event_flags) { |
| 64 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? | 64 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
| 65 0 : ash::Shell::GetInstance()->GetGridSize(); | 65 0 : ash::Shell::GetInstance()->GetGridSize(); |
| 66 gfx::Rect bounds = CalculateBoundsForDrag(details_, location, grid_size); | 66 gfx::Rect bounds = CalculateBoundsForDrag(details_, location, grid_size); |
| 67 | 67 |
| 68 if (wm::IsWindowNormal(details_.window)) | 68 if (wm::IsWindowNormal(details_.window)) |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(details_.window)); | 436 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(details_.window)); |
| 437 if (location.x() <= area.x()) | 437 if (location.x() <= area.x()) |
| 438 return SNAP_LEFT_EDGE; | 438 return SNAP_LEFT_EDGE; |
| 439 if (location.x() >= area.right() - 1) | 439 if (location.x() >= area.right() - 1) |
| 440 return SNAP_RIGHT_EDGE; | 440 return SNAP_RIGHT_EDGE; |
| 441 return SNAP_NONE; | 441 return SNAP_NONE; |
| 442 } | 442 } |
| 443 | 443 |
| 444 } // namespace internal | 444 } // namespace internal |
| 445 } // namespace ash | 445 } // namespace ash |
| OLD | NEW |