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

Unified Diff: ui/views/widget/root_view.cc

Issue 552503003: Introduce EventProcessor::OnEventProcessingStarted() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sadrul comments addressed Created 6 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/views/widget/root_view.h ('k') | ui/views/widget/root_view_targeter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/root_view.cc
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index d05f1d8fd7bd2919ed6eab3ddf6ae5a9766d1215..628ca4c8ee126a6e0d55a5943fe595fec7f16e17 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -249,55 +249,37 @@ ui::EventTarget* RootView::GetRootTarget() {
return this;
}
-ui::EventDispatchDetails RootView::OnEventFromSource(ui::Event* event) {
- if (event->IsKeyEvent())
- return EventProcessor::OnEventFromSource(event);
+void RootView::OnEventProcessingStarted(ui::Event* event) {
+ if (!event->IsGestureEvent())
+ return;
- if (event->IsScrollEvent())
- return EventProcessor::OnEventFromSource(event);
+ ui::GestureEvent* gesture_event = event->AsGestureEvent();
- if (event->IsGestureEvent()) {
- // TODO(tdanderson): Once DispatchGestureEvent() has been removed, move
- // all of this logic into an override of a new
- // virtual method
- // EventProcessor::OnEventProcessingStarted() (which
- // returns false if no processing should take place).
- // Also move the implementation of
- // PrepareEventForDispatch() into this new method.
- // Then RootView::OnEventFromSource() can be removed.
- ui::GestureEvent* gesture_event = event->AsGestureEvent();
-
- // Do not dispatch ui::ET_GESTURE_BEGIN events.
- if (gesture_event->type() == ui::ET_GESTURE_BEGIN)
- return DispatchDetails();
-
- // Ignore ui::ET_GESTURE_END events which do not correspond to the
- // removal of the final touch point.
- if (gesture_event->type() == ui::ET_GESTURE_END &&
- gesture_event->details().touch_points() > 1) {
- return DispatchDetails();
- }
-
- // Ignore subsequent gesture scroll events if no handler was set for a
- // ui::ET_GESTURE_SCROLL_BEGIN event.
- if (!gesture_handler_ &&
- (gesture_event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
- gesture_event->type() == ui::ET_GESTURE_SCROLL_END ||
- gesture_event->type() == ui::ET_SCROLL_FLING_START)) {
- return DispatchDetails();
- }
-
- gesture_handler_set_before_processing_ = !!gesture_handler_;
- return EventProcessor::OnEventFromSource(event);
+ // Do not process ui::ET_GESTURE_BEGIN events.
+ if (gesture_event->type() == ui::ET_GESTURE_BEGIN) {
+ event->SetHandled();
+ return;
}
- if (event->IsTouchEvent())
- NOTREACHED() << "Touch events should not be sent to RootView.";
+ // Do not process ui::ET_GESTURE_END events which do not correspond to the
+ // removal of the final touch point.
+ if (gesture_event->type() == ui::ET_GESTURE_END &&
+ gesture_event->details().touch_points() > 1) {
+ event->SetHandled();
+ return;
+ }
- if (event->IsMouseEvent())
- NOTREACHED() << "Should not be called with a MouseEvent.";
+ // Do not process subsequent gesture scroll events if no handler was set for
+ // a ui::ET_GESTURE_SCROLL_BEGIN event.
+ if (!gesture_handler_ &&
+ (gesture_event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
+ gesture_event->type() == ui::ET_GESTURE_SCROLL_END ||
+ gesture_event->type() == ui::ET_SCROLL_FLING_START)) {
+ event->SetHandled();
+ return;
+ }
- return DispatchDetails();
+ gesture_handler_set_before_processing_ = !!gesture_handler_;
}
void RootView::OnEventProcessingFinished(ui::Event* event) {
« no previous file with comments | « ui/views/widget/root_view.h ('k') | ui/views/widget/root_view_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698