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 "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 return 0; | 107 return 0; |
108 | 108 |
109 const ui::OSExchangeDataProviderAura& provider = | 109 const ui::OSExchangeDataProviderAura& provider = |
110 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); | 110 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); |
111 // We do not support touch drag/drop without a drag image. | 111 // We do not support touch drag/drop without a drag image. |
112 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && | 112 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && |
113 provider.drag_image().size().IsEmpty()) | 113 provider.drag_image().size().IsEmpty()) |
114 return 0; | 114 return 0; |
115 | 115 |
116 current_drag_event_source_ = source; | 116 current_drag_event_source_ = source; |
117 DragDropTracker* tracker = new DragDropTracker; | 117 DragDropTracker* tracker = new DragDropTracker(root_window); |
118 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 118 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |
119 // We need to transfer the current gesture sequence and the GR's touch event | 119 // We need to transfer the current gesture sequence and the GR's touch event |
120 // queue to the |drag_drop_tracker_|'s capture window so that when it takes | 120 // queue to the |drag_drop_tracker_|'s capture window so that when it takes |
121 // capture, it still gets a valid gesture state. | 121 // capture, it still gets a valid gesture state. |
122 root_window->gesture_recognizer()->TransferEventsTo(source_window, | 122 root_window->gesture_recognizer()->TransferEventsTo(source_window, |
123 tracker->capture_window()); | 123 tracker->capture_window()); |
124 // We also send a gesture end to the source window so it can clear state. | 124 // We also send a gesture end to the source window so it can clear state. |
125 // TODO(varunjain): Remove this whole block when gesture sequence | 125 // TODO(varunjain): Remove this whole block when gesture sequence |
126 // transferring is properly done in the GR (http://crbug.com/160558) | 126 // transferring is properly done in the GR (http://crbug.com/160558) |
127 DispatchGestureEndToWindow(source_window); | 127 DispatchGestureEndToWindow(source_window); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 drag_window_->RemoveObserver(this); | 478 drag_window_->RemoveObserver(this); |
479 drag_window_ = NULL; | 479 drag_window_ = NULL; |
480 drag_data_ = NULL; | 480 drag_data_ = NULL; |
481 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 481 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
482 // instead of reset to avoid double free. | 482 // instead of reset to avoid double free. |
483 drag_drop_tracker_.Pass(); | 483 drag_drop_tracker_.Pass(); |
484 } | 484 } |
485 | 485 |
486 } // namespace internal | 486 } // namespace internal |
487 } // namespace ash | 487 } // namespace ash |
OLD | NEW |