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