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

Unified Diff: ui/aura_shell/desktop_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/test/test_event_filter.cc ('k') | ui/aura_shell/desktop_event_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura_shell/desktop_event_filter.h
diff --git a/ui/aura_shell/desktop_event_filter.h b/ui/aura_shell/desktop_event_filter.h
index 1ad0438e5ffe5c1a9c207affd17c8923c06436b6..a5cb2c85922840a45406e7c8b3eec583c6766114 100644
--- a/ui/aura_shell/desktop_event_filter.h
+++ b/ui/aura_shell/desktop_event_filter.h
@@ -7,17 +7,29 @@
#pragma once
#include "base/compiler_specific.h"
+#include "base/observer_list.h"
#include "ui/aura/event_filter.h"
#include "ui/aura_shell/aura_shell_export.h"
namespace aura_shell {
namespace internal {
+// DesktopEventFilter gets all desktop events first and can provide actions to
+// those events. It implements desktop features such as click to activate a
+// window and cursor change when moving mouse.
+// Additional event filters can be added to DesktopEventFilter. Events will
+// pass through those additional filters in their addition order and could be
+// consumed by any of those filters. If an event is consumed by a filter, the
+// rest of the filter(s) and DesktopEventFilter will not see the consumed event.
class AURA_SHELL_EXPORT DesktopEventFilter : public aura::EventFilter {
public:
DesktopEventFilter();
virtual ~DesktopEventFilter();
+ // Adds/removes additional event filters.
+ void AddFilter(aura::EventFilter* filter);
+ void RemoveFilter(aura::EventFilter* filter);
+
// Overridden from EventFilter:
virtual bool PreHandleKeyEvent(aura::Window* target,
aura::KeyEvent* event) OVERRIDE;
@@ -34,6 +46,16 @@ class AURA_SHELL_EXPORT DesktopEventFilter : public aura::EventFilter {
// default resize cursors for window edges.
void HandleMouseMoved(aura::Window* target, aura::MouseEvent* event);
+ // Dispatches event to addtional filters. Returns false or
+ // ui::TOUCH_STATUS_UNKNOWN if event is consumed.
+ bool FilterKeyEvent(aura::Window* target, aura::KeyEvent* event);
+ bool FilterMouseEvent(aura::Window* target, aura::MouseEvent* event);
+ ui::TouchStatus FilterTouchEvent(aura::Window* target,
+ aura::TouchEvent* event);
+
+ // Additional event filters that pre-handles events.
+ ObserverList<aura::EventFilter, true> filters_;
+
DISALLOW_COPY_AND_ASSIGN(DesktopEventFilter);
};
« no previous file with comments | « ui/aura/test/test_event_filter.cc ('k') | ui/aura_shell/desktop_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698