Chromium Code Reviews| 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 |