| 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 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 521 |
| 522 //////////////////////////////////////////////////////////////////////////////// | 522 //////////////////////////////////////////////////////////////////////////////// |
| 523 // WindowEventDispatcher, ui::GestureEventHelper implementation: | 523 // WindowEventDispatcher, ui::GestureEventHelper implementation: |
| 524 | 524 |
| 525 bool WindowEventDispatcher::CanDispatchToConsumer( | 525 bool WindowEventDispatcher::CanDispatchToConsumer( |
| 526 ui::GestureConsumer* consumer) { | 526 ui::GestureConsumer* consumer) { |
| 527 Window* consumer_window = ConsumerToWindow(consumer); | 527 Window* consumer_window = ConsumerToWindow(consumer); |
| 528 return (consumer_window && consumer_window->GetRootWindow() == window()); | 528 return (consumer_window && consumer_window->GetRootWindow() == window()); |
| 529 } | 529 } |
| 530 | 530 |
| 531 void WindowEventDispatcher::DispatchCancelTouchEvent( | 531 void WindowEventDispatcher::DispatchSyntheticTouchEvent(ui::TouchEvent* event) { |
| 532 ui::GestureConsumer* raw_input_consumer, | 532 // The synthetic event's location is based on the last known location of |
| 533 ui::TouchEvent* event) { | |
| 534 // The touchcancel event's location is based on the last known location of | |
| 535 // the pointer, in dips. OnEventFromSource expects events with co-ordinates | 533 // the pointer, in dips. OnEventFromSource expects events with co-ordinates |
| 536 // in raw pixels, so we convert back to raw pixels here. | 534 // in raw pixels, so we convert back to raw pixels here. |
| 535 DCHECK(event->type() == ui::ET_TOUCH_CANCELLED); |
| 537 event->UpdateForRootTransform(host_->GetRootTransform()); | 536 event->UpdateForRootTransform(host_->GetRootTransform()); |
| 538 DispatchDetails details = OnEventFromSource(event); | 537 DispatchDetails details = OnEventFromSource(event); |
| 539 if (details.dispatcher_destroyed) | 538 if (details.dispatcher_destroyed) |
| 540 return; | 539 return; |
| 541 } | 540 } |
| 542 | 541 |
| 543 //////////////////////////////////////////////////////////////////////////////// | 542 //////////////////////////////////////////////////////////////////////////////// |
| 544 // WindowEventDispatcher, WindowObserver implementation: | 543 // WindowEventDispatcher, WindowObserver implementation: |
| 545 | 544 |
| 546 void WindowEventDispatcher::OnWindowDestroying(Window* window) { | 545 void WindowEventDispatcher::OnWindowDestroying(Window* window) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 } | 908 } |
| 910 | 909 |
| 911 // This flag is set depending on the gestures recognized in the call above, | 910 // This flag is set depending on the gestures recognized in the call above, |
| 912 // and needs to propagate with the forwarded event. | 911 // and needs to propagate with the forwarded event. |
| 913 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 912 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 914 | 913 |
| 915 return PreDispatchLocatedEvent(target, event); | 914 return PreDispatchLocatedEvent(target, event); |
| 916 } | 915 } |
| 917 | 916 |
| 918 } // namespace aura | 917 } // namespace aura |
| OLD | NEW |