Chromium Code Reviews| Index: ui/events/platform/x11/x11_event_source.cc |
| diff --git a/ui/events/platform/x11/x11_event_source.cc b/ui/events/platform/x11/x11_event_source.cc |
| index ba55e0b1751a92eec498934a293125f6b87ded90..d9891ddff8f5a0d045f67fbefc2667f3dd53d371 100644 |
| --- a/ui/events/platform/x11/x11_event_source.cc |
| +++ b/ui/events/platform/x11/x11_event_source.cc |
| @@ -94,6 +94,15 @@ X11EventSource* X11EventSource::GetInstance() { |
| //////////////////////////////////////////////////////////////////////////////// |
| // X11EventSource, public |
| +void X11EventSource::AddXEventDispatcher(XEventDispatcher* dispatcher) { |
| + CHECK(dispatcher); |
|
spang
2016/01/26 21:37:40
CHECK is not allowed except for security-critical
kylechar
2016/01/27 15:39:26
Done.
|
| + x_dispatchers_.AddObserver(dispatcher); |
| +} |
| + |
| +void X11EventSource::RemoveXEventDispatcher(XEventDispatcher* dispatcher) { |
| + x_dispatchers_.RemoveObserver(dispatcher); |
| +} |
| + |
| void X11EventSource::DispatchXEvents() { |
| DCHECK(display_); |
| // Handle all pending events. |
| @@ -132,8 +141,17 @@ uint32_t X11EventSource::ExtractCookieDataDispatchEvent(XEvent* xevent) { |
| return action; |
| } |
| -uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { |
| - uint32_t action = PlatformEventSource::DispatchEvent(xevent); |
| +void X11EventSource::DispatchXEventToXEventDispatchers(XEvent* xevent) { |
| + if (x_dispatchers_.might_have_observers()) { |
| + base::ObserverList<XEventDispatcher>::Iterator iter(&x_dispatchers_); |
| + while (XEventDispatcher* dispatcher = iter.GetNext()) { |
| + if (dispatcher->DispatchXEvent(*xevent)) |
| + break; |
|
spang
2016/01/26 21:37:40
If DispatchXEvent returns true, do we still try to
kylechar
2016/01/27 15:39:26
It doesn't right now because it actually happens i
|
| + } |
| + } |
| +} |
| + |
| +void X11EventSource::PostDispatchEvent(XEvent* xevent) { |
| if (xevent->type == GenericEvent && |
| (xevent->xgeneric.evtype == XI_HierarchyChanged || |
| xevent->xgeneric.evtype == XI_DeviceChanged)) { |
| @@ -147,7 +165,6 @@ uint32_t X11EventSource::DispatchEvent(XEvent* xevent) { |
| // Clear stored scroll data |
| ui::DeviceDataManagerX11::GetInstance()->InvalidateScrollClasses(); |
| } |
| - return action; |
| } |
| void X11EventSource::StopCurrentEventStream() { |