| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // Checks if this finger is already down, if so, returns the current target. | 77 // Checks if this finger is already down, if so, returns the current target. |
| 78 // Otherwise, returns NULL. | 78 // Otherwise, returns NULL. |
| 79 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget( | 79 GestureConsumer* GestureRecognizerImpl::GetTouchLockedTarget( |
| 80 const TouchEvent& event) { | 80 const TouchEvent& event) { |
| 81 return touch_id_target_[event.touch_id()]; | 81 return touch_id_target_[event.touch_id()]; |
| 82 } | 82 } |
| 83 | 83 |
| 84 GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent( | 84 GestureConsumer* GestureRecognizerImpl::GetTargetForGestureEvent( |
| 85 const GestureEvent& event) { | 85 const GestureEvent& event) { |
| 86 GestureConsumer* target = NULL; | |
| 87 int touch_id = event.details().oldest_touch_id(); | 86 int touch_id = event.details().oldest_touch_id(); |
| 88 target = touch_id_target_for_gestures_[touch_id]; | 87 if (!touch_id_target_for_gestures_.count(touch_id)) { |
| 89 return target; | 88 NOTREACHED() << "Touch ID does not map to a valid GestureConsumer."; |
| 89 return nullptr; |
| 90 } |
| 91 |
| 92 return touch_id_target_for_gestures_.at(touch_id); |
| 90 } | 93 } |
| 91 | 94 |
| 92 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( | 95 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( |
| 93 const gfx::PointF& location, int source_device_id) { | 96 const gfx::PointF& location, int source_device_id) { |
| 94 const float max_distance = | 97 const float max_distance = |
| 95 GestureConfiguration::GetInstance() | 98 GestureConfiguration::GetInstance() |
| 96 ->max_separation_for_gesture_touches_in_pixels(); | 99 ->max_separation_for_gesture_touches_in_pixels(); |
| 97 | 100 |
| 98 gfx::PointF closest_point; | 101 gfx::PointF closest_point; |
| 99 int closest_touch_id = 0; | 102 int closest_touch_id = 0; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 std::vector<GestureEventHelper*>::iterator it; | 342 std::vector<GestureEventHelper*>::iterator it; |
| 340 for (it = helpers.begin(); it != helpers.end(); ++it) | 343 for (it = helpers.begin(); it != helpers.end(); ++it) |
| 341 gesture_recognizer->AddGestureEventHelper(*it); | 344 gesture_recognizer->AddGestureEventHelper(*it); |
| 342 | 345 |
| 343 helpers.clear(); | 346 helpers.clear(); |
| 344 g_gesture_recognizer_instance = | 347 g_gesture_recognizer_instance = |
| 345 static_cast<GestureRecognizerImpl*>(gesture_recognizer); | 348 static_cast<GestureRecognizerImpl*>(gesture_recognizer); |
| 346 } | 349 } |
| 347 | 350 |
| 348 } // namespace ui | 351 } // namespace ui |
| OLD | NEW |