Index: ui/events/event_source.h |
diff --git a/ui/events/event_source.h b/ui/events/event_source.h |
index aba2c1f6600d9a2787fc99d8ec61027dd2174b1f..de22bda9dc854b98b72767bb0eebd712e5af8479 100644 |
--- a/ui/events/event_source.h |
+++ b/ui/events/event_source.h |
@@ -5,6 +5,8 @@ |
#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" |
@@ -12,17 +14,32 @@ 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: |
EventDispatchDetails SendEventToProcessor(Event* event); |
+ |
+ private: |
+ typedef std::vector<EventRewriter*> EventRewriterList; |
+ EventDispatchDetails DeliverEventToProcessor(Event* event); |
+ EventRewriterList rewriter_list_; |
+ DISALLOW_COPY_AND_ASSIGN(EventSource); |
}; |
} // namespace ui |