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

Unified Diff: ui/aura/shared/compound_event_filter.cc

Issue 10964051: events: Clean up dispatching code for touch-events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 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/aura/shared/compound_event_filter.h ('k') | ui/aura/test/test_event_filter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/shared/compound_event_filter.cc
diff --git a/ui/aura/shared/compound_event_filter.cc b/ui/aura/shared/compound_event_filter.cc
index 0471819c91b1084a294dab669077d3bfb9b4485b..c8758f22ec5b45758481a0dda9324c3b7cfb7c71 100644
--- a/ui/aura/shared/compound_event_filter.cc
+++ b/ui/aura/shared/compound_event_filter.cc
@@ -129,19 +129,16 @@ ui::EventResult CompoundEventFilter::FilterMouseEvent(ui::MouseEvent* event) {
return static_cast<ui::EventResult>(result);
}
-ui::TouchStatus CompoundEventFilter::FilterTouchEvent(
- Window* target,
- ui::TouchEvent* event) {
- ui::TouchStatus status = ui::TOUCH_STATUS_UNKNOWN;
+ui::EventResult CompoundEventFilter::FilterTouchEvent(ui::TouchEvent* event) {
+ int result = ui::ER_UNHANDLED;
if (filters_.might_have_observers()) {
ObserverListBase<EventFilter>::Iterator it(filters_);
EventFilter* filter;
- while (status == ui::TOUCH_STATUS_UNKNOWN &&
- (filter = it.GetNext()) != NULL) {
- status = filter->OnTouchEvent(event);
+ while (!(result & ui::ER_CONSUMED) && (filter = it.GetNext()) != NULL) {
+ result |= filter->OnTouchEvent(event);
}
}
- return status;
+ return static_cast<ui::EventResult>(result);
}
void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
@@ -164,22 +161,6 @@ void CompoundEventFilter::SetCursorVisibilityOnEvent(aura::Window* target,
}
////////////////////////////////////////////////////////////////////////////////
-// CompoundEventFilter, EventFilter implementation:
-
-ui::TouchStatus CompoundEventFilter::PreHandleTouchEvent(
- Window* target,
- ui::TouchEvent* event) {
- // TODO(sad): Move the implementation into OnTouchEvent once touch-events are
- // hooked up to go through EventDispatcher.
- ui::TouchStatus status = FilterTouchEvent(target, event);
- if (status == ui::TOUCH_STATUS_UNKNOWN &&
- event->type() == ui::ET_TOUCH_PRESSED) {
- SetCursorVisibilityOnEvent(target, event, false);
- }
- return status;
-}
-
-////////////////////////////////////////////////////////////////////////////////
// CompoundEventFilter, ui::EventHandler implementation:
ui::EventResult CompoundEventFilter::OnKeyEvent(ui::KeyEvent* event) {
@@ -229,8 +210,14 @@ ui::EventResult CompoundEventFilter::OnScrollEvent(ui::ScrollEvent* event) {
return ui::ER_UNHANDLED;
}
-ui::TouchStatus CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
- return EventFilter::OnTouchEvent(event);
+ui::EventResult CompoundEventFilter::OnTouchEvent(ui::TouchEvent* event) {
+ ui::EventResult result = FilterTouchEvent(event);
+ if (result == ui::ER_UNHANDLED &&
+ event->type() == ui::ET_TOUCH_PRESSED) {
+ SetCursorVisibilityOnEvent(
+ static_cast<aura::Window*>(event->target()), event, false);
+ }
+ return result;
}
ui::EventResult CompoundEventFilter::OnGestureEvent(ui::GestureEvent* event) {
« no previous file with comments | « ui/aura/shared/compound_event_filter.h ('k') | ui/aura/test/test_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698