| 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 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "ui/aura/root_window.h" | 26 #include "ui/aura/root_window.h" |
| 27 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 28 #include "ui/aura/window_delegate.h" | 28 #include "ui/aura/window_delegate.h" |
| 29 #include "ui/base/hit_test.h" | 29 #include "ui/base/hit_test.h" |
| 30 #include "ui/compositor/layer.h" | 30 #include "ui/compositor/layer.h" |
| 31 #include "ui/gfx/screen.h" | 31 #include "ui/gfx/screen.h" |
| 32 #include "ui/gfx/transform.h" | 32 #include "ui/gfx/transform.h" |
| 33 | 33 |
| 34 namespace ash { | 34 namespace ash { |
| 35 | 35 |
| 36 scoped_ptr<WindowResizer> CreateWindowResizer(aura::Window* window, | 36 scoped_ptr<WindowResizer> CreateWindowResizer(WindowResizerOwner* owner, |
| 37 aura::Window* window, |
| 37 const gfx::Point& point_in_parent, | 38 const gfx::Point& point_in_parent, |
| 38 int window_component) { | 39 int window_component) { |
| 39 DCHECK(window); | 40 DCHECK(window); |
| 40 // No need to return a resizer when the window cannot get resized. | 41 // No need to return a resizer when the window cannot get resized. |
| 41 if (!wm::CanResizeWindow(window) && window_component != HTCAPTION) | 42 if (!wm::CanResizeWindow(window) && window_component != HTCAPTION) |
| 42 return scoped_ptr<WindowResizer>(); | 43 return scoped_ptr<WindowResizer>(); |
| 43 | 44 |
| 44 WindowResizer* window_resizer = NULL; | 45 WindowResizer* window_resizer = NULL; |
| 45 if (window->type() == aura::client::WINDOW_TYPE_PANEL) { | 46 if (window->type() == aura::client::WINDOW_TYPE_PANEL) { |
| 46 window_resizer = PanelWindowResizer::Create( | 47 window_resizer = PanelWindowResizer::Create( |
| 47 window, point_in_parent, window_component); | 48 owner, window, point_in_parent, window_component); |
| 48 } else if (window->parent() && | 49 } else if (window->parent() && |
| 49 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { | 50 window->parent()->id() == internal::kShellWindowId_WorkspaceContainer) { |
| 50 // Allow dragging maximized windows if it's not tracked by workspace. This | 51 // Allow dragging maximized windows if it's not tracked by workspace. This |
| 51 // is set by tab dragging code. | 52 // is set by tab dragging code. |
| 52 if (!wm::IsWindowNormal(window) && | 53 if (!wm::IsWindowNormal(window) && |
| 53 (window_component != HTCAPTION || GetTrackedByWorkspace(window))) | 54 (window_component != HTCAPTION || GetTrackedByWorkspace(window))) |
| 54 return scoped_ptr<WindowResizer>(); | 55 return scoped_ptr<WindowResizer>(); |
| 55 window_resizer = internal::WorkspaceWindowResizer::Create( | 56 window_resizer = internal::WorkspaceWindowResizer::Create( |
| 56 window, | 57 window, |
| 57 point_in_parent, | 58 point_in_parent, |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 826 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window())); | 827 gfx::Rect area(ScreenAsh::GetDisplayBoundsInParent(window())); |
| 827 if (location.x() <= area.x()) | 828 if (location.x() <= area.x()) |
| 828 return SNAP_LEFT_EDGE; | 829 return SNAP_LEFT_EDGE; |
| 829 if (location.x() >= area.right() - 1) | 830 if (location.x() >= area.right() - 1) |
| 830 return SNAP_RIGHT_EDGE; | 831 return SNAP_RIGHT_EDGE; |
| 831 return SNAP_NONE; | 832 return SNAP_NONE; |
| 832 } | 833 } |
| 833 | 834 |
| 834 } // namespace internal | 835 } // namespace internal |
| 835 } // namespace ash | 836 } // namespace ash |
| OLD | NEW |