| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 Window* window, | 164 Window* window, |
| 165 const gfx::Point& point) { | 165 const gfx::Point& point) { |
| 166 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EventTimeForNow(), | 166 ui::MouseEvent event(ui::ET_MOUSE_EXITED, point, point, ui::EventTimeForNow(), |
| 167 ui::EF_NONE, ui::EF_NONE); | 167 ui::EF_NONE, ui::EF_NONE); |
| 168 return DispatchMouseEnterOrExit(window, event, ui::ET_MOUSE_EXITED); | 168 return DispatchMouseEnterOrExit(window, event, ui::ET_MOUSE_EXITED); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void WindowEventDispatcher::ProcessedTouchEvent(uint32_t unique_event_id, | 171 void WindowEventDispatcher::ProcessedTouchEvent(uint32_t unique_event_id, |
| 172 Window* window, | 172 Window* window, |
| 173 ui::EventResult result) { | 173 ui::EventResult result) { |
| 174 scoped_ptr<ui::GestureRecognizer::Gestures> gestures( | 174 std::unique_ptr<ui::GestureRecognizer::Gestures> gestures( |
| 175 ui::GestureRecognizer::Get()->AckTouchEvent(unique_event_id, result, | 175 ui::GestureRecognizer::Get()->AckTouchEvent(unique_event_id, result, |
| 176 window)); | 176 window)); |
| 177 DispatchDetails details = ProcessGestures(window, gestures.get()); | 177 DispatchDetails details = ProcessGestures(window, gestures.get()); |
| 178 if (details.dispatcher_destroyed) | 178 if (details.dispatcher_destroyed) |
| 179 return; | 179 return; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void WindowEventDispatcher::HoldPointerMoves() { | 182 void WindowEventDispatcher::HoldPointerMoves() { |
| 183 if (!move_hold_count_) | 183 if (!move_hold_count_) |
| 184 held_event_factory_.InvalidateWeakPtrs(); | 184 held_event_factory_.InvalidateWeakPtrs(); |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 #endif | 498 #endif |
| 499 | 499 |
| 500 if (event.IsTouchEvent() && !details.target_destroyed) { | 500 if (event.IsTouchEvent() && !details.target_destroyed) { |
| 501 // Do not let 'held' touch events contribute to any gestures unless it is | 501 // Do not let 'held' touch events contribute to any gestures unless it is |
| 502 // being dispatched. | 502 // being dispatched. |
| 503 if (is_dispatched_held_event(event) || !held_move_event_ || | 503 if (is_dispatched_held_event(event) || !held_move_event_ || |
| 504 !held_move_event_->IsTouchEvent()) { | 504 !held_move_event_->IsTouchEvent()) { |
| 505 const ui::TouchEvent& touchevent = *event.AsTouchEvent(); | 505 const ui::TouchEvent& touchevent = *event.AsTouchEvent(); |
| 506 | 506 |
| 507 if (!touchevent.synchronous_handling_disabled()) { | 507 if (!touchevent.synchronous_handling_disabled()) { |
| 508 scoped_ptr<ui::GestureRecognizer::Gestures> gestures; | 508 std::unique_ptr<ui::GestureRecognizer::Gestures> gestures; |
| 509 | 509 |
| 510 Window* window = static_cast<Window*>(target); | 510 Window* window = static_cast<Window*>(target); |
| 511 gestures.reset(ui::GestureRecognizer::Get()->AckTouchEvent( | 511 gestures.reset(ui::GestureRecognizer::Get()->AckTouchEvent( |
| 512 touchevent.unique_event_id(), event.result(), window)); | 512 touchevent.unique_event_id(), event.result(), window)); |
| 513 | 513 |
| 514 return ProcessGestures(window, gestures.get()); | 514 return ProcessGestures(window, gestures.get()); |
| 515 } | 515 } |
| 516 } | 516 } |
| 517 } | 517 } |
| 518 | 518 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 ui::EventDispatchDetails WindowEventDispatcher::DispatchHeldEvents() { | 661 ui::EventDispatchDetails WindowEventDispatcher::DispatchHeldEvents() { |
| 662 if (!held_repostable_event_ && !held_move_event_) | 662 if (!held_repostable_event_ && !held_move_event_) |
| 663 return DispatchDetails(); | 663 return DispatchDetails(); |
| 664 | 664 |
| 665 CHECK(!dispatching_held_event_); | 665 CHECK(!dispatching_held_event_); |
| 666 | 666 |
| 667 DispatchDetails dispatch_details; | 667 DispatchDetails dispatch_details; |
| 668 if (held_repostable_event_) { | 668 if (held_repostable_event_) { |
| 669 if (held_repostable_event_->type() == ui::ET_MOUSE_PRESSED || | 669 if (held_repostable_event_->type() == ui::ET_MOUSE_PRESSED || |
| 670 held_repostable_event_->type() == ui::ET_TOUCH_PRESSED) { | 670 held_repostable_event_->type() == ui::ET_TOUCH_PRESSED) { |
| 671 scoped_ptr<ui::LocatedEvent> event = std::move(held_repostable_event_); | 671 std::unique_ptr<ui::LocatedEvent> event = |
| 672 std::move(held_repostable_event_); |
| 672 dispatching_held_event_ = event.get(); | 673 dispatching_held_event_ = event.get(); |
| 673 dispatch_details = OnEventFromSource(event.get()); | 674 dispatch_details = OnEventFromSource(event.get()); |
| 674 } else { | 675 } else { |
| 675 // TODO(rbyers): GESTURE_TAP_DOWN not yet supported: crbug.com/170987. | 676 // TODO(rbyers): GESTURE_TAP_DOWN not yet supported: crbug.com/170987. |
| 676 NOTREACHED(); | 677 NOTREACHED(); |
| 677 } | 678 } |
| 678 if (dispatch_details.dispatcher_destroyed) | 679 if (dispatch_details.dispatcher_destroyed) |
| 679 return dispatch_details; | 680 return dispatch_details; |
| 680 } | 681 } |
| 681 | 682 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 } | 909 } |
| 909 | 910 |
| 910 // This flag is set depending on the gestures recognized in the call above, | 911 // This flag is set depending on the gestures recognized in the call above, |
| 911 // and needs to propagate with the forwarded event. | 912 // and needs to propagate with the forwarded event. |
| 912 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 913 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 913 | 914 |
| 914 return PreDispatchLocatedEvent(target, event); | 915 return PreDispatchLocatedEvent(target, event); |
| 915 } | 916 } |
| 916 | 917 |
| 917 } // namespace aura | 918 } // namespace aura |
| OLD | NEW |