| 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/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
| 6 | 6 |
| 7 #include "ash/drag_drop/drag_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
| 8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // Adjusts the drag image bounds such that the new bounds are scaled by |scale| | 46 // Adjusts the drag image bounds such that the new bounds are scaled by |scale| |
| 47 // and translated by the |drag_image_offset| and and additional | 47 // and translated by the |drag_image_offset| and and additional |
| 48 // |vertical_offset|. | 48 // |vertical_offset|. |
| 49 gfx::Rect AdjustDragImageBoundsForScaleAndOffset( | 49 gfx::Rect AdjustDragImageBoundsForScaleAndOffset( |
| 50 const gfx::Rect& drag_image_bounds, | 50 const gfx::Rect& drag_image_bounds, |
| 51 int vertical_offset, | 51 int vertical_offset, |
| 52 float scale, | 52 float scale, |
| 53 gfx::Vector2d* drag_image_offset) { | 53 gfx::Vector2d* drag_image_offset) { |
| 54 gfx::PointF final_origin = drag_image_bounds.origin(); | 54 gfx::PointF final_origin = drag_image_bounds.origin(); |
| 55 gfx::SizeF final_size = drag_image_bounds.size(); | 55 gfx::SizeF final_size = gfx::SizeF(drag_image_bounds.size()); |
| 56 final_size.Scale(scale); | 56 final_size.Scale(scale); |
| 57 drag_image_offset->set_x(drag_image_offset->x() * scale); | 57 drag_image_offset->set_x(drag_image_offset->x() * scale); |
| 58 drag_image_offset->set_y(drag_image_offset->y() * scale); | 58 drag_image_offset->set_y(drag_image_offset->y() * scale); |
| 59 float total_x_offset = drag_image_offset->x(); | 59 float total_x_offset = drag_image_offset->x(); |
| 60 float total_y_offset = drag_image_offset->y() - vertical_offset; | 60 float total_y_offset = drag_image_offset->y() - vertical_offset; |
| 61 final_origin.Offset(-total_x_offset, -total_y_offset); | 61 final_origin.Offset(-total_x_offset, -total_y_offset); |
| 62 return gfx::ToEnclosingRect(gfx::RectF(final_origin, final_size)); | 62 return gfx::ToEnclosingRect(gfx::RectF(final_origin, final_size)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void DispatchGestureEndToWindow(aura::Window* window) { | 65 void DispatchGestureEndToWindow(aura::Window* window) { |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 if (drag_window_) | 559 if (drag_window_) |
| 560 drag_window_->RemoveObserver(this); | 560 drag_window_->RemoveObserver(this); |
| 561 drag_window_ = NULL; | 561 drag_window_ = NULL; |
| 562 drag_data_ = NULL; | 562 drag_data_ = NULL; |
| 563 // Cleanup can be called again while deleting DragDropTracker, so delete | 563 // Cleanup can be called again while deleting DragDropTracker, so delete |
| 564 // the pointer with a local variable to avoid double free. | 564 // the pointer with a local variable to avoid double free. |
| 565 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); | 565 scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass(); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace ash | 568 } // namespace ash |
| OLD | NEW |