Chromium Code Reviews| 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. |
|
sadrul
2016/05/11 16:12:17
Can you add a DCHECK() here that |event->type()| i
tdresser
2016/05/11 16:32:31
Done.
| |
| 537 event->UpdateForRootTransform(host_->GetRootTransform()); | 535 event->UpdateForRootTransform(host_->GetRootTransform()); |
| 538 DispatchDetails details = OnEventFromSource(event); | 536 DispatchDetails details = OnEventFromSource(event); |
| 539 if (details.dispatcher_destroyed) | 537 if (details.dispatcher_destroyed) |
| 540 return; | 538 return; |
| 541 } | 539 } |
| 542 | 540 |
| 543 //////////////////////////////////////////////////////////////////////////////// | 541 //////////////////////////////////////////////////////////////////////////////// |
| 544 // WindowEventDispatcher, WindowObserver implementation: | 542 // WindowEventDispatcher, WindowObserver implementation: |
| 545 | 543 |
| 546 void WindowEventDispatcher::OnWindowDestroying(Window* window) { | 544 void WindowEventDispatcher::OnWindowDestroying(Window* window) { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 909 } | 907 } |
| 910 | 908 |
| 911 // This flag is set depending on the gestures recognized in the call above, | 909 // This flag is set depending on the gestures recognized in the call above, |
| 912 // and needs to propagate with the forwarded event. | 910 // and needs to propagate with the forwarded event. |
| 913 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); | 911 event->set_may_cause_scrolling(orig_event.may_cause_scrolling()); |
| 914 | 912 |
| 915 return PreDispatchLocatedEvent(target, event); | 913 return PreDispatchLocatedEvent(target, event); |
| 916 } | 914 } |
| 917 | 915 |
| 918 } // namespace aura | 916 } // namespace aura |
| OLD | NEW |