Chromium Code Reviews| 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 "ash/wm/property_util.h" | 9 #include "ash/wm/property_util.h" |
| 10 #include "ash/wm/window_util.h" | |
| 10 #include "ui/aura/client/aura_constants.h" | 11 #include "ui/aura/client/aura_constants.h" |
| 11 #include "ui/aura/env.h" | 12 #include "ui/aura/env.h" |
| 12 #include "ui/aura/window.h" | 13 #include "ui/aura/window.h" |
| 13 #include "ui/aura/window_delegate.h" | 14 #include "ui/aura/window_delegate.h" |
| 14 #include "ui/base/hit_test.h" | 15 #include "ui/base/hit_test.h" |
| 15 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
| 16 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
| 17 | 18 |
| 18 namespace ash { | 19 namespace ash { |
| 19 | 20 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 34 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); | 35 gfx::Rect bounds(CalculateBoundsForDrag(details_, location)); |
| 35 if (bounds != details_.window->bounds()) { | 36 if (bounds != details_.window->bounds()) { |
| 36 if (!did_move_or_resize_ && !details_.restore_bounds.IsEmpty()) | 37 if (!did_move_or_resize_ && !details_.restore_bounds.IsEmpty()) |
| 37 ClearRestoreBounds(details_.window); | 38 ClearRestoreBounds(details_.window); |
| 38 did_move_or_resize_ = true; | 39 did_move_or_resize_ = true; |
| 39 details_.window->SetBounds(bounds); | 40 details_.window->SetBounds(bounds); |
| 40 } | 41 } |
| 41 } | 42 } |
| 42 | 43 |
| 43 void DefaultWindowResizer::CompleteDrag(int event_flags) { | 44 void DefaultWindowResizer::CompleteDrag(int event_flags) { |
| 45 wm::SetUserHasChangedWindowPositionOrSize(details_.window, true); | |
|
sky
2012/10/22 16:40:50
I don't think you need this since WorkspaceWindowR
Mr4D (OOO till 08-26)
2012/10/22 20:27:23
Done.
| |
| 44 } | 46 } |
| 45 | 47 |
| 46 void DefaultWindowResizer::RevertDrag() { | 48 void DefaultWindowResizer::RevertDrag() { |
| 47 if (!did_move_or_resize_) | 49 if (!did_move_or_resize_) |
| 48 return; | 50 return; |
| 49 | 51 |
| 50 details_.window->SetBounds(details_.initial_bounds); | 52 details_.window->SetBounds(details_.initial_bounds); |
| 51 | 53 |
| 52 if (!details_.restore_bounds.IsEmpty()) | 54 if (!details_.restore_bounds.IsEmpty()) |
| 53 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); | 55 SetRestoreBoundsInScreen(details_.window, details_.restore_bounds); |
| 54 } | 56 } |
| 55 | 57 |
| 56 aura::Window* DefaultWindowResizer::GetTarget() { | 58 aura::Window* DefaultWindowResizer::GetTarget() { |
| 57 return details_.window; | 59 return details_.window; |
| 58 } | 60 } |
| 59 | 61 |
| 60 DefaultWindowResizer::DefaultWindowResizer(const Details& details) | 62 DefaultWindowResizer::DefaultWindowResizer(const Details& details) |
| 61 : details_(details), | 63 : details_(details), |
| 62 did_move_or_resize_(false) { | 64 did_move_or_resize_(false) { |
| 63 DCHECK(details_.is_resizable); | 65 DCHECK(details_.is_resizable); |
| 64 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); | 66 ash::Shell::GetInstance()->cursor_manager()->LockCursor(); |
| 65 } | 67 } |
| 66 | 68 |
| 67 } // namespace aura | 69 } // namespace aura |
| OLD | NEW |