diff options
Diffstat (limited to 'chromium/ui/events/event_source.h')
-rw-r--r-- | chromium/ui/events/event_source.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/chromium/ui/events/event_source.h b/chromium/ui/events/event_source.h index f8da9e6635e..ca8b00f514b 100644 --- a/chromium/ui/events/event_source.h +++ b/chromium/ui/events/event_source.h @@ -5,23 +5,43 @@ #ifndef UI_EVENTS_EVENT_SOURCE_H_ #define UI_EVENTS_EVENT_SOURCE_H_ +#include <vector> + +#include "ui/events/event_dispatcher.h" #include "ui/events/events_export.h" namespace ui { class Event; class EventProcessor; +class EventRewriter; // EventSource receives events from the native platform (e.g. X11, win32 etc.) // and sends the events to an EventProcessor. class EVENTS_EXPORT EventSource { public: - virtual ~EventSource() {} + EventSource(); + virtual ~EventSource(); virtual EventProcessor* GetEventProcessor() = 0; + // Adds a rewriter to modify events before they are sent to the + // EventProcessor. The rewriter must be explicitly removed from the + // EventSource before the rewriter is destroyed. The EventSource + // does not take ownership of the rewriter. + void AddEventRewriter(EventRewriter* rewriter); + void RemoveEventRewriter(EventRewriter* rewriter); + protected: - void SendEventToProcessor(Event* event); + EventDispatchDetails SendEventToProcessor(Event* event); + + private: + friend class EventSourceTestApi; + + typedef std::vector<EventRewriter*> EventRewriterList; + EventDispatchDetails DeliverEventToProcessor(Event* event); + EventRewriterList rewriter_list_; + DISALLOW_COPY_AND_ASSIGN(EventSource); }; } // namespace ui |