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

Unified Diff: views/widget/root_view.cc

Issue 6347002: touch: Return an enum from OnTouchEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update tests, add a missed case. Created 9 years, 11 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 | « views/widget/root_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/widget/root_view.cc
diff --git a/views/widget/root_view.cc b/views/widget/root_view.cc
index 143b23ad99429c1d19b454c8fb86a5ba6b69c822..05f65cb8debf5f376c5bc023578ec7ba7a4516a1 100644
--- a/views/widget/root_view.cc
+++ b/views/widget/root_view.cc
@@ -306,16 +306,19 @@ void RootView::SetFocusOnMousePressed(bool f) {
}
#if defined(TOUCH_UI)
-bool RootView::OnTouchEvent(const TouchEvent& e) {
+View::TouchStatus RootView::OnTouchEvent(const TouchEvent& e) {
// If touch_pressed_handler_ is non null, we are currently processing
// a touch down on the screen situation. In that case we send the
// event to touch_pressed_handler_
+ View::TouchStatus status = TOUCH_STATUS_UNKNOWN;
if (touch_pressed_handler_) {
TouchEvent touch_event(e, this, touch_pressed_handler_);
- touch_pressed_handler_->ProcessTouchEvent(touch_event);
+ status = touch_pressed_handler_->ProcessTouchEvent(touch_event);
gesture_manager_->ProcessTouchEventForGesture(e, this, true);
- return true;
+ if (status == TOUCH_STATUS_END)
+ touch_pressed_handler_ = NULL;
+ return status;
}
bool handled = false;
@@ -327,12 +330,17 @@ bool RootView::OnTouchEvent(const TouchEvent& e) {
// Disabled views eat events but are treated as not handled by the
// the GestureManager.
handled = false;
+ status = TOUCH_STATUS_UNKNOWN;
break;
}
// See if this view wants to handle the touch
TouchEvent touch_event(e, this, touch_pressed_handler_);
- handled = touch_pressed_handler_->ProcessTouchEvent(touch_event);
+ status = touch_pressed_handler_->ProcessTouchEvent(touch_event);
+ if (status == TOUCH_STATUS_END)
+ touch_pressed_handler_ = NULL;
+
+ handled = status != TOUCH_STATUS_UNKNOWN;
// The view could have removed itself from the tree when handling
// OnTouchEvent(). So handle as per OnMousePressed. NB: we
@@ -348,7 +356,7 @@ bool RootView::OnTouchEvent(const TouchEvent& e) {
// forwarded to that view.
if (handled) {
gesture_manager_->ProcessTouchEventForGesture(e, this, handled);
rjkroege 2011/01/17 19:27:40 there should probably be a TODO (and it can be for
sadrul 2011/01/18 03:50:15 Done.
- return true;
+ return status;
}
}
@@ -357,7 +365,7 @@ bool RootView::OnTouchEvent(const TouchEvent& e) {
// Give the touch event to the gesture manager.
gesture_manager_->ProcessTouchEventForGesture(e, this, handled);
- return handled;
+ return status;
}
#endif
« no previous file with comments | « views/widget/root_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698