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/coordinate_conversion.h" | 8 #include "ash/wm/coordinate_conversion.h" |
9 #include "ash/wm/cursor_manager.h" | 9 #include "ash/wm/cursor_manager.h" |
10 #include "ash/wm/property_util.h" | 10 #include "ash/wm/property_util.h" |
| 11 #include "ash/wm/window_util.h" |
11 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
13 #include "ui/aura/root_window.h" | 14 #include "ui/aura/root_window.h" |
14 #include "ui/aura/window.h" | 15 #include "ui/aura/window.h" |
15 #include "ui/aura/window_delegate.h" | 16 #include "ui/aura/window_delegate.h" |
16 #include "ui/base/hit_test.h" | 17 #include "ui/base/hit_test.h" |
17 #include "ui/base/ui_base_types.h" | 18 #include "ui/base/ui_base_types.h" |
18 #include "ui/gfx/screen.h" | 19 #include "ui/gfx/screen.h" |
19 | 20 |
20 namespace ash { | 21 namespace ash { |
(...skipping 23 matching lines...) Expand all Loading... |
44 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); | 45 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); |
45 if (bounds != details_.window->bounds()) { | 46 if (bounds != details_.window->bounds()) { |
46 if (!did_move_or_resize_ && !details_.restore_bounds.IsEmpty()) | 47 if (!did_move_or_resize_ && !details_.restore_bounds.IsEmpty()) |
47 ClearRestoreBounds(details_.window); | 48 ClearRestoreBounds(details_.window); |
48 did_move_or_resize_ = true; | 49 did_move_or_resize_ = true; |
49 details_.window->SetBounds(bounds); | 50 details_.window->SetBounds(bounds); |
50 } | 51 } |
51 } | 52 } |
52 | 53 |
53 void DefaultWindowResizer::CompleteDrag(int event_flags) { | 54 void DefaultWindowResizer::CompleteDrag(int event_flags) { |
| 55 wm::SetUserHasChangedWindowPositionOrSize(details_.window, true); |
54 } | 56 } |
55 | 57 |
56 void DefaultWindowResizer::RevertDrag() { | 58 void DefaultWindowResizer::RevertDrag() { |
57 if (!did_move_or_resize_) | 59 if (!did_move_or_resize_) |
58 return; | 60 return; |
59 | 61 |
60 details_.window->SetBounds(details_.initial_bounds); | 62 details_.window->SetBounds(details_.initial_bounds); |
61 | 63 |
62 if (!details_.restore_bounds.IsEmpty()) | 64 if (!details_.restore_bounds.IsEmpty()) |
63 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); | 65 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); |
64 } | 66 } |
65 | 67 |
66 aura::Window* DefaultWindowResizer::GetTarget() { | 68 aura::Window* DefaultWindowResizer::GetTarget() { |
67 return details_.window; | 69 return details_.window; |
68 } | 70 } |
69 | 71 |
70 DefaultWindowResizer::DefaultWindowResizer(const Details& details) | 72 DefaultWindowResizer::DefaultWindowResizer(const Details& details) |
71 : details_(details), | 73 : details_(details), |
72 did_move_or_resize_(false) { | 74 did_move_or_resize_(false) { |
73 DCHECK(details_.is_resizable); | 75 DCHECK(details_.is_resizable); |
74 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); | 76 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
75 } | 77 } |
76 | 78 |
77 } // namespace aura | 79 } // namespace aura |
OLD | NEW |