Index: ui/events/event_rewriter.h |
diff --git a/ui/events/event_rewriter.h b/ui/events/event_rewriter.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..90f41fe12e99feac6b256f8417d902736d974f2a |
--- /dev/null |
+++ b/ui/events/event_rewriter.h |
@@ -0,0 +1,38 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_EVENTS_EVENT_REWRITER_H_ |
+#define UI_EVENTS_EVENT_REWRITER_H_ |
+ |
+#include "ui/events/events_export.h" |
+ |
+namespace ui { |
+ |
+class Event; |
+ |
+enum EventRewriteStatus { |
+ EVENT_REWRITE_CONTINUE, |
+ EVENT_REWRITE_REWRITTEN, |
+ EVENT_REWRITE_DISCARD, |
+ EVENT_REWRITE_DISPATCH_ANOTHER, |
sadrul
2014/03/24 21:15:38
Comments for each to explain what they mean.
|
+}; |
+ |
+class EVENTS_EXPORT EventRewriter { |
sadrul
2014/03/24 21:15:38
A brief class-level comment to give an overview of
|
+ public: |
+ virtual ~EventRewriter() {} |
+ |
+ // If the rewriter wants to rewrite an event, and dispatch |
+ // another event once the rewritten event is dispatched, it |
+ // should return EVENT_REWRITE_DISPATCH_ANOTHER, and return |
+ // the next event to dispatch from |NextDispatchEvent()|. |
+ virtual EventRewriteStatus RewriteEvent(const Event& event, |
+ Event** rewritten_event) = 0; |
+ |
+ virtual EventRewriteStatus NextDispatchEvent(const Event& last_event, |
+ Event** new_event) = 0; |
+}; |
+ |
+} // namespace ui |
+ |
+#endif // UI_EVENTS_EVENT_REWRITER_H_ |