OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/synchronization/lock.h" |
| 11 #include "ui/gfx/point.h" |
| 12 #include "ui/gfx/point_f.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class FlingCurve; |
| 17 |
| 18 // A class to manage dynamically adjustable parameters controlling the |
| 19 // shape of the fling deacceleration function. |
| 20 class FlingCurveConfiguration { |
| 21 public: |
| 22 FlingCurveConfiguration(); |
| 23 virtual ~FlingCurveConfiguration(); |
| 24 |
| 25 // Create a touchpad fling curve using the current parameters. |
| 26 FlingCurve* CreateForTouchPad(const gfx::PointF& velocity, |
| 27 const gfx::Point& cumulative_scroll); |
| 28 |
| 29 // Create a touchscreen fling curve using the current parameters. |
| 30 FlingCurve* CreateForTouchScreen(const gfx::PointF& velocity, |
| 31 const gfx::Point& cumulative_scroll); |
| 32 |
| 33 // Set the curve parameters. |
| 34 void SetCurveParameters(const std::vector<float>& new_touchpad, |
| 35 const std::vector<float>& new_touchscreen); |
| 36 |
| 37 private: |
| 38 FlingCurve* CreateCore(const std::vector<float>& coefs, |
| 39 const gfx::PointF& velocity, |
| 40 const gfx::Point& cumulative_scroll); |
| 41 |
| 42 // Protect access to touchpad_coefs_ and touchscreen_coefs_. |
| 43 base::Lock lock_; |
| 44 std::vector<float> touchpad_coefs_; |
| 45 std::vector<float> touchscreen_coefs_; |
| 46 |
| 47 DISALLOW_COPY_AND_ASSIGN(FlingCurveConfiguration); |
| 48 }; |
| 49 |
| 50 } // namespace content |
| 51 |
| 52 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |
OLD | NEW |