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 "ui/base/events/event_dispatcher.h" | 5 #include "ui/base/events/event_dispatcher.h" |
6 | 6 |
7 namespace ui { | 7 namespace ui { |
8 | 8 |
9 EventDispatcher::EventDispatcher() { | 9 EventDispatcher::EventDispatcher() { |
10 } | 10 } |
(...skipping 14 matching lines...) Expand all Loading... |
25 return handler->OnMouseEvent(event); | 25 return handler->OnMouseEvent(event); |
26 } | 26 } |
27 | 27 |
28 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, | 28 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, |
29 ScrollEvent* event) { | 29 ScrollEvent* event) { |
30 return handler->OnScrollEvent(event); | 30 return handler->OnScrollEvent(event); |
31 } | 31 } |
32 | 32 |
33 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, | 33 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, |
34 TouchEvent* event) { | 34 TouchEvent* event) { |
35 // TODO(sad): This needs fixing (especially for the QUEUED_ status). | 35 return handler->OnTouchEvent(event); |
36 TouchStatus status = handler->OnTouchEvent(event); | |
37 return status == ui::TOUCH_STATUS_UNKNOWN ? ER_UNHANDLED : | |
38 status == ui::TOUCH_STATUS_QUEUED_END ? ER_CONSUMED : | |
39 ER_HANDLED; | |
40 } | 36 } |
41 | 37 |
42 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, | 38 EventResult EventDispatcher::DispatchEventToSingleHandler(EventHandler* handler, |
43 GestureEvent* event) { | 39 GestureEvent* event) { |
44 return handler->OnGestureEvent(event); | 40 return handler->OnGestureEvent(event); |
45 } | 41 } |
46 | 42 |
47 //////////////////////////////////////////////////////////////////////////////// | 43 //////////////////////////////////////////////////////////////////////////////// |
48 // EventDispatcher::ScopedDispatchHelper | 44 // EventDispatcher::ScopedDispatchHelper |
49 | 45 |
50 EventDispatcher::ScopedDispatchHelper::ScopedDispatchHelper(Event* event) | 46 EventDispatcher::ScopedDispatchHelper::ScopedDispatchHelper(Event* event) |
51 : Event::DispatcherApi(event) { | 47 : Event::DispatcherApi(event) { |
52 } | 48 } |
53 | 49 |
54 EventDispatcher::ScopedDispatchHelper::~ScopedDispatchHelper() { | 50 EventDispatcher::ScopedDispatchHelper::~ScopedDispatchHelper() { |
55 set_phase(EP_POSTDISPATCH); | 51 set_phase(EP_POSTDISPATCH); |
56 } | 52 } |
57 | 53 |
58 } // namespace ui | 54 } // namespace ui |
OLD | NEW |