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" |
11 #include "ash/shell.h" | 11 #include "ash/shell.h" |
| 12 #include "ash/wm/cursor_manager.h" |
12 #include "ash/wm/property_util.h" | 13 #include "ash/wm/property_util.h" |
13 #include "ash/wm/window_util.h" | 14 #include "ash/wm/window_util.h" |
14 #include "ash/wm/workspace/phantom_window_controller.h" | 15 #include "ash/wm/workspace/phantom_window_controller.h" |
15 #include "ash/wm/workspace/snap_sizer.h" | 16 #include "ash/wm/workspace/snap_sizer.h" |
16 #include "ui/aura/cursor_manager.h" | |
17 #include "ui/aura/env.h" | 17 #include "ui/aura/env.h" |
18 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
19 #include "ui/aura/window_delegate.h" | 19 #include "ui/aura/window_delegate.h" |
20 #include "ui/base/hit_test.h" | 20 #include "ui/base/hit_test.h" |
21 #include "ui/compositor/layer.h" | 21 #include "ui/compositor/layer.h" |
22 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
23 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
24 #include "ui/gfx/transform.h" | 24 #include "ui/gfx/transform.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
(...skipping 12 matching lines...) Expand all Loading... |
39 | 39 |
40 } // namespace | 40 } // namespace |
41 | 41 |
42 // static | 42 // static |
43 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; | 43 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; |
44 | 44 |
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 ash::Shell::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, |
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, window_component); |
59 return details.is_resizable ? | 59 return details.is_resizable ? |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 const Details& details, | 157 const Details& details, |
158 const std::vector<aura::Window*>& attached_windows) | 158 const std::vector<aura::Window*>& attached_windows) |
159 : details_(details), | 159 : details_(details), |
160 attached_windows_(attached_windows), | 160 attached_windows_(attached_windows), |
161 did_move_or_resize_(false), | 161 did_move_or_resize_(false), |
162 total_min_(0), | 162 total_min_(0), |
163 total_initial_size_(0), | 163 total_initial_size_(0), |
164 snap_type_(SNAP_NONE), | 164 snap_type_(SNAP_NONE), |
165 num_mouse_moves_since_bounds_change_(0) { | 165 num_mouse_moves_since_bounds_change_(0) { |
166 DCHECK(details_.is_resizable); | 166 DCHECK(details_.is_resizable); |
167 aura::Env::GetInstance()->cursor_manager()->LockCursor(); | 167 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
168 | 168 |
169 // Only support attaching to the right/bottom. | 169 // Only support attaching to the right/bottom. |
170 DCHECK(attached_windows_.empty() || | 170 DCHECK(attached_windows_.empty() || |
171 (details.window_component == HTRIGHT || | 171 (details.window_component == HTRIGHT || |
172 details.window_component == HTBOTTOM)); | 172 details.window_component == HTBOTTOM)); |
173 | 173 |
174 // TODO: figure out how to deal with window going off the edge. | 174 // TODO: figure out how to deal with window going off the edge. |
175 | 175 |
176 // Calculate sizes so that we can maintain the ratios if we need to resize. | 176 // Calculate sizes so that we can maintain the ratios if we need to resize. |
177 int total_available = 0; | 177 int total_available = 0; |
(...skipping 258 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 |