#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "ui/events/gesture_detection/gesture_detector.h"
#include <stddef.h>
#include <algorithm>
#include <cmath>
#include "base/memory/raw_ptr.h"
#include "base/numerics/angle_conversions.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event_constants.h"
#include "ui/events/gesture_detection/gesture_listeners.h"
#include "ui/events/velocity_tracker/motion_event.h"
namespace ui {
namespace {
const float kScrollEpsilon = …;
enum TimeoutEvent { … };
}
GestureDetector::Config::Config() = default;
GestureDetector::Config::Config(const Config& other) = default;
GestureDetector::Config::~Config() = default;
class GestureDetector::TimeoutGestureHandler { … };
GestureDetector::GestureDetector(
const Config& config,
GestureListener* listener,
DoubleTapListener* optional_double_tap_listener)
: … { … }
GestureDetector::~GestureDetector() = default;
bool GestureDetector::OnTouchEvent(const MotionEvent& ev,
bool should_process_double_tap) { … }
void GestureDetector::SetDoubleTapListener(
DoubleTapListener* double_tap_listener) { … }
void GestureDetector::Init(const Config& config) { … }
void GestureDetector::OnShowPressTimeout() { … }
void GestureDetector::OnShortPressTimeout() { … }
void GestureDetector::OnLongPressTimeout() { … }
void GestureDetector::OnTapTimeout() { … }
void GestureDetector::ActivateShortPressGesture(const MotionEvent& ev) { … }
void GestureDetector::ActivateLongPressGesture(const MotionEvent& ev) { … }
void GestureDetector::Cancel() { … }
void GestureDetector::CancelTaps() { … }
bool GestureDetector::IsRepeatedTap(const MotionEvent& first_down,
const MotionEvent& first_up,
const MotionEvent& second_down,
bool should_process_double_tap) const { … }
bool GestureDetector::HandleSwipeIfNeeded(const MotionEvent& up,
float vx,
float vy) { … }
bool GestureDetector::IsWithinSlopForTap(const MotionEvent& ev) { … }
const MotionEvent* GestureDetector::GetSourcePointerDownEvent(
const MotionEvent& current_down_event,
const MotionEvent* secondary_pointer_down_event,
const int pointer_id) { … }
}