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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 break; | 318 break; |
319 default: | 319 default: |
320 // We could also reach here because RootWindow may sometimes generate a | 320 // We could also reach here because RootWindow may sometimes generate a |
321 // bunch of fake mouse events | 321 // bunch of fake mouse events |
322 // (aura::RootWindow::PostMouseMoveEventAfterWindowChange). | 322 // (aura::RootWindow::PostMouseMoveEventAfterWindowChange). |
323 break; | 323 break; |
324 } | 324 } |
325 return ui::ER_CONSUMED; | 325 return ui::ER_CONSUMED; |
326 } | 326 } |
327 | 327 |
328 ui::EventResult DragDropController::OnTouchEvent(ui::TouchEvent* event) { | 328 void DragDropController::OnTouchEvent(ui::TouchEvent* event) { |
329 if (!IsDragDropInProgress()) | 329 if (!IsDragDropInProgress()) |
330 return ui::ER_UNHANDLED; | 330 return; |
331 | 331 |
332 // If current drag session was not started by touch, dont process this touch | 332 // If current drag session was not started by touch, dont process this touch |
333 // event, but consume it so it does not interfere with current drag session. | 333 // event, but consume it so it does not interfere with current drag session. |
334 if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) | 334 if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) |
335 return ui::ER_CONSUMED; | 335 event->StopPropagation(); |
336 | 336 |
337 switch (event->type()) { | 337 if (event->handled()) |
338 case ui::ET_TOUCH_CANCELLED: | 338 return; |
339 DragCancel(); | 339 |
340 break; | 340 if (event->type() == ui::ET_TOUCH_CANCELLED) |
341 default: | 341 DragCancel(); |
342 break; | |
343 } | |
344 return ui::ER_UNHANDLED; | |
345 } | 342 } |
346 | 343 |
347 void DragDropController::OnGestureEvent(ui::GestureEvent* event) { | 344 void DragDropController::OnGestureEvent(ui::GestureEvent* event) { |
348 if (!IsDragDropInProgress()) | 345 if (!IsDragDropInProgress()) |
349 return; | 346 return; |
350 | 347 |
351 // If current drag session was not started by touch, dont process this touch | 348 // If current drag session was not started by touch, dont process this touch |
352 // event, but consume it so it does not interfere with current drag session. | 349 // event, but consume it so it does not interfere with current drag session. |
353 if (current_drag_event_source_ != | 350 if (current_drag_event_source_ != |
354 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 351 ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 drag_window_->RemoveObserver(this); | 499 drag_window_->RemoveObserver(this); |
503 drag_window_ = NULL; | 500 drag_window_ = NULL; |
504 drag_data_ = NULL; | 501 drag_data_ = NULL; |
505 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 502 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
506 // instead of reset to avoid double free. | 503 // instead of reset to avoid double free. |
507 drag_drop_tracker_.Pass(); | 504 drag_drop_tracker_.Pass(); |
508 } | 505 } |
509 | 506 |
510 } // namespace internal | 507 } // namespace internal |
511 } // namespace ash | 508 } // namespace ash |
OLD | NEW |