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" |
| 11 #include "ash/wm/cursor_manager.h" |
11 #include "ash/wm/property_util.h" | 12 #include "ash/wm/property_util.h" |
12 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
13 #include "ash/wm/workspace/phantom_window_controller.h" | 14 #include "ash/wm/workspace/phantom_window_controller.h" |
14 #include "ash/wm/workspace/snap_sizer.h" | 15 #include "ash/wm/workspace/snap_sizer.h" |
15 #include "ui/aura/cursor_manager.h" | |
16 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/aura/window_delegate.h" | 18 #include "ui/aura/window_delegate.h" |
19 #include "ui/base/hit_test.h" | 19 #include "ui/base/hit_test.h" |
20 #include "ui/compositor/layer.h" | 20 #include "ui/compositor/layer.h" |
21 #include "ui/compositor/scoped_layer_animation_settings.h" | 21 #include "ui/compositor/scoped_layer_animation_settings.h" |
22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
23 #include "ui/gfx/transform.h" | 23 #include "ui/gfx/transform.h" |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
(...skipping 12 matching lines...) Expand all Loading... |
38 | 38 |
39 } // namespace | 39 } // namespace |
40 | 40 |
41 // static | 41 // static |
42 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; | 42 const int WorkspaceWindowResizer::kMinOnscreenSize = 20; |
43 | 43 |
44 // static | 44 // static |
45 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; | 45 const int WorkspaceWindowResizer::kMinOnscreenHeight = 32; |
46 | 46 |
47 WorkspaceWindowResizer::~WorkspaceWindowResizer() { | 47 WorkspaceWindowResizer::~WorkspaceWindowResizer() { |
48 aura::Env::GetInstance()->cursor_manager()->UnlockCursor(); | 48 ash::Shell::GetInstance()->cursor_manager()->UnlockCursor(); |
49 } | 49 } |
50 | 50 |
51 // static | 51 // static |
52 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( | 52 WorkspaceWindowResizer* WorkspaceWindowResizer::Create( |
53 aura::Window* window, | 53 aura::Window* window, |
54 const gfx::Point& location, | 54 const gfx::Point& location, |
55 int window_component, | 55 int window_component, |
56 const std::vector<aura::Window*>& attached_windows) { | 56 const std::vector<aura::Window*>& attached_windows) { |
57 Details details(window, location, window_component); | 57 Details details(window, location, window_component); |
58 return details.is_resizable ? | 58 return details.is_resizable ? |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 const Details& details, | 146 const Details& details, |
147 const std::vector<aura::Window*>& attached_windows) | 147 const std::vector<aura::Window*>& attached_windows) |
148 : details_(details), | 148 : details_(details), |
149 attached_windows_(attached_windows), | 149 attached_windows_(attached_windows), |
150 did_move_or_resize_(false), | 150 did_move_or_resize_(false), |
151 total_min_(0), | 151 total_min_(0), |
152 total_initial_size_(0), | 152 total_initial_size_(0), |
153 snap_type_(SNAP_NONE), | 153 snap_type_(SNAP_NONE), |
154 num_mouse_moves_since_bounds_change_(0) { | 154 num_mouse_moves_since_bounds_change_(0) { |
155 DCHECK(details_.is_resizable); | 155 DCHECK(details_.is_resizable); |
156 aura::Env::GetInstance()->cursor_manager()->LockCursor(); | 156 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
157 | 157 |
158 // Only support attaching to the right/bottom. | 158 // Only support attaching to the right/bottom. |
159 DCHECK(attached_windows_.empty() || | 159 DCHECK(attached_windows_.empty() || |
160 (details.window_component == HTRIGHT || | 160 (details.window_component == HTRIGHT || |
161 details.window_component == HTBOTTOM)); | 161 details.window_component == HTBOTTOM)); |
162 | 162 |
163 // TODO: figure out how to deal with window going off the edge. | 163 // TODO: figure out how to deal with window going off the edge. |
164 | 164 |
165 // Calculate sizes so that we can maintain the ratios if we need to resize. | 165 // Calculate sizes so that we can maintain the ratios if we need to resize. |
166 int total_available = 0; | 166 int total_available = 0; |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |