summaryrefslogtreecommitdiffstats
path: root/webkit/child/fling_curve_configuration.h
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-13 20:02:21 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-13 20:02:21 +0000
commitb52a42243daf55ec35be02f382e6873aeb9a3992 (patch)
tree18f5937da732ff2b91c9d52b25d632c4ebea13b9 /webkit/child/fling_curve_configuration.h
parent9559f2c9c5a2760fd3ba291eae6f3fd5c7e921a4 (diff)
downloadchromium_src-b52a42243daf55ec35be02f382e6873aeb9a3992.zip
chromium_src-b52a42243daf55ec35be02f382e6873aeb9a3992.tar.gz
chromium_src-b52a42243daf55ec35be02f382e6873aeb9a3992.tar.bz2
move webkit/glue/fling_* to webkit/child
A little bit of rejiggering for Android JNI registration. R=jam@chromium.org, jamesr@chromium.org BUG=237249 Review URL: https://codereview.chromium.org/16424008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206148 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/child/fling_curve_configuration.h')
-rw-r--r--webkit/child/fling_curve_configuration.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/webkit/child/fling_curve_configuration.h b/webkit/child/fling_curve_configuration.h
new file mode 100644
index 0000000..2ce5ba1
--- /dev/null
+++ b/webkit/child/fling_curve_configuration.h
@@ -0,0 +1,58 @@
+// 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 WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
+#define WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
+
+#include <vector>
+
+#include "base/synchronization/lock.h"
+#include "third_party/WebKit/public/platform/WebFloatPoint.h"
+#include "third_party/WebKit/public/platform/WebSize.h"
+
+namespace WebKit {
+class WebGestureCurve;
+}
+
+namespace webkit_glue {
+
+// 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.
+ WebKit::WebGestureCurve* CreateForTouchPad(
+ const WebKit::WebFloatPoint& velocity,
+ const WebKit::WebSize& cumulativeScroll);
+
+ // Create a touchscreen fling curve using the current parameters.
+ WebKit::WebGestureCurve* CreateForTouchScreen(
+ const WebKit::WebFloatPoint& velocity,
+ const WebKit::WebSize& cumulativeScroll);
+
+ // Set the curve parameters.
+ void SetCurveParameters(
+ const std::vector<float>& new_touchpad,
+ const std::vector<float>& new_touchscreen);
+
+ private:
+ WebKit::WebGestureCurve* CreateCore(
+ const std::vector<float>& coefs,
+ const WebKit::WebFloatPoint& velocity,
+ const WebKit::WebSize& cumulativeScroll);
+
+ // 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 webkit_glue
+
+#endif // WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_