| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gesture_detection/gesture_provider.h" | 5 #include "ui/events/gesture_detection/gesture_provider.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // It's possible that a double-tap drag zoom (from ScaleGestureDetector) | 258 // It's possible that a double-tap drag zoom (from ScaleGestureDetector) |
| 259 // will start before the press gesture fires (from GestureDetector), in | 259 // will start before the press gesture fires (from GestureDetector), in |
| 260 // which case the press should simply be dropped. | 260 // which case the press should simply be dropped. |
| 261 if (pinch_event_sent_ || scroll_event_sent_) | 261 if (pinch_event_sent_ || scroll_event_sent_) |
| 262 return; | 262 return; |
| 263 default: | 263 default: |
| 264 break; | 264 break; |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 client_->OnGestureEvent(gesture); | 267 client_->OnGestureEvent(gesture); |
| 268 GestureTouchUMAHistogram::RecordGestureEvent(gesture); |
| 268 } | 269 } |
| 269 | 270 |
| 270 // ScaleGestureDetector::ScaleGestureListener implementation. | 271 // ScaleGestureDetector::ScaleGestureListener implementation. |
| 271 virtual bool OnScaleBegin(const ScaleGestureDetector& detector, | 272 virtual bool OnScaleBegin(const ScaleGestureDetector& detector, |
| 272 const MotionEvent& e) OVERRIDE { | 273 const MotionEvent& e) OVERRIDE { |
| 273 if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) | 274 if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) |
| 274 return false; | 275 return false; |
| 275 return true; | 276 return true; |
| 276 } | 277 } |
| 277 | 278 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 GetMotionEventActionName(event.GetAction())); | 650 GetMotionEventActionName(event.GetAction())); |
| 650 | 651 |
| 651 DCHECK_NE(0u, event.GetPointerCount()); | 652 DCHECK_NE(0u, event.GetPointerCount()); |
| 652 | 653 |
| 653 if (!CanHandle(event)) | 654 if (!CanHandle(event)) |
| 654 return false; | 655 return false; |
| 655 | 656 |
| 656 OnTouchEventHandlingBegin(event); | 657 OnTouchEventHandlingBegin(event); |
| 657 gesture_listener_->OnTouchEvent(event); | 658 gesture_listener_->OnTouchEvent(event); |
| 658 OnTouchEventHandlingEnd(event); | 659 OnTouchEventHandlingEnd(event); |
| 660 uma_histogram_.RecordTouchEvent(event); |
| 659 return true; | 661 return true; |
| 660 } | 662 } |
| 661 | 663 |
| 662 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) { | 664 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) { |
| 663 gesture_listener_->SetMultiTouchZoomEnabled(enabled); | 665 gesture_listener_->SetMultiTouchZoomEnabled(enabled); |
| 664 } | 666 } |
| 665 | 667 |
| 666 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { | 668 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { |
| 667 if (double_tap_support_for_platform_ == enabled) | 669 if (double_tap_support_for_platform_ == enabled) |
| 668 return; | 670 return; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 // null'ing of the listener until the sequence has ended. | 758 // null'ing of the listener until the sequence has ended. |
| 757 if (current_down_event_) | 759 if (current_down_event_) |
| 758 return; | 760 return; |
| 759 | 761 |
| 760 const bool double_tap_enabled = | 762 const bool double_tap_enabled = |
| 761 double_tap_support_for_page_ && double_tap_support_for_platform_; | 763 double_tap_support_for_page_ && double_tap_support_for_platform_; |
| 762 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); | 764 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); |
| 763 } | 765 } |
| 764 | 766 |
| 765 } // namespace ui | 767 } // namespace ui |
| OLD | NEW |