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

Unified Diff: ui/aura/test/test_event_filter.h

Issue 8565018: [Aura] Support additonal event filters in DesktopEventFilter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo and remove no-longer-needed algorithm header Created 9 years, 1 month 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/aura/event_filter_unittest.cc ('k') | ui/aura/test/test_event_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/test/test_event_filter.h
diff --git a/ui/aura/test/test_event_filter.h b/ui/aura/test/test_event_filter.h
new file mode 100644
index 0000000000000000000000000000000000000000..95298262f433a12ba4f66edf65466cfb69abd18a
--- /dev/null
+++ b/ui/aura/test/test_event_filter.h
@@ -0,0 +1,63 @@
+// Copyright (c) 2011 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_AURA_TEST_TEST_EVENT_FILTER_H_
+#define UI_AURA_TEST_TEST_EVENT_FILTER_H_
+#pragma once
+
+#include "base/compiler_specific.h"
+#include "ui/aura/event_filter.h"
+
+namespace aura {
+
+class Window;
+
+namespace test {
+
+// TestEventFilter counts the key, mouse and touch events it receives and can
+// optinally be set to consume those events.
+class TestEventFilter : public EventFilter {
+ public:
+ explicit TestEventFilter(Window* owner);
+ virtual ~TestEventFilter();
+
+ // Resets all event counters.
+ void ResetCounts();
+
+ int key_event_count() const { return key_event_count_; }
+ int mouse_event_count() const { return mouse_event_count_; }
+ int touch_event_count() const { return touch_event_count_; }
+
+ void set_consumes_key_events(bool consumes_key_events) {
+ consumes_key_events_ = consumes_key_events;
+ }
+ void set_consumes_mouse_events(bool consumes_mouse_events) {
+ consumes_mouse_events_ = consumes_mouse_events;
+ }
+ void set_consumes_touch_events(bool consumes_touch_events) {
+ consumes_touch_events_ = consumes_touch_events;
+ }
+
+ // Overridden from EventFilter:
+ virtual bool PreHandleKeyEvent(Window* target, KeyEvent* event) OVERRIDE;
+ virtual bool PreHandleMouseEvent(Window* target, MouseEvent* event) OVERRIDE;
+ virtual ui::TouchStatus PreHandleTouchEvent(Window* target,
+ TouchEvent* event) OVERRIDE;
+
+ private:
+ int key_event_count_;
+ int mouse_event_count_;
+ int touch_event_count_;
+
+ bool consumes_key_events_;
+ bool consumes_mouse_events_;
+ bool consumes_touch_events_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestEventFilter);
+};
+
+} // namespace test
+} // namespace aura
+
+#endif // UI_AURA_TEST_TEST_EVENT_FILTER_H_
« no previous file with comments | « ui/aura/event_filter_unittest.cc ('k') | ui/aura/test/test_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698