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/default_window_resizer.h" | 5 #include "ash/wm/default_window_resizer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/cursor_manager.h" | 8 #include "ash/wm/cursor_manager.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 if (current_root != details_.window->GetRootWindow()) | 40 if (current_root != details_.window->GetRootWindow()) |
41 return; | 41 return; |
42 | 42 |
43 gfx::Point location_in_root = location_in_screen; | 43 gfx::Point location_in_root = location_in_screen; |
44 aura::client::GetScreenPositionClient(current_root)-> | 44 aura::client::GetScreenPositionClient(current_root)-> |
45 ConvertPointFromScreen(current_root, &location_in_root); | 45 ConvertPointFromScreen(current_root, &location_in_root); |
46 | 46 |
47 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? | 47 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
48 0 : ash::Shell::GetInstance()->GetGridSize(); | 48 0 : ash::Shell::GetInstance()->GetGridSize(); |
49 gfx::Rect bounds( | 49 gfx::Rect bounds( |
50 CalculateBoundsForDrag(details_, location_in_root, grid_size)); | 50 CalculateBoundsForDrag(details_, location_in_screen, grid_size)); |
51 if (bounds != details_.window->bounds()) { | 51 if (bounds != details_.window->bounds()) { |
52 did_move_or_resize_ = true; | 52 did_move_or_resize_ = true; |
53 details_.window->SetBounds(bounds); | 53 details_.window->SetBounds(bounds); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 void DefaultWindowResizer::CompleteDrag(int event_flags) { | 57 void DefaultWindowResizer::CompleteDrag(int event_flags) { |
58 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? | 58 int grid_size = event_flags & ui::EF_CONTROL_DOWN ? |
59 0 : ash::Shell::GetInstance()->GetGridSize(); | 59 0 : ash::Shell::GetInstance()->GetGridSize(); |
60 if (grid_size <= 1 || !did_move_or_resize_) | 60 if (grid_size <= 1 || !did_move_or_resize_) |
(...skipping 24 matching lines...) Expand all Loading... |
85 } | 85 } |
86 | 86 |
87 DefaultWindowResizer::DefaultWindowResizer(const Details& details) | 87 DefaultWindowResizer::DefaultWindowResizer(const Details& details) |
88 : details_(details), | 88 : details_(details), |
89 did_move_or_resize_(false) { | 89 did_move_or_resize_(false) { |
90 DCHECK(details_.is_resizable); | 90 DCHECK(details_.is_resizable); |
91 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); | 91 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
92 } | 92 } |
93 | 93 |
94 } // namespace aura | 94 } // namespace aura |
OLD | NEW |