Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: ui/events/event_source.h

Issue 210203002: events: Introduce EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix missing 'virtual' Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/event_rewriter_unittest.cc ('k') | ui/events/event_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/events/event_rewriter_unittest.cc ('k') | ui/events/event_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698