Chromium Code Reviews| 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 // Record and generate the gesture UMA histograms for all platforms. | |
|
tdresser
2014/08/27 12:35:38
I think the method name is probably descriptive en
lanwei
2014/08/27 23:31:59
Done.
| |
| 269 GestureTouchUMAHistogram umaHistogram; | |
|
tdresser
2014/08/27 12:35:38
Why are you instantiating a new instance of Gestur
lanwei
2014/08/27 23:31:59
The send function does not know uma_histogram_. As
| |
| 270 umaHistogram.RecordGestureEvent(gesture); | |
| 268 } | 271 } |
| 269 | 272 |
| 270 // ScaleGestureDetector::ScaleGestureListener implementation. | 273 // ScaleGestureDetector::ScaleGestureListener implementation. |
| 271 virtual bool OnScaleBegin(const ScaleGestureDetector& detector, | 274 virtual bool OnScaleBegin(const ScaleGestureDetector& detector, |
| 272 const MotionEvent& e) OVERRIDE { | 275 const MotionEvent& e) OVERRIDE { |
| 273 if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) | 276 if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode()) |
| 274 return false; | 277 return false; |
| 275 return true; | 278 return true; |
| 276 } | 279 } |
| 277 | 280 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 649 GetMotionEventActionName(event.GetAction())); | 652 GetMotionEventActionName(event.GetAction())); |
| 650 | 653 |
| 651 DCHECK_NE(0u, event.GetPointerCount()); | 654 DCHECK_NE(0u, event.GetPointerCount()); |
| 652 | 655 |
| 653 if (!CanHandle(event)) | 656 if (!CanHandle(event)) |
| 654 return false; | 657 return false; |
| 655 | 658 |
| 656 OnTouchEventHandlingBegin(event); | 659 OnTouchEventHandlingBegin(event); |
| 657 gesture_listener_->OnTouchEvent(event); | 660 gesture_listener_->OnTouchEvent(event); |
| 658 OnTouchEventHandlingEnd(event); | 661 OnTouchEventHandlingEnd(event); |
| 662 // Record and generate the touch UMA histograms for all platforms. | |
|
tdresser
2014/08/27 12:35:38
Comment is unnecessary.
lanwei
2014/08/27 23:31:59
Done.
| |
| 663 umaHistogram.RecordTouchEvent(event); | |
| 659 return true; | 664 return true; |
| 660 } | 665 } |
| 661 | 666 |
| 662 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) { | 667 void GestureProvider::SetMultiTouchZoomSupportEnabled(bool enabled) { |
| 663 gesture_listener_->SetMultiTouchZoomEnabled(enabled); | 668 gesture_listener_->SetMultiTouchZoomEnabled(enabled); |
| 664 } | 669 } |
| 665 | 670 |
| 666 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { | 671 void GestureProvider::SetDoubleTapSupportForPlatformEnabled(bool enabled) { |
| 667 if (double_tap_support_for_platform_ == enabled) | 672 if (double_tap_support_for_platform_ == enabled) |
| 668 return; | 673 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. | 761 // null'ing of the listener until the sequence has ended. |
| 757 if (current_down_event_) | 762 if (current_down_event_) |
| 758 return; | 763 return; |
| 759 | 764 |
| 760 const bool double_tap_enabled = | 765 const bool double_tap_enabled = |
| 761 double_tap_support_for_page_ && double_tap_support_for_platform_; | 766 double_tap_support_for_page_ && double_tap_support_for_platform_; |
| 762 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); | 767 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); |
| 763 } | 768 } |
| 764 | 769 |
| 765 } // namespace ui | 770 } // namespace ui |
| OLD | NEW |