summaryrefslogtreecommitdiffstats
path: root/content/child/fling_curve_configuration.cc
diff options
context:
space:
mode:
authorpilgrim@chromium.org <pilgrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 23:38:15 +0000
committerpilgrim@chromium.org <pilgrim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-24 23:38:15 +0000
commit64f1e750507cabbd8587e06fd1542ad8af71d22d (patch)
tree9f8dab392c203d5fbd14585c2c72a60632e41e4c /content/child/fling_curve_configuration.cc
parent88cc061533f2cfdbc57f70d68122669c598546db (diff)
downloadchromium_src-64f1e750507cabbd8587e06fd1542ad8af71d22d.zip
chromium_src-64f1e750507cabbd8587e06fd1542ad8af71d22d.tar.gz
chromium_src-64f1e750507cabbd8587e06fd1542ad8af71d22d.tar.bz2
Move fling_curve_configuration.* to content/child/
BUG=338338 TBR=darin@chromium.org Review URL: https://codereview.chromium.org/159503004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@253028 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/child/fling_curve_configuration.cc')
-rw-r--r--content/child/fling_curve_configuration.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/content/child/fling_curve_configuration.cc b/content/child/fling_curve_configuration.cc
new file mode 100644
index 0000000..799511a
--- /dev/null
+++ b/content/child/fling_curve_configuration.cc
@@ -0,0 +1,56 @@
+// Copyright 2014 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.
+
+#include "content/child/fling_curve_configuration.h"
+
+#include "base/logging.h"
+#include "third_party/WebKit/public/platform/WebGestureCurve.h"
+#include "webkit/child/touch_fling_gesture_curve.h"
+
+namespace content {
+
+FlingCurveConfiguration::FlingCurveConfiguration() { }
+
+FlingCurveConfiguration::~FlingCurveConfiguration() { }
+
+void FlingCurveConfiguration::SetCurveParameters(
+ const std::vector<float>& new_touchpad,
+ const std::vector<float>& new_touchscreen) {
+ DCHECK(new_touchpad.size() >= 3);
+ DCHECK(new_touchscreen.size() >= 3);
+ base::AutoLock scoped_lock(lock_);
+ touchpad_coefs_ = new_touchpad;
+ touchscreen_coefs_ = new_touchscreen;
+}
+
+blink::WebGestureCurve* FlingCurveConfiguration::CreateCore(
+ const std::vector<float>& coefs,
+ const blink::WebFloatPoint& velocity,
+ const blink::WebSize& cumulativeScroll) {
+ float p0, p1, p2;
+
+ {
+ base::AutoLock scoped_lock(lock_);
+ p0 = coefs[0];
+ p1 = coefs[1];
+ p2 = coefs[2];
+ }
+
+ return webkit_glue::TouchFlingGestureCurve::Create(velocity, p0, p1, p2,
+ cumulativeScroll);
+}
+
+blink::WebGestureCurve* FlingCurveConfiguration::CreateForTouchPad(
+ const blink::WebFloatPoint& velocity,
+ const blink::WebSize& cumulativeScroll) {
+ return CreateCore(touchpad_coefs_, velocity, cumulativeScroll);
+}
+
+blink::WebGestureCurve* FlingCurveConfiguration::CreateForTouchScreen(
+ const blink::WebFloatPoint& velocity,
+ const blink::WebSize& cumulativeScroll) {
+ return CreateCore(touchscreen_coefs_, velocity, cumulativeScroll);
+}
+
+} // namespace content