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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
66 if (window && window->delegate()) { | 66 if (window && window->delegate()) { |
67 ui::GestureEvent gesture_end(0, | 67 ui::GestureEvent gesture_end( |
68 0, | 68 0, |
69 0, | 69 0, |
70 ui::EventTimeForNow(), | 70 0, |
71 ui::GestureEventDetails(ui::ET_GESTURE_END)); | 71 ui::EventTimeForNow(), |
| 72 ui::GestureEventDetails(ui::ET_GESTURE_END, 0, 0)); |
72 window->delegate()->OnGestureEvent(&gesture_end); | 73 window->delegate()->OnGestureEvent(&gesture_end); |
73 } | 74 } |
74 } | 75 } |
75 } // namespace | 76 } // namespace |
76 | 77 |
77 class DragDropTrackerDelegate : public aura::WindowDelegate { | 78 class DragDropTrackerDelegate : public aura::WindowDelegate { |
78 public: | 79 public: |
79 explicit DragDropTrackerDelegate(DragDropController* controller) | 80 explicit DragDropTrackerDelegate(DragDropController* controller) |
80 : drag_drop_controller_(controller) {} | 81 : drag_drop_controller_(controller) {} |
81 virtual ~DragDropTrackerDelegate() {} | 82 virtual ~DragDropTrackerDelegate() {} |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 if (drag_window_) | 557 if (drag_window_) |
557 drag_window_->RemoveObserver(this); | 558 drag_window_->RemoveObserver(this); |
558 drag_window_ = NULL; | 559 drag_window_ = NULL; |
559 drag_data_ = NULL; | 560 drag_data_ = NULL; |
560 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 561 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
561 // instead of reset to avoid double free. | 562 // instead of reset to avoid double free. |
562 drag_drop_tracker_.Pass(); | 563 drag_drop_tracker_.Pass(); |
563 } | 564 } |
564 | 565 |
565 } // namespace ash | 566 } // namespace ash |
OLD | NEW |