Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: ui/events/gesture_detection/gesture_provider.cc

Issue 302463004: Implementing the dispatch of the swipe gesture for one-finger touch swipes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementing review feedback. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 378 }
379 379
380 provider_->Fling(e2, velocity_x, velocity_y); 380 provider_->Fling(e2, velocity_x, velocity_y);
381 return true; 381 return true;
382 } 382 }
383 383
384 virtual bool OnSwipe(const MotionEvent& e1, 384 virtual bool OnSwipe(const MotionEvent& e1,
385 const MotionEvent& e2, 385 const MotionEvent& e2,
386 float velocity_x, 386 float velocity_x,
387 float velocity_y) OVERRIDE { 387 float velocity_y) OVERRIDE {
388 GestureEventDetails swipe_details( 388 GestureEventDetails swipe_details(ET_GESTURE_SWIPE, velocity_x, velocity_y);
389 ET_GESTURE_MULTIFINGER_SWIPE, velocity_x, velocity_y); 389 provider_->Send(CreateGesture(ET_GESTURE_SWIPE, e2, swipe_details));
390 provider_->Send(
391 CreateGesture(ET_GESTURE_MULTIFINGER_SWIPE, e2, swipe_details));
392 return true; 390 return true;
393 } 391 }
394 392
395 virtual bool OnTwoFingerTap(const MotionEvent& e1, 393 virtual bool OnTwoFingerTap(const MotionEvent& e1,
396 const MotionEvent& e2) OVERRIDE { 394 const MotionEvent& e2) OVERRIDE {
397 // The location of the two finger tap event should be the location of the 395 // The location of the two finger tap event should be the location of the
398 // primary pointer. 396 // primary pointer.
399 GestureEventDetails two_finger_tap_details(ET_GESTURE_TWO_FINGER_TAP, 397 GestureEventDetails two_finger_tap_details(ET_GESTURE_TWO_FINGER_TAP,
400 e1.GetTouchMajor(), 398 e1.GetTouchMajor(),
401 e1.GetTouchMajor()); 399 e1.GetTouchMajor());
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 if (current_down_event_) 783 if (current_down_event_)
786 return; 784 return;
787 785
788 const bool double_tap_enabled = double_tap_support_for_page_ && 786 const bool double_tap_enabled = double_tap_support_for_page_ &&
789 double_tap_support_for_platform_; 787 double_tap_support_for_platform_;
790 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); 788 gesture_listener_->SetDoubleTapEnabled(double_tap_enabled);
791 scale_gesture_listener_->SetDoubleTapEnabled(double_tap_enabled); 789 scale_gesture_listener_->SetDoubleTapEnabled(double_tap_enabled);
792 } 790 }
793 791
794 } // namespace ui 792 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_detector.cc ('k') | ui/events/gesture_detection/gesture_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698