| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/events/gestures/gesture_recognizer_impl.h" | 5 #include "ui/events/gestures/gesture_recognizer_impl.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 bool cancelled_touch = false; | 165 bool cancelled_touch = false; |
| 166 if (consumer_gesture_provider_.count(consumer) == 0) | 166 if (consumer_gesture_provider_.count(consumer) == 0) |
| 167 return false; | 167 return false; |
| 168 const MotionEventAura& pointer_state = | 168 const MotionEventAura& pointer_state = |
| 169 consumer_gesture_provider_[consumer]->pointer_state(); | 169 consumer_gesture_provider_[consumer]->pointer_state(); |
| 170 if (pointer_state.GetPointerCount() == 0) | 170 if (pointer_state.GetPointerCount() == 0) |
| 171 return false; | 171 return false; |
| 172 // pointer_state is modified every time after DispatchCancelTouchEvent. | 172 // pointer_state is modified every time after DispatchCancelTouchEvent. |
| 173 scoped_ptr<MotionEvent> pointer_state_clone = pointer_state.Clone(); | 173 scoped_ptr<MotionEvent> pointer_state_clone = pointer_state.Clone(); |
| 174 for (size_t i = 0; i < pointer_state_clone->GetPointerCount(); ++i) { | 174 for (size_t i = 0; i < pointer_state_clone->GetPointerCount(); ++i) { |
| 175 TouchEvent touch_event(ui::ET_TOUCH_CANCELLED, gfx::Point(), |
| 176 ui::EF_IS_SYNTHESIZED, |
| 177 pointer_state_clone->GetPointerId(i), |
| 178 ui::EventTimeForNow(), 0.0f, 0.0f, 0.0f, 0.0f); |
| 175 gfx::PointF point(pointer_state_clone->GetX(i), | 179 gfx::PointF point(pointer_state_clone->GetX(i), |
| 176 pointer_state_clone->GetY(i)); | 180 pointer_state_clone->GetY(i)); |
| 177 TouchEvent touch_event(ui::ET_TOUCH_CANCELLED, | 181 touch_event.set_location_f(point); |
| 178 point, | 182 touch_event.set_root_location_f(point); |
| 179 ui::EF_IS_SYNTHESIZED, | |
| 180 pointer_state_clone->GetPointerId(i), | |
| 181 ui::EventTimeForNow(), | |
| 182 0.0f, | |
| 183 0.0f, | |
| 184 0.0f, | |
| 185 0.0f); | |
| 186 GestureEventHelper* helper = FindDispatchHelperForConsumer(consumer); | 183 GestureEventHelper* helper = FindDispatchHelperForConsumer(consumer); |
| 187 if (helper) | 184 if (helper) |
| 188 helper->DispatchCancelTouchEvent(&touch_event); | 185 helper->DispatchCancelTouchEvent(&touch_event); |
| 189 cancelled_touch = true; | 186 cancelled_touch = true; |
| 190 } | 187 } |
| 191 return cancelled_touch; | 188 return cancelled_touch; |
| 192 } | 189 } |
| 193 | 190 |
| 194 //////////////////////////////////////////////////////////////////////////////// | 191 //////////////////////////////////////////////////////////////////////////////// |
| 195 // GestureRecognizerImpl, private: | 192 // GestureRecognizerImpl, private: |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 std::vector<GestureEventHelper*>::iterator it; | 314 std::vector<GestureEventHelper*>::iterator it; |
| 318 for (it = helpers.begin(); it != helpers.end(); ++it) | 315 for (it = helpers.begin(); it != helpers.end(); ++it) |
| 319 gesture_recognizer->AddGestureEventHelper(*it); | 316 gesture_recognizer->AddGestureEventHelper(*it); |
| 320 | 317 |
| 321 helpers.clear(); | 318 helpers.clear(); |
| 322 g_gesture_recognizer_instance = | 319 g_gesture_recognizer_instance = |
| 323 static_cast<GestureRecognizerImpl*>(gesture_recognizer); | 320 static_cast<GestureRecognizerImpl*>(gesture_recognizer); |
| 324 } | 321 } |
| 325 | 322 |
| 326 } // namespace ui | 323 } // namespace ui |
| OLD | NEW |