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/events/test/event_generator.h" | 5 #include "ui/events/test/event_generator.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 delegate()->ConvertPointToTarget(current_target_, &p); | 662 delegate()->ConvertPointToTarget(current_target_, &p); |
663 return p; | 663 return p; |
664 } | 664 } |
665 | 665 |
666 gfx::Point EventGenerator::CenterOfWindow(const EventTarget* window) const { | 666 gfx::Point EventGenerator::CenterOfWindow(const EventTarget* window) const { |
667 return delegate()->CenterOfTarget(window); | 667 return delegate()->CenterOfTarget(window); |
668 } | 668 } |
669 | 669 |
670 void EventGenerator::DoDispatchEvent(ui::Event* event, bool async) { | 670 void EventGenerator::DoDispatchEvent(ui::Event* event, bool async) { |
671 if (event->IsTouchEvent()) { | 671 if (event->IsTouchEvent()) { |
672 static_cast<ui::TouchEvent*>(event)->set_pointer_details( | 672 ui::TouchEvent* touch_event = static_cast<ui::TouchEvent*>(event); |
673 touch_pointer_details_); | 673 touch_pointer_details_.id = touch_event->pointer_details().id; |
| 674 touch_event->set_pointer_details(touch_pointer_details_); |
674 } | 675 } |
675 | 676 |
676 if (async) { | 677 if (async) { |
677 std::unique_ptr<ui::Event> pending_event = ui::Event::Clone(*event); | 678 std::unique_ptr<ui::Event> pending_event = ui::Event::Clone(*event); |
678 if (pending_events_.empty()) { | 679 if (pending_events_.empty()) { |
679 base::ThreadTaskRunnerHandle::Get()->PostTask( | 680 base::ThreadTaskRunnerHandle::Get()->PostTask( |
680 FROM_HERE, | 681 FROM_HERE, |
681 base::Bind(&EventGenerator::DispatchNextPendingEvent, | 682 base::Bind(&EventGenerator::DispatchNextPendingEvent, |
682 base::Unretained(this))); | 683 base::Unretained(this))); |
683 } | 684 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 return default_delegate; | 718 return default_delegate; |
718 } | 719 } |
719 | 720 |
720 EventGeneratorDelegate* EventGenerator::delegate() { | 721 EventGeneratorDelegate* EventGenerator::delegate() { |
721 return const_cast<EventGeneratorDelegate*>( | 722 return const_cast<EventGeneratorDelegate*>( |
722 const_cast<const EventGenerator*>(this)->delegate()); | 723 const_cast<const EventGenerator*>(this)->delegate()); |
723 } | 724 } |
724 | 725 |
725 } // namespace test | 726 } // namespace test |
726 } // namespace ui | 727 } // namespace ui |
OLD | NEW |