Index: content/browser/renderer_host/input/fling/fling_curve_configuration.h |
diff --git a/content/browser/renderer_host/input/fling/fling_curve_configuration.h b/content/browser/renderer_host/input/fling/fling_curve_configuration.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5e4b9c6e6e03e75c39408f0af088b7d60c0b0942 |
--- /dev/null |
+++ b/content/browser/renderer_host/input/fling/fling_curve_configuration.h |
@@ -0,0 +1,52 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |
+ |
+#include <vector> |
+ |
+#include "base/synchronization/lock.h" |
+#include "ui/gfx/point.h" |
+#include "ui/gfx/point_f.h" |
+ |
+namespace content { |
+ |
+class FlingCurve; |
+ |
+// A class to manage dynamically adjustable parameters controlling the |
+// shape of the fling deacceleration function. |
+class FlingCurveConfiguration { |
+ public: |
+ FlingCurveConfiguration(); |
+ virtual ~FlingCurveConfiguration(); |
+ |
+ // Create a touchpad fling curve using the current parameters. |
+ FlingCurve* CreateForTouchPad(const gfx::PointF& velocity, |
+ const gfx::Point& cumulative_scroll); |
+ |
+ // Create a touchscreen fling curve using the current parameters. |
+ FlingCurve* CreateForTouchScreen(const gfx::PointF& velocity, |
+ const gfx::Point& cumulative_scroll); |
+ |
+ // Set the curve parameters. |
+ void SetCurveParameters(const std::vector<float>& new_touchpad, |
+ const std::vector<float>& new_touchscreen); |
+ |
+ private: |
+ FlingCurve* CreateCore(const std::vector<float>& coefs, |
+ const gfx::PointF& velocity, |
+ const gfx::Point& cumulative_scroll); |
+ |
+ // Protect access to touchpad_coefs_ and touchscreen_coefs_. |
+ base::Lock lock_; |
+ std::vector<float> touchpad_coefs_; |
+ std::vector<float> touchscreen_coefs_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(FlingCurveConfiguration); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_CONFIGURATION_H_ |