| 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/base/gestures/gesture_recognizer_impl.h" | 5 #include "ui/base/gestures/gesture_recognizer_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "ui/base/events.h" | 10 #include "ui/base/events.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 return touch_id_target_[closest_point->touch_id()]; | 150 return touch_id_target_[closest_point->touch_id()]; |
| 151 else | 151 else |
| 152 return NULL; | 152 return NULL; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void GestureRecognizerImpl::CancelNonCapturedTouches( | 155 void GestureRecognizerImpl::CancelNonCapturedTouches( |
| 156 GestureConsumer* capturer) { | 156 GestureConsumer* capturer) { |
| 157 std::map<int, GestureConsumer*>::iterator i; | 157 std::map<int, GestureConsumer*>::iterator i; |
| 158 // Fire touch cancels, and target touch_ids to gesture_consumer_ignorer. | 158 // Fire touch cancels, and target touch_ids to gesture_consumer_ignorer. |
| 159 for (i = touch_id_target_.begin(); i != touch_id_target_.end(); ++i) { | 159 for (i = touch_id_target_.begin(); i != touch_id_target_.end(); ++i) { |
| 160 if (capturer != i->second) { | 160 if (capturer != i->second && |
| 161 scoped_ptr<TouchEvent> touchEvent(helper_->CreateTouchEvent( | 161 touch_id_target_[i->first] != gesture_consumer_ignorer_.get()) { |
| 162 scoped_ptr<TouchEvent> touch_event(helper_->CreateTouchEvent( |
| 162 ui::ET_TOUCH_CANCELLED, gfx::Point(0, 0), | 163 ui::ET_TOUCH_CANCELLED, gfx::Point(0, 0), |
| 163 i->first, | 164 i->first, |
| 164 base::Time::NowFromSystemTime() - base::Time())); | 165 base::Time::NowFromSystemTime() - base::Time())); |
| 165 helper_->DispatchCancelTouchEvent(touchEvent.get()); | 166 helper_->DispatchCancelTouchEvent(touch_event.get()); |
| 166 touch_id_target_[i->first] = gesture_consumer_ignorer_.get(); | 167 touch_id_target_[i->first] = gesture_consumer_ignorer_.get(); |
| 167 } | 168 } |
| 168 } | 169 } |
| 169 } | 170 } |
| 170 | 171 |
| 171 //////////////////////////////////////////////////////////////////////////////// | 172 //////////////////////////////////////////////////////////////////////////////// |
| 172 // GestureRecognizerImpl, protected: | 173 // GestureRecognizerImpl, protected: |
| 173 | 174 |
| 174 GestureSequence* GestureRecognizerImpl::CreateSequence( | 175 GestureSequence* GestureRecognizerImpl::CreateSequence( |
| 175 GestureEventHelper* helper) { | 176 GestureEventHelper* helper) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 if (touch_id_target_for_gestures_.count(touch_id)) | 271 if (touch_id_target_for_gestures_.count(touch_id)) |
| 271 touch_id_target_for_gestures_.erase(touch_id); | 272 touch_id_target_for_gestures_.erase(touch_id); |
| 272 } | 273 } |
| 273 | 274 |
| 274 // GestureRecognizer, static | 275 // GestureRecognizer, static |
| 275 GestureRecognizer* GestureRecognizer::Create(GestureEventHelper* helper) { | 276 GestureRecognizer* GestureRecognizer::Create(GestureEventHelper* helper) { |
| 276 return new GestureRecognizerImpl(helper); | 277 return new GestureRecognizerImpl(helper); |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace ui | 280 } // namespace ui |
| OLD | NEW |