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/window_resizer.h" | 5 #include "ash/wm/window_resizer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/wm/root_window_event_filter.h" | 8 #include "ash/wm/root_window_event_filter.h" |
9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
10 #include "ui/aura/root_window.h" | 10 #include "ui/aura/root_window.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 return; | 215 return; |
216 } | 216 } |
217 | 217 |
218 ui::ScopedLayerAnimationSettings scoped_setter( | 218 ui::ScopedLayerAnimationSettings scoped_setter( |
219 window_->layer()->GetAnimator()); | 219 window_->layer()->GetAnimator()); |
220 // Use a small duration since the grid is small. | 220 // Use a small duration since the grid is small. |
221 scoped_setter.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100)); | 221 scoped_setter.SetTransitionDuration(base::TimeDelta::FromMilliseconds(100)); |
222 window_->SetBounds(new_bounds); | 222 window_->SetBounds(new_bounds); |
223 } | 223 } |
224 | 224 |
| 225 void WindowResizer::RevertDrag() { |
| 226 if (!did_move_or_resize_) |
| 227 return; |
| 228 |
| 229 window_->SetBounds(initial_bounds_); |
| 230 } |
| 231 |
225 gfx::Rect WindowResizer::GetBoundsForDrag(const gfx::Point& location) { | 232 gfx::Rect WindowResizer::GetBoundsForDrag(const gfx::Point& location) { |
226 if (!is_resizable()) | 233 if (!is_resizable()) |
227 return window_->bounds(); | 234 return window_->bounds(); |
228 | 235 |
229 // Dragging a window moves the local coordinate frame, so do arithmetic | 236 // Dragging a window moves the local coordinate frame, so do arithmetic |
230 // in the parent coordinate frame. | 237 // in the parent coordinate frame. |
231 gfx::Point event_location_in_parent(location); | 238 gfx::Point event_location_in_parent(location); |
232 aura::Window::ConvertPointToWindow(window_, window_->parent(), | 239 aura::Window::ConvertPointToWindow(window_, window_->parent(), |
233 &event_location_in_parent); | 240 &event_location_in_parent); |
234 int delta_x = event_location_in_parent.x() - initial_location_in_parent_.x(); | 241 int delta_x = event_location_in_parent.x() - initial_location_in_parent_.x(); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 int max_height = gfx::Screen::GetMonitorAreaNearestWindow(window_).height(); | 355 int max_height = gfx::Screen::GetMonitorAreaNearestWindow(window_).height(); |
349 if (height > max_height) { | 356 if (height > max_height) { |
350 height = max_height; | 357 height = max_height; |
351 *delta_y = -y_multiplier * (initial_bounds_.height() - max_height); | 358 *delta_y = -y_multiplier * (initial_bounds_.height() - max_height); |
352 } | 359 } |
353 } | 360 } |
354 return height; | 361 return height; |
355 } | 362 } |
356 | 363 |
357 } // namespace aura | 364 } // namespace aura |
OLD | NEW |