Remove ExtensionPrefs::SetDidExtensionEscalatePermissions.
[chromium-blink-merge.git] / ui / events / gesture_detection / velocity_tracker_state.h
blob37906f5da6b15feafedce43727287a7ce19110c5
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
3 // found in the LICENSE file.
5 #ifndef UI_EVENTS_GESTURE_DETECTION_VELOCITY_TRACKER_STATE_H_
6 #define UI_EVENTS_GESTURE_DETECTION_VELOCITY_TRACKER_STATE_H_
8 #include "base/basictypes.h"
9 #include "ui/events/gesture_detection/bitset_32.h"
10 #include "ui/events/gesture_detection/gesture_detection_export.h"
11 #include "ui/events/gesture_detection/velocity_tracker.h"
13 namespace ui {
15 class MotionEvent;
17 // Port of VelocityTrackerState from Android
18 // * platform/frameworks/base/core/jni/android_view_VelocityTracker.cpp
19 // * Change-Id: I3517881b87b47dcc209d80dbd0ac6b5cf29a766f
20 // * Please update the Change-Id as upstream Android changes are pulled.
21 class GESTURE_DETECTION_EXPORT VelocityTrackerState {
22 public:
23 explicit VelocityTrackerState(VelocityTracker::Strategy strategy);
24 ~VelocityTrackerState();
26 void Clear();
27 void AddMovement(const MotionEvent& event);
28 void ComputeCurrentVelocity(int32_t units, float max_velocity);
29 float GetXVelocity(int32_t id) const;
30 float GetYVelocity(int32_t id) const;
32 private:
33 struct Velocity {
34 float vx, vy;
37 void GetVelocity(int32_t id, float* out_vx, float* out_vy) const;
39 VelocityTracker velocity_tracker_;
40 int32_t active_pointer_id_;
41 BitSet32 calculated_id_bits_;
42 Velocity calculated_velocity_[VelocityTracker::MAX_POINTERS];
44 DISALLOW_COPY_AND_ASSIGN(VelocityTrackerState);
47 } // namespace ui
49 #endif // UI_EVENTS_GESTURE_DETECTION_VELOCITY_TRACKER_STATE_H_