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

Unified Diff: ui/events/event_rewriter.h

Issue 210203002: events: Introduce EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | ui/events/event_rewriter_unittest.cc » ('j') | ui/events/event_rewriter_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « no previous file | ui/events/event_rewriter_unittest.cc » ('j') | ui/events/event_rewriter_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698